moonbitstack/moonwgpu/types does not have a README file

    AddressMode

    pub(all) enum AddressMode {
    ClampToEdge
    Repeat
    MirrorRepeat
    } derive(Eq,
    Debug
    )

    GPUAddressMode.

    BackendKind

    pub(all) enum BackendKind {
    WebGpu
    Vulkan
    Metal
    Dx12
    Gles
    Memory
    } derive(Eq,
    Debug
    )

    Which kind of host an adapter came from. The specification only knows "browser"; the native backends name themselves.

    BindGroupDescriptor

    pub(all) struct BindGroupDescriptor {
    label : String
    layout : BindGroupLayoutId
    entries : Array[BindGroupEntry]
    } derive(
    Debug
    )

    A GPUBindGroupDescriptor.

    BindGroupDescriptor::new

    fn BindGroupDescriptor::new(layout~ : BindGroupLayoutId, entries~ : Array[BindGroupEntry], label? : String) -> BindGroupDescriptor

    BindGroupEntry

    pub(all) struct BindGroupEntry {
    binding : Int
    resource : BindingResource
    } derive(
    Debug
    )

    A GPUBindGroupEntry.

    BindGroupEntry::new

    fn BindGroupEntry::new(binding~ : Int, resource~ : BindingResource) -> BindGroupEntry

    BindGroupId

    pub struct BindGroupId(UInt64) derive(Eq,
    Debug
    )

    The identity of a bind group.

    BindGroupId::from_raw

    fn BindGroupId::from_raw(raw : UInt64) -> BindGroupId

    An identity from the integer the backend allocated.

    BindGroupId::raw

    fn BindGroupId::raw(self : BindGroupId) -> UInt64

    BindGroupLayoutDescriptor

    pub(all) struct BindGroupLayoutDescriptor {
    label : String
    entries : Array[BindGroupLayoutEntry]
    } derive(
    Debug
    )

    A GPUBindGroupLayoutDescriptor.

    BindGroupLayoutDescriptor::new

    BindGroupLayoutEntry

    pub(all) struct BindGroupLayoutEntry {
    binding : Int
    visibility : ShaderStages
    kind : BindingLayout
    count : Int?
    } derive(
    Debug
    )

    A GPUBindGroupLayoutEntry.

    BindGroupLayoutEntry::new

    fn BindGroupLayoutEntry::new(binding~ : Int, visibility~ : ShaderStages, kind~ : BindingLayout, count? : Int) -> BindGroupLayoutEntry

    BindGroupLayoutId

    pub struct BindGroupLayoutId(UInt64) derive(Eq,
    Debug
    )

    The identity of a bind group layout.

    BindGroupLayoutId::from_raw

    fn BindGroupLayoutId::from_raw(raw : UInt64) -> BindGroupLayoutId

    An identity from the integer the backend allocated.

    BindGroupLayoutId::raw

    fn BindGroupLayoutId::raw(self : BindGroupLayoutId) -> UInt64

    BindingLayout

    pub(all) enum BindingLayout {
    Buffer(BufferBindingLayout)
    Sampler(SamplerBindingLayout)
    Texture(TextureBindingLayout)
    StorageTexture(StorageTextureBindingLayout)
    } derive(
    Debug
    )

    The kind of resource one binding of a bind group layout declares. Exactly one of the four shapes the specification defines.

    BindingResource

    pub(all) enum BindingResource {
    Buffer(BufferBinding)
    Sampler(SamplerId)
    TextureView(TextureViewId)
    } derive(
    Debug
    )

    What a GPUBindGroupEntry binds.

    BlendComponent

    pub(all) struct BlendComponent {
    src_factor : BlendFactor
    dst_factor : BlendFactor
    operation : BlendOperation
    } derive(
    Debug
    )

    One component of a blend equation: what multiplies the source, what multiplies the destination, and how the two are combined.

    BlendComponent::new

    fn BlendComponent::new(src_factor? : BlendFactor, dst_factor? : BlendFactor, operation? : BlendOperation) -> BlendComponent

    src * src_factor + dst * dst_factor.

    BlendFactor

    pub(all) enum BlendFactor {
    Zero
    One
    Src
    OneMinusSrc
    SrcAlpha
    OneMinusSrcAlpha
    Dst
    OneMinusDst
    DstAlpha
    OneMinusDstAlpha
    SrcAlphaSaturated
    Constant
    OneMinusConstant
    Src1
    OneMinusSrc1
    Src1Alpha
    OneMinusSrc1Alpha
    } derive(Eq,
    Debug
    )

    GPUBlendFactor.

    BlendOperation

    pub(all) enum BlendOperation {
    Add
    Subtract
    ReverseSubtract
    Min
    Max
    } derive(Eq,
    Debug
    )

    GPUBlendOperation.

    BlendState

    pub(all) struct BlendState {
    color : BlendComponent
    alpha : BlendComponent
    } derive(
    Debug
    )

    A GPUBlendState: one equation for colour, one for alpha.

    BlendState::new

    fn BlendState::new(color~ : BlendComponent, alpha~ : BlendComponent) -> BlendState

    BufferBinding

    pub(all) struct BufferBinding {
    buffer : BufferId
    offset : Int
    size : Int?
    } derive(
    Debug
    )

    A GPUBufferBinding: a buffer, where the binding starts, and how long it is. None means "to the end of the buffer".

    BufferBinding::new

    fn BufferBinding::new(buffer~ : BufferId, offset? : Int, size? : Int) -> BufferBinding

    BufferBindingLayout

    pub(all) struct BufferBindingLayout {
    kind : BufferBindingType
    has_dynamic_offset : Bool
    min_binding_size : Int?
    } derive(
    Debug
    )

    A GPUBufferBindingLayout.

    BufferBindingLayout::new

    fn BufferBindingLayout::new(kind~ : BufferBindingType, has_dynamic_offset? : Bool, min_binding_size? : Int) -> BufferBindingLayout

    BufferBindingType

    pub(all) enum BufferBindingType {
    Uniform
    Storage
    ReadOnlyStorage
    } derive(Eq,
    Debug
    )

    GPUBufferBindingType.

    BufferDescriptor

    pub(all) struct BufferDescriptor {
    label : String
    size : Int
    usage : BufferUsages
    mapped_at_creation : Bool
    } derive(
    Debug
    )

    A GPUBufferDescriptor.

    BufferDescriptor::new

    fn BufferDescriptor::new(size~ : Int, usage~ : BufferUsages, mapped_at_creation? : Bool, label? : String) -> BufferDescriptor

    A buffer of size bytes with the usages given; nothing mapped.

    BufferId

    pub struct BufferId(UInt64) derive(Eq,
    Debug
    )

    The identity of a buffer inside one adapter.

    BufferId::from_raw

    fn BufferId::from_raw(raw : UInt64) -> BufferId

    An identity from the integer the backend allocated.

    BufferId::raw

    fn BufferId::raw(self : BufferId) -> UInt64

    BufferUsages

    pub struct BufferUsages(UInt) derive(Eq,
    Debug
    )

    The set of GPUBufferUsage bits of one buffer.

    A flag set is not an enumeration: the specification lets any combination that is not empty, except that map_read and map_write exclude each other on the same buffer. The bits are private so that a caller cannot invent a value the specification does not define.
    impl Sub for BufferUsages

    BufferUsages::all

    Every bit the specification defines.

    BufferUsages::bits

    fn BufferUsages::bits(self : BufferUsages) -> UInt

    The raw bits, for serialisation and for comparisons the type system cannot express.

    BufferUsages::contains

    fn BufferUsages::contains(self : BufferUsages, other : BufferUsages) -> Bool

    Whether every bit of other is set here.

    BufferUsages::copy_dst

    fn BufferUsages::copy_dst() -> BufferUsages

    The buffer is a copy destination, including queue.write_buffer.

    BufferUsages::copy_src

    fn BufferUsages::copy_src() -> BufferUsages

    The buffer is a copy source.

    BufferUsages::from_bits

    fn BufferUsages::from_bits(bits : UInt) -> BufferUsages

    A usage set from its bits, for a host that speaks the specification's numbers rather than this library's constructors - a JavaScript binding, for one. Bits the specification does not define are kept as they arrived, so that the validator refuses them by name.

    BufferUsages::index

    fn BufferUsages::index() -> BufferUsages

    The buffer holds index data.

    BufferUsages::indirect

    fn BufferUsages::indirect() -> BufferUsages

    The buffer holds arguments of an indirect draw or dispatch.

    BufferUsages::intersects

    fn BufferUsages::intersects(self : BufferUsages, other : BufferUsages) -> Bool

    Whether at least one bit of other is set here.

    BufferUsages::is_empty

    fn BufferUsages::is_empty(self : BufferUsages) -> Bool

    BufferUsages::map_read

    fn BufferUsages::map_read() -> BufferUsages

    The buffer can be mapped for reading: map_read and get_mapped_range.

    BufferUsages::map_write

    fn BufferUsages::map_write() -> BufferUsages

    The buffer can be mapped for writing with map_write.

    BufferUsages::none

    BufferUsages::query_resolve

    fn BufferUsages::query_resolve() -> BufferUsages

    The buffer receives the results of resolve_query_set.

    BufferUsages::storage

    fn BufferUsages::storage() -> BufferUsages

    The buffer is bound as a storage buffer.

    BufferUsages::uniform

    fn BufferUsages::uniform() -> BufferUsages

    The buffer is bound as a uniform buffer.

    BufferUsages::vertex

    fn BufferUsages::vertex() -> BufferUsages

    The buffer holds vertex data.

    CanvasAlphaMode

    pub(all) enum CanvasAlphaMode {
    Opaque
    Premultiplied
    } derive(Eq,
    Debug
    )

    GPUCanvasAlphaMode: how the canvas's alpha is treated when the page composites it.

    CanvasToneMapping

    pub(all) struct CanvasToneMapping {
    mode : ToneMappingMode
    } derive(Eq,
    Debug
    )

    CanvasToneMapping.

    CanvasToneMapping::new

    ClearBuffer

    pub(all) struct ClearBuffer {
    buffer : BufferId
    offset : Int
    size : Int
    } derive(
    Debug
    )

    One clear_buffer.

    ClearTexture

    pub(all) struct ClearTexture {
    texture : TextureId
    mip_level : Int
    origin : Origin3d
    size : Extent3d
    aspect : TextureAspect
    } derive(
    Debug
    )

    One clear_texture.

    Color

    pub(all) struct Color {
    r : Double
    g : Double
    b : Double
    a : Double
    } derive(Eq,
    Debug
    )

    A colour, GPUColor.

    Color::black

    fn Color::black() -> Color

    Opaque black, the value a colour attachment clears to when the descriptor does not say.

    Color::new

    fn Color::new(r? : Double, g? : Double, b? : Double, a? : Double) -> Color

    ColorAttachment

    pub(all) struct ColorAttachment {
    view : TextureViewId
    resolve_target : TextureViewId?
    load_op : LoadOp
    clear_value : Color
    store : StoreOp
    } derive(
    Debug
    )

    One colour attachment of a render pass.

    ColorAttachment::new

    fn ColorAttachment::new(view~ : TextureViewId, resolve_target? : TextureViewId, load_op? : LoadOp, clear_value? : Color, store? : StoreOp) -> ColorAttachment

    ColorTargetState

    pub(all) struct ColorTargetState {
    format : TextureFormat
    blend : BlendState?
    write_mask : ColorWrites
    } derive(
    Debug
    )

    A GPUColorTargetState.

    ColorTargetState::new

    fn ColorTargetState::new(format~ : TextureFormat, blend? : BlendState, write_mask? : ColorWrites) -> ColorTargetState

    ColorWrites

    pub struct ColorWrites(UInt) derive(Eq,
    Debug
    )

    The set of GPUColorWrite bits a color target writes.

    ColorWrites::all

    Every channel: the value a target uses when it does not say otherwise.

    ColorWrites::alpha

    fn ColorWrites::alpha() -> ColorWrites

    ColorWrites::bits

    fn ColorWrites::bits(self : ColorWrites) -> UInt

    ColorWrites::blue

    fn ColorWrites::blue() -> ColorWrites

    ColorWrites::contains

    fn ColorWrites::contains(self : ColorWrites, other : ColorWrites) -> Bool

    ColorWrites::green

    fn ColorWrites::green() -> ColorWrites

    ColorWrites::is_empty

    fn ColorWrites::is_empty(self : ColorWrites) -> Bool

    ColorWrites::none

    fn ColorWrites::none() -> ColorWrites

    ColorWrites::red

    Command

    pub(all) enum Command {
    CopyBufferToBuffer(CopyBufferToBuffer)
    CopyBufferToTexture(CopyBufferToTexture)
    CopyTextureToBuffer(CopyTextureToBuffer)
    CopyTextureToTexture(CopyTextureToTexture)
    ClearBuffer(ClearBuffer)
    ClearTexture(ClearTexture)
    ResolveQuerySet(ResolveQuerySet)
    RenderPass(RenderPassCommand)
    ComputePass(ComputePassCommand)
    } derive(
    Debug
    )

    A recorded command. A command buffer is a list of these; the backend executes them in order.

    CommandBuffer

    pub(all) struct CommandBuffer {
    label : String
    commands : Array[Command]
    } derive(
    Debug
    )

    A recorded, finished command buffer.

    CompareFunction

    pub(all) enum CompareFunction {
    Never
    Less
    Equal
    LessEqual
    Greater
    NotEqual
    GreaterEqual
    Always
    } derive(Eq,
    Debug
    )

    GPUCompareFunction.

    CompilationInfo

    pub(all) struct CompilationInfo {
    messages : Array[CompilationMessage]
    } derive(
    Debug
    )

    GPUCompilationInfo: everything the compiler said about one module, in the order it said it.

    CompilationInfo::has_errors

    fn CompilationInfo::has_errors(self : CompilationInfo) -> Bool

    Whether any message is an error, in which case the module cannot be used.

    CompilationInfo::new

    CompilationMessage

    pub(all) struct CompilationMessage {
    message : String
    kind : CompilationMessageType
    line_num : Int
    line_pos : Int
    offset : Int
    length : Int
    } derive(Eq,
    Debug
    )

    One GPUCompilationMessage: what a shader compiler said about one place in a module.

    line_num and line_pos are one-based, as in the specification; an offset without a line has line_num zero.

    CompilationMessage::is_error

    fn CompilationMessage::is_error(self : CompilationMessage) -> Bool

    Whether this message stops the module from being built.

    CompilationMessage::new

    fn CompilationMessage::new(message~ : String, kind~ : CompilationMessageType, line_num? : Int, line_pos? : Int, offset? : Int, length? : Int) -> CompilationMessage

    CompilationMessageType

    pub(all) enum CompilationMessageType {
    Error
    Warning
    Info
    } derive(Eq,
    Debug
    )

    GPUCompilationMessageType.

    ComputeCommand

    pub(all) enum ComputeCommand {
    SetPipeline(ComputePipelineId)
    SetBindGroup(SetBindGroup)
    SetImmediates(SetImmediates)
    DispatchWorkgroups(DispatchArguments)
    DispatchWorkgroupsIndirect(DispatchIndirect)
    WriteTimestamp(WriteTimestamp)
    InsertDebugMarker(String)
    PushDebugGroup(String)
    PopDebugGroup
    } derive(
    Debug
    )

    One command inside a compute pass.

    ComputePassCommand

    pub(all) struct ComputePassCommand {
    label : String
    timestamp_writes : PassTimestampWrites?
    commands : Array[ComputeCommand]
    } derive(
    Debug
    )

    A compute pass that has been recorded and ended.

    ComputePassDescriptor

    pub(all) struct ComputePassDescriptor {
    label : String
    timestamp_writes : PassTimestampWrites?
    } derive(
    Debug
    )

    A GPUComputePassDescriptor.

    ComputePassDescriptor::new

    fn ComputePassDescriptor::new(label? : String, timestamp_writes? : PassTimestampWrites) -> ComputePassDescriptor

    ComputePipelineDescriptor

    pub(all) struct ComputePipelineDescriptor {
    label : String
    layout : PipelineLayoutId?
    shader : ShaderModuleId
    entry_point : String
    constants : Array[(String, Double)]
    } derive(
    Debug
    )

    A GPUComputePipelineDescriptor.

    ComputePipelineDescriptor::new

    fn ComputePipelineDescriptor::new(shader~ : ShaderModuleId, entry_point~ : String, layout? : PipelineLayoutId, constants? : Array[(String, Double)], label? : String) -> ComputePipelineDescriptor

    ComputePipelineId

    pub struct ComputePipelineId(UInt64) derive(Eq,
    Debug
    )

    The identity of a compute pipeline.

    ComputePipelineId::from_raw

    fn ComputePipelineId::from_raw(raw : UInt64) -> ComputePipelineId

    An identity from the integer the backend allocated.

    ComputePipelineId::raw

    fn ComputePipelineId::raw(self : ComputePipelineId) -> UInt64

    CopyBufferToBuffer

    pub(all) struct CopyBufferToBuffer {
    source : BufferId
    source_offset : Int
    destination : BufferId
    destination_offset : Int
    size : Int
    } derive(
    Debug
    )

    One copy_buffer_to_buffer.

    CopyBufferToTexture

    pub(all) struct CopyBufferToTexture {
    source : TexelCopyBufferInfo
    destination : TexelCopyTextureInfo
    copy_size : Extent3d
    } derive(
    Debug
    )

    One copy_buffer_to_texture.

    CopyExternalImageDestInfo

    pub(all) struct CopyExternalImageDestInfo {
    texture : TextureId
    mip_level : Int
    origin : Origin3d
    aspect : TextureAspect
    premultiplied_alpha : Bool
    color_space : PredefinedColorSpace
    } derive(
    Debug
    )

    GPUCopyExternalImageDestInfo: where the pixels land, whether their alpha is premultiplied on the way, and in which colour space.

    CopyExternalImageDestInfo::new

    fn CopyExternalImageDestInfo::new(texture~ : TextureId, mip_level? : Int, origin? : Origin3d, aspect? : TextureAspect, premultiplied_alpha? : Bool, color_space? : PredefinedColorSpace) -> CopyExternalImageDestInfo

    CopyExternalImageSourceInfo

    pub(all) struct CopyExternalImageSourceInfo {
    image : ExternalImage
    origin : Origin3d
    flip_y : Bool
    } derive(
    Debug
    )

    GPUCopyExternalImageSourceInfo: the pixels to copy and where in them to start, with flip_y for a frame whose rows are bottom-first.

    CopyExternalImageSourceInfo::new

    fn CopyExternalImageSourceInfo::new(image~ : ExternalImage, origin? : Origin3d, flip_y? : Bool) -> CopyExternalImageSourceInfo

    CopyTextureToBuffer

    pub(all) struct CopyTextureToBuffer {
    source : TexelCopyTextureInfo
    destination : TexelCopyBufferInfo
    copy_size : Extent3d
    } derive(
    Debug
    )

    One copy_texture_to_buffer.

    CopyTextureToTexture

    pub(all) struct CopyTextureToTexture {
    source : TexelCopyTextureInfo
    destination : TexelCopyTextureInfo
    copy_size : Extent3d
    } derive(
    Debug
    )

    One copy_texture_to_texture.

    CullMode

    pub(all) enum CullMode {
    None
    Front
    Back
    } derive(Eq,
    Debug
    )

    GPUCullMode.

    DepthBiasState

    pub(all) struct DepthBiasState {
    constant : Int
    slope_scale : Double
    clamp : Double
    } derive(
    Debug
    )

    A GPUDepthBiasState.

    DepthBiasState::new

    fn DepthBiasState::new(constant? : Int, slope_scale? : Double, clamp? : Double) -> DepthBiasState

    DepthStencilAttachment

    pub(all) struct DepthStencilAttachment {
    view : TextureViewId
    depth_load_op : LoadOp
    depth_clear_value : Double
    depth_store : StoreOp
    depth_read_only : Bool
    stencil_load_op : LoadOp
    stencil_clear_value : Int
    stencil_store : StoreOp
    stencil_read_only : Bool
    } derive(
    Debug
    )

    The depth-stencil attachment of a render pass. A read-only attachment may not be written: it has no store operation and its load operation must preserve the contents.

    DepthStencilAttachment::new

    fn DepthStencilAttachment::new(view~ : TextureViewId, depth_load_op? : LoadOp, depth_clear_value? : Double, depth_store? : StoreOp, depth_read_only? : Bool, stencil_load_op? : LoadOp, stencil_clear_value? : Int, stencil_store? : StoreOp, stencil_read_only? : Bool) -> DepthStencilAttachment

    DepthStencilState

    pub(all) struct DepthStencilState {
    format : TextureFormat
    depth_write_enabled : Bool
    depth_compare : CompareFunction
    stencil : StencilState
    bias : DepthBiasState
    } derive(
    Debug
    )

    A GPUDepthStencilState.

    DepthStencilState::new

    fn DepthStencilState::new(format~ : TextureFormat, depth_write_enabled? : Bool, depth_compare? : CompareFunction, stencil? : StencilState, bias? : DepthBiasState) -> DepthStencilState

    DeviceLostInfo

    pub(all) struct DeviceLostInfo {
    reason : DeviceLostReason
    message : String
    } derive(Eq,
    Debug
    )

    GPUDeviceLostInfo: why a device is gone, and what it said about it.

    DeviceLostInfo::new

    fn DeviceLostInfo::new(reason? : DeviceLostReason, message? : String) -> DeviceLostInfo

    DeviceLostReason

    pub(all) enum DeviceLostReason {
    Unknown
    Destroyed
    } derive(Eq,
    Debug
    )

    GPUDeviceLostReason.

    DispatchArguments

    pub(all) struct DispatchArguments {
    x : Int
    y : Int
    z : Int
    } derive(Eq,
    Debug
    )

    The arguments of dispatch_workgroups.

    DispatchArguments::new

    fn DispatchArguments::new(x~ : Int, y? : Int, z? : Int) -> DispatchArguments

    DispatchIndirect

    pub(all) struct DispatchIndirect {
    buffer : BufferId
    offset : Int
    } derive(
    Debug
    )

    dispatchWorkgroupsIndirect: the arguments come from a buffer.

    DrawArguments

    pub(all) struct DrawArguments {
    vertex_count : Int
    instance_count : Int
    first_vertex : Int
    first_instance : Int
    } derive(Eq,
    Debug
    )

    The arguments of draw.

    DrawArguments::new

    fn DrawArguments::new(vertex_count~ : Int, instance_count? : Int, first_vertex? : Int, first_instance? : Int) -> DrawArguments

    DrawIndexedArguments

    pub(all) struct DrawIndexedArguments {
    index_count : Int
    instance_count : Int
    first_index : Int
    base_vertex : Int
    first_instance : Int
    } derive(Eq,
    Debug
    )

    The arguments of draw_indexed.

    DrawIndexedArguments::new

    fn DrawIndexedArguments::new(index_count~ : Int, instance_count? : Int, first_index? : Int, base_vertex? : Int, first_instance? : Int) -> DrawIndexedArguments

    DrawIndexedIndirect

    pub(all) struct DrawIndexedIndirect {
    buffer : BufferId
    offset : Int
    } derive(
    Debug
    )

    drawIndexedIndirect: the arguments come from a buffer.

    DrawIndirect

    pub(all) struct DrawIndirect {
    buffer : BufferId
    offset : Int
    } derive(
    Debug
    )

    drawIndirect: the arguments come from a buffer.

    ErrorFilter

    pub(all) enum ErrorFilter {
    Validation
    OutOfMemory
    Internal
    } derive(Eq,
    Debug
    )

    GPUErrorFilter, the kinds of error a scope can collect.

    ErrorKind

    pub(all) enum ErrorKind {
    InvalidBufferSize
    InvalidBufferUsage
    InvalidBufferState
    InvalidTextureDescriptor
    InvalidTextureDimension
    InvalidTextureFormat
    InvalidTextureUsage
    InvalidTextureSampleCount
    InvalidTextureViewDescriptor
    InvalidSamplerDescriptor
    InvalidBindGroupLayout
    InvalidBindGroup
    InvalidPipelineLayout
    InvalidShaderModule
    InvalidRenderPipeline
    InvalidComputePipeline
    InvalidVertexState
    InvalidFragmentState
    InvalidPrimitiveState
    InvalidDepthStencilState
    InvalidMultisampleState
    InvalidCopyRange
    InvalidCopySize
    InvalidAlignment
    InvalidBytesPerRow
    InvalidSubresource
    InvalidPassDescriptor
    InvalidPassState
    InvalidDraw
    InvalidDispatch
    PassNotEnded
    EncoderFinished
    InvalidResource
    InvalidCanvasConfiguration
    MissingFeature
    LimitExceeded
    DeviceLost
    OutOfMemory
    Internal
    } derive(Eq,
    Debug
    )

    Every error the specification names. The specification raises these on the device timeline and reports them through an error scope; a library that runs the device timeline in the caller's thread raises them instead, and keeps this enumeration so that a caller can branch on the same classes the specification defines.

    ErrorKind::name

    fn ErrorKind::name(self : ErrorKind) -> String

    Extent3d

    pub(all) struct Extent3d {
    width : Int
    height : Int
    depth_or_array_layers : Int
    } derive(Eq,
    Debug
    )

    A size in texels: GPUExtent3D.

    Extent3d::is_empty

    fn Extent3d::is_empty(self : Extent3d) -> Bool

    Whether any dimension is zero. A zero-sized texture or copy is valid and does nothing.

    Extent3d::max_mip_level_count

    fn Extent3d::max_mip_level_count(self : Extent3d) -> Int

    The number of mip levels a texture of this size can have: one more than the base-2 logarithm of its largest dimension.

    Extent3d::new

    fn Extent3d::new(width~ : Int, height? : Int, depth_or_array_layers? : Int) -> Extent3d

    Extent3d::physical_size

    fn Extent3d::physical_size(self : Extent3d, mip_level~ : Int, format~ : TextureFormat) -> Extent3d

    The size of one mip level in texels, rounded up to whole texel blocks of format. This is the "physical size" the specification's copy validation works in.

    ExternalImage

    pub(all) struct ExternalImage {
    label : String
    size : Extent3d
    format : TextureFormat
    data : Bytes
    } derive(
    Debug
    )

    The pixels a host hands over for an external image.

    The specification's source is an HTMLVideoElement or a VideoFrame; a native host has neither, so it hands over the frame it decoded instead: the size of the frame, the format its pixels are in, and the bytes themselves, packed row by row with no padding.

    ExternalImage::new

    fn ExternalImage::new(size~ : Extent3d, format~ : TextureFormat, data~ : Bytes, label? : String) -> ExternalImage

    ExternalImage::row_bytes

    fn ExternalImage::row_bytes(self : ExternalImage) -> Int

    The bytes one row of this image occupies, with no padding.

    ExternalTextureDescriptor

    pub(all) struct ExternalTextureDescriptor {
    label : String
    image : ExternalImage
    color_space : PredefinedColorSpace
    } derive(
    Debug
    )

    A GPUExternalTextureDescriptor.

    ExternalTextureDescriptor::new

    fn ExternalTextureDescriptor::new(image~ : ExternalImage, color_space? : PredefinedColorSpace, label? : String) -> ExternalTextureDescriptor

    ExternalTextureId

    pub struct ExternalTextureId(UInt64) derive(Eq,
    Debug
    )

    The identity of an external texture.

    ExternalTextureId::from_raw

    fn ExternalTextureId::from_raw(raw : UInt64) -> ExternalTextureId

    An identity from the integer the backend allocated.

    ExternalTextureId::raw

    fn ExternalTextureId::raw(self : ExternalTextureId) -> UInt64

    FeatureName

    pub(all) enum FeatureName {
    CoreFeaturesAndLimits
    DepthClipControl
    Depth32floatStencil8
    TextureCompressionBc
    TextureCompressionBcSliced3d
    TextureCompressionEtc2
    TextureCompressionAstc
    TextureCompressionAstcSliced3d
    TimestampQuery
    IndirectFirstInstance
    ShaderF16
    Rg11b10ufloatRenderable
    Bgra8unormStorage
    Float32Filterable
    Float32Blendable
    ClipDistances
    DualSourceBlending
    Subgroups
    TextureFormatsTier1
    TextureFormatsTier2
    PrimitiveIndex
    TextureComponentSwizzle
    SubgroupSizeControl
    TextureCompressionUnaligned
    AtomicVec2uMinMax
    } derive(Eq,
    Debug
    )

    A GPUFeatureName: an optional capability a device must be asked for explicitly.

    The list is the one the specification prints, in the same order. https://www.w3.org/TR/webgpu/#enumdef-gpufeaturename

    FeatureName::all

    Every feature, in specification order.

    FeatureName::dependencies

    fn FeatureName::dependencies(self : FeatureName) -> Array[FeatureName]

    The features that must be enabled together with this one. The specification's "Feature Dependencies" table lists them; core-features-and-limits is implied by every feature that is defined on top of it.

    FeatureName::name

    fn FeatureName::name(self : FeatureName) -> String

    The name the specification uses, as in "shader-f16".

    Features

    pub struct Features(UInt) derive(Eq,
    Debug
    )

    A set of GPUFeatureNames.
    impl BitAnd for Features
    impl BitOr for Features

    Features::all

    fn Features::all() -> Features

    Every feature the specification defines.

    Features::bits

    fn Features::bits(self : Features) -> UInt

    The raw bits.

    Features::contains

    fn Features::contains(self : Features, feature : FeatureName) -> Bool

    Features::contains_all

    fn Features::contains_all(self : Features, other : Features) -> Bool

    Whether everything in other is also here.

    Features::is_empty

    fn Features::is_empty(self : Features) -> Bool

    Features::names

    fn Features::names(self : Features) -> Array[FeatureName]

    The features in this set, in specification order.

    Features::none

    fn Features::none() -> Features

    No optional feature at all: the device still offers the core of the specification.

    Features::of

    fn Features::of(feature : FeatureName) -> Features

    A set holding exactly feature.

    FilterMode

    pub(all) enum FilterMode {
    Nearest
    Linear
    } derive(Eq,
    Debug
    )

    GPUFilterMode, used both for magnification and for minification.

    FormatAspect

    pub(all) enum FormatAspect {
    Color
    DepthOnly
    StencilOnly
    DepthStencil
    } derive(Eq,
    Debug
    )

    The aspects a format has. A depth-stencil format is one texture with two aspects; a view selects one of them.

    FormatInfo

    pub(all) struct FormatInfo {
    block_width : Int
    block_height : Int
    bytes_per_block : Int
    bytes_per_sample : Int
    sample_type : SampleType
    aspect : FormatAspect
    render_attachment : Bool
    blendable : Bool
    multisample : Bool
    resolve : Bool
    storage : StorageAccess
    copy_src : Bool
    copy_dst : Bool
    feature : FeatureName?
    } derive(
    Debug
    )

    Everything the specification says about one GPUTextureFormat.

    The values come from the tables "Texture format capabilities" and "Depth and stencil format capabilities" of the specification; the features named here are the ones that must be enabled before a texture of the format can be created at all. The storage column records what the format offers under core-features-and-limits; the tiered storage extensions are not modelled yet.

    FragmentState

    pub(all) struct FragmentState {
    shader : ShaderModuleId
    entry_point : String
    targets : Array[ColorTargetState]
    } derive(
    Debug
    )

    The fragment stage of a pipeline.

    FragmentState::new

    fn FragmentState::new(shader~ : ShaderModuleId, entry_point~ : String, targets~ : Array[ColorTargetState]) -> FragmentState

    FrontFace

    pub(all) enum FrontFace {
    Ccw
    Cw
    } derive(Eq,
    Debug
    )

    GPUFrontFace.

    IndexFormat

    pub(all) enum IndexFormat {
    Uint16
    Uint32
    } derive(Eq,
    Debug
    )

    GPUIndexFormat.

    IndexFormat::size

    fn IndexFormat::size(self : IndexFormat) -> Int

    The bytes one index occupies.

    Limits

    pub(all) struct Limits {
    max_texture_dimension_1d : Int
    max_texture_dimension_2d : Int
    max_texture_dimension_3d : Int
    max_texture_array_layers : Int
    max_bind_groups : Int
    max_bind_groups_plus_vertex_buffers : Int
    max_immediate_size : Int
    max_bindings_per_bind_group : Int
    max_dynamic_uniform_buffers_per_pipeline_layout : Int
    max_dynamic_storage_buffers_per_pipeline_layout : Int
    max_sampled_textures_per_shader_stage : Int
    max_samplers_per_shader_stage : Int
    max_storage_buffers_per_shader_stage : Int
    max_storage_buffers_in_vertex_stage : Int
    max_storage_buffers_in_fragment_stage : Int
    max_storage_textures_per_shader_stage : Int
    max_storage_textures_in_vertex_stage : Int
    max_storage_textures_in_fragment_stage : Int
    max_uniform_buffers_per_shader_stage : Int
    max_uniform_buffer_binding_size : Int
    max_storage_buffer_binding_size : Int
    min_uniform_buffer_offset_alignment : Int
    min_storage_buffer_offset_alignment : Int
    max_vertex_buffers : Int
    max_buffer_size : Int
    max_vertex_attributes : Int
    max_vertex_buffer_array_stride : Int
    max_inter_stage_shader_variables : Int
    max_color_attachments : Int
    max_color_attachment_bytes_per_sample : Int
    max_compute_workgroup_storage_size : Int
    max_compute_invocations_per_workgroup : Int
    max_compute_workgroup_size_x : Int
    max_compute_workgroup_size_y : Int
    max_compute_workgroup_size_z : Int
    max_compute_workgroups_per_dimension : Int
    } derive(Eq,
    Debug
    )

    The GPUSupportedLimits of an adapter, and the set a device is created with.

    The defaults are the "Default" column of the specification's limits table; compatibility() is the "Compatibility Mode Default" column, which lowers the limits a compatibility-mode adapter has to reach. https://www.w3.org/TR/webgpu/#limits

    Sizes are Int, which is 64 bits on the native targets and 32 bits on the wasm targets. A size above 2 GiB therefore cannot be expressed on wasm; the specification's own default is 256 MiB.

    Limits::compatibility

    fn Limits::compatibility() -> Limits

    The limits a compatibility-mode adapter has to reach.

    Limits::entries

    fn Limits::entries(self : Limits) -> Array[(String, Int)]

    The names and values of every limit, in specification order. Used by check and by the diagnostics a failed request_device prints.

    Limits::exceeds

    fn Limits::exceeds(self : Limits, requested : Limits) -> (String, Int, Int)?

    The first limit of requested that is above supported, as its name and the two values; None when the request fits.

    Limits::webgpu

    fn Limits::webgpu() -> Limits

    The limits every WebGPU implementation must offer.

    LoadOp

    pub(all) enum LoadOp {
    Load
    Clear
    } derive(Eq,
    Debug
    )

    GPULoadOp: whether an attachment keeps what it held or is cleared first. The value it is cleared to is a separate field of the attachment, as in the specification.

    MapMode

    pub struct MapMode(UInt) derive(Eq,
    Debug
    )

    The two GPUMapMode bits.
    impl BitAnd for MapMode
    impl BitOr for MapMode

    MapMode::bits

    fn MapMode::bits(self : MapMode) -> UInt

    MapMode::contains

    fn MapMode::contains(self : MapMode, other : MapMode) -> Bool

    MapMode::from_bits

    fn MapMode::from_bits(bits : UInt) -> MapMode

    A mapping mode from the specification's bits: 0x0001 read, 0x0002 write.

    MapMode::is_empty

    fn MapMode::is_empty(self : MapMode) -> Bool

    MapMode::none

    fn MapMode::none() -> MapMode

    MapMode::read

    fn MapMode::read() -> MapMode

    The mapped range may be read: map_read.

    MapMode::write

    fn MapMode::write() -> MapMode

    The mapped range may be written: map_write.

    MapState

    pub(all) enum MapState {
    Unmapped
    Pending
    Mapped
    } derive(Eq,
    Debug
    )

    GPUBufferMapState: whether a buffer is mapped, waiting to be, or not mapped at all.

    MultisampleState

    pub(all) struct MultisampleState {
    count : Int
    mask : UInt
    alpha_to_coverage_enabled : Bool
    } derive(
    Debug
    )

    A GPUMultisampleState.

    MultisampleState::new

    fn MultisampleState::new(count? : Int, mask? : UInt, alpha_to_coverage_enabled? : Bool) -> MultisampleState

    Origin3d

    pub(all) struct Origin3d {
    x : Int
    y : Int
    z : Int
    } derive(Eq,
    Debug
    )

    A texel position inside a texture: GPUOrigin3D.

    Origin3d::new

    fn Origin3d::new(x? : Int, y? : Int, z? : Int) -> Origin3d

    PassTimestampWrites

    pub(all) struct PassTimestampWrites {
    query_set : QuerySetId
    beginning_of_pass_write_index : Int?
    end_of_pass_write_index : Int?
    } derive(
    Debug
    )

    Which timestamps a pass writes: GPURenderPassTimestampWrites.

    PassTimestampWrites::new

    fn PassTimestampWrites::new(query_set~ : QuerySetId, beginning_of_pass_write_index? : Int, end_of_pass_write_index? : Int) -> PassTimestampWrites

    PipelineErrorReason

    pub(all) enum PipelineErrorReason {
    Validation
    Internal
    } derive(Eq,
    Debug
    )

    GPUPipelineErrorReason.

    PipelineLayoutDescriptor

    pub(all) struct PipelineLayoutDescriptor {
    label : String
    bind_group_layouts : Array[BindGroupLayoutId]
    } derive(
    Debug
    )

    A GPUPipelineLayoutDescriptor. An empty list of bind group layouts is the explicit form of the "auto" layout.

    PipelineLayoutDescriptor::new

    fn PipelineLayoutDescriptor::new(bind_group_layouts~ : Array[BindGroupLayoutId], label? : String) -> PipelineLayoutDescriptor

    PipelineLayoutId

    pub struct PipelineLayoutId(UInt64) derive(Eq,
    Debug
    )

    The identity of a pipeline layout.

    PipelineLayoutId::from_raw

    fn PipelineLayoutId::from_raw(raw : UInt64) -> PipelineLayoutId

    An identity from the integer the backend allocated.

    PipelineLayoutId::raw

    fn PipelineLayoutId::raw(self : PipelineLayoutId) -> UInt64

    PowerPreference

    pub(all) enum PowerPreference {
    None
    LowPower
    HighPerformance
    } derive(Eq,
    Debug
    )

    GPUPowerPreference.

    PredefinedColorSpace

    pub(all) enum PredefinedColorSpace {
    Srgb
    DisplayP3
    } derive(Eq,
    Debug
    )

    PredefinedColorSpace: the colour space an external image is converted to before it is sampled.

    PredefinedColorSpace::name

    fn PredefinedColorSpace::name(self : PredefinedColorSpace) -> String

    The name the specification prints for a colour space, as in "srgb".

    PrimitiveState

    pub(all) struct PrimitiveState {
    topology : PrimitiveTopology
    strip_index_format : IndexFormat?
    front_face : FrontFace
    cull_mode : CullMode
    unclipped_depth : Bool
    } derive(
    Debug
    )

    A GPUPrimitiveState.

    PrimitiveState::new

    fn PrimitiveState::new(topology? : PrimitiveTopology, strip_index_format? : IndexFormat, front_face? : FrontFace, cull_mode? : CullMode, unclipped_depth? : Bool) -> PrimitiveState

    PrimitiveTopology

    pub(all) enum PrimitiveTopology {
    PointList
    LineList
    LineStrip
    TriangleList
    TriangleStrip
    } derive(Eq,
    Debug
    )

    GPUPrimitiveTopology.

    QuerySetDescriptor

    pub(all) struct QuerySetDescriptor {
    label : String
    kind : QueryType
    count : Int
    } derive(
    Debug
    )

    A GPUQuerySetDescriptor.

    QuerySetDescriptor::new

    fn QuerySetDescriptor::new(kind~ : QueryType, count~ : Int, label? : String) -> QuerySetDescriptor

    QuerySetId

    pub struct QuerySetId(UInt64) derive(Eq,
    Debug
    )

    The identity of a query set.

    QuerySetId::from_raw

    fn QuerySetId::from_raw(raw : UInt64) -> QuerySetId

    An identity from the integer the backend allocated.

    QuerySetId::raw

    fn QuerySetId::raw(self : QuerySetId) -> UInt64

    QueryType

    pub(all) enum QueryType {
    Occlusion
    Timestamp
    } derive(Eq,
    Debug
    )

    GPUQueryType.

    RenderBundle

    pub(all) struct RenderBundle {
    label : String
    commands : Array[RenderCommand]
    } derive(
    Debug
    )

    A recorded render bundle: a run of draw commands that can be executed in any number of passes. https://www.w3.org/TR/webgpu/#render-bundles

    RenderCommand

    pub(all) enum RenderCommand {
    SetPipeline(RenderPipelineId)
    SetBindGroup(SetBindGroup)
    SetImmediates(SetImmediates)
    SetVertexBuffer(SetVertexBuffer)
    SetIndexBuffer(SetIndexBuffer)
    Draw(DrawArguments)
    DrawIndexed(DrawIndexedArguments)
    DrawIndirect(DrawIndirect)
    DrawIndexedIndirect(DrawIndexedIndirect)
    SetViewport(SetViewport)
    SetScissorRect(SetScissorRect)
    SetBlendConstant(Color)
    SetStencilReference(Int)
    BeginOcclusionQuery(Int)
    EndOcclusionQuery
    WriteTimestamp(WriteTimestamp)
    ExecuteBundles(Array[RenderBundle])
    InsertDebugMarker(String)
    PushDebugGroup(String)
    PopDebugGroup
    } derive(
    Debug
    )

    One command inside a render pass.

    RenderPassCommand

    pub(all) struct RenderPassCommand {
    label : String
    color_attachments : Array[ColorAttachment]
    depth_stencil_attachment : DepthStencilAttachment?
    timestamp_writes : PassTimestampWrites?
    occlusion_query_set : QuerySetId?
    commands : Array[RenderCommand]
    } derive(
    Debug
    )

    A render pass that has been recorded and ended.

    RenderPassDescriptor

    pub(all) struct RenderPassDescriptor {
    label : String
    color_attachments : Array[ColorAttachment]
    depth_stencil_attachment : DepthStencilAttachment?
    timestamp_writes : PassTimestampWrites?
    occlusion_query_set : QuerySetId?
    } derive(
    Debug
    )

    A GPURenderPassDescriptor.

    RenderPassDescriptor::new

    fn RenderPassDescriptor::new(color_attachments? : Array[ColorAttachment], depth_stencil_attachment? : DepthStencilAttachment, timestamp_writes? : PassTimestampWrites, occlusion_query_set? : QuerySetId, label? : String) -> RenderPassDescriptor

    RenderPipelineDescriptor

    pub(all) struct RenderPipelineDescriptor {
    label : String
    layout : PipelineLayoutId?
    vertex : VertexState
    primitive : PrimitiveState
    depth_stencil : DepthStencilState?
    multisample : MultisampleState
    fragment : FragmentState?
    } derive(
    Debug
    )

    A GPURenderPipelineDescriptor.

    RenderPipelineDescriptor::new

    fn RenderPipelineDescriptor::new(vertex~ : VertexState, layout? : PipelineLayoutId, primitive? : PrimitiveState, depth_stencil? : DepthStencilState, multisample? : MultisampleState, fragment? : FragmentState, label? : String) -> RenderPipelineDescriptor

    RenderPipelineId

    pub struct RenderPipelineId(UInt64) derive(Eq,
    Debug
    )

    The identity of a render pipeline.

    RenderPipelineId::from_raw

    fn RenderPipelineId::from_raw(raw : UInt64) -> RenderPipelineId

    An identity from the integer the backend allocated.

    RenderPipelineId::raw

    fn RenderPipelineId::raw(self : RenderPipelineId) -> UInt64

    ResolveQuerySet

    pub(all) struct ResolveQuerySet {
    query_set : QuerySetId
    first_query : Int
    query_count : Int
    destination : BufferId
    destination_offset : Int
    } derive(
    Debug
    )

    resolveQuerySet: the results of a query set into a buffer.

    SampleType

    pub(all) enum SampleType {
    Float
    UnfilterableFloat
    Uint
    Sint
    Depth
    } derive(Eq,
    Debug
    )

    What a shader may sample a texture of this format as, GPUTextureSampleType.

    SamplerBindingLayout

    pub(all) struct SamplerBindingLayout {
    kind : SamplerBindingType
    } derive(
    Debug
    )

    A GPUSamplerBindingLayout.

    SamplerBindingLayout::new

    SamplerBindingType

    pub(all) enum SamplerBindingType {
    Filtering
    NonFiltering
    Comparison
    } derive(Eq,
    Debug
    )

    GPUCompareFunction for a shadow sampler.

    SamplerDescriptor

    pub(all) struct SamplerDescriptor {
    label : String
    address_mode_u : AddressMode
    address_mode_v : AddressMode
    address_mode_w : AddressMode
    mag_filter : FilterMode
    min_filter : FilterMode
    mipmap_filter : FilterMode
    lod_min_clamp : Double
    lod_max_clamp : Double
    compare : CompareFunction?
    max_anisotropy : Int
    } derive(
    Debug
    )

    A GPUSamplerDescriptor.

    SamplerDescriptor::new

    fn SamplerDescriptor::new(label? : String, address_mode_u? : AddressMode, address_mode_v? : AddressMode, address_mode_w? : AddressMode, mag_filter? : FilterMode, min_filter? : FilterMode, mipmap_filter? : FilterMode, lod_min_clamp? : Double, lod_max_clamp? : Double, compare? : CompareFunction, max_anisotropy? : Int) -> SamplerDescriptor

    The sampler the specification describes when a descriptor says nothing: clamp to edge, linear magnification, nearest minification, one mip level.

    SamplerId

    pub struct SamplerId(UInt64) derive(Eq,
    Debug
    )

    The identity of a sampler.

    SamplerId::from_raw

    fn SamplerId::from_raw(raw : UInt64) -> SamplerId

    An identity from the integer the backend allocated.

    SamplerId::raw

    fn SamplerId::raw(self : SamplerId) -> UInt64

    SetBindGroup

    pub(all) struct SetBindGroup {
    index : Int
    group : BindGroupId
    dynamic_offsets : Array[Int]
    } derive(
    Debug
    )

    One set_bind_group, with the offsets of its dynamic bindings.

    SetImmediates

    pub(all) struct SetImmediates {
    range_offset : Int
    data : Bytes
    } derive(
    Debug
    )

    One set_immediates: bytes loaded into the immediate constants of one bind group slot, for the draw or dispatch that follows.

    The bytes are already the run the caller named: data_offset and data_size, when given, have been applied.

    SetImmediates::new

    fn SetImmediates::new(range_offset~ : Int, data~ : Bytes) -> SetImmediates

    SetIndexBuffer

    pub(all) struct SetIndexBuffer {
    buffer : BufferId
    format : IndexFormat
    offset : Int
    size : Int?
    } derive(
    Debug
    )

    One set_index_buffer.

    SetScissorRect

    pub(all) struct SetScissorRect {
    x : Int
    y : Int
    width : Int
    height : Int
    } derive(
    Debug
    )

    A scissor rectangle: set_scissor_rect.

    SetVertexBuffer

    pub(all) struct SetVertexBuffer {
    slot : Int
    buffer : BufferId
    offset : Int
    size : Int?
    } derive(
    Debug
    )

    One set_vertex_buffer.

    SetViewport

    pub(all) struct SetViewport {
    x : Double
    y : Double
    width : Double
    height : Double
    min_depth : Double
    max_depth : Double
    } derive(
    Debug
    )

    A viewport: set_viewport.

    ShaderModuleDescriptor

    pub(all) struct ShaderModuleDescriptor {
    label : String
    code : ShaderSource
    } derive(
    Debug
    )

    A GPUShaderModuleDescriptor.

    ShaderModuleDescriptor::kind

    Which form the module is in.

    ShaderModuleDescriptor::spirv

    fn ShaderModuleDescriptor::spirv(words~ : Bytes, label? : String) -> ShaderModuleDescriptor

    A shader module whose WGSL has already been compiled to SPIR-V, little endian words as a driver takes them.

    ShaderModuleDescriptor::wgsl

    fn ShaderModuleDescriptor::wgsl(source~ : String, label? : String) -> ShaderModuleDescriptor

    A shader module written in WGSL.

    ShaderModuleId

    pub struct ShaderModuleId(UInt64) derive(Eq,
    Debug
    )

    The identity of a shader module.

    ShaderModuleId::from_raw

    fn ShaderModuleId::from_raw(raw : UInt64) -> ShaderModuleId

    An identity from the integer the backend allocated.

    ShaderModuleId::raw

    fn ShaderModuleId::raw(self : ShaderModuleId) -> UInt64

    ShaderSource

    pub(all) enum ShaderSource {
    Wgsl(String)
    SpirV(Bytes)
    } derive(
    Debug
    )

    What a module is made of: WGSL text, or the SPIR-V words a front end has already produced.

    The specification defines only code in WGSL. SPIR-V exists here because a native backend takes it directly, and a caller that compiled its shaders ahead of time should not have to feed them through a compiler it does not have. moonnaga is the front end that produces the second form; this library never parses either.

    ShaderSource::is_empty

    fn ShaderSource::is_empty(self : ShaderSource) -> Bool

    Whether this carries nothing at all. An empty module is refused before it reaches a backend, and the two forms are empty for different reasons.

    ShaderSource::kind

    Which of the two forms this is, as a GPUCompilationMessage reader or a backend would ask.

    ShaderSource::text

    fn ShaderSource::text(self : ShaderSource) -> String?

    The text, when this is WGSL.

    ShaderSource::words

    fn ShaderSource::words(self : ShaderSource) -> Bytes?

    The words, when this is SPIR-V.

    ShaderSourceKind

    pub(all) enum ShaderSourceKind {
    Wgsl
    SpirV
    } derive(Eq,
    Debug
    )

    What a ShaderModule is written in. WGSL is the only language the specification defines; SPIR-V is accepted by some adapters and is kept here so that a backend that wants it has a place to say so.

    ShaderStages

    pub struct ShaderStages(UInt) derive(Eq,
    Debug
    )

    The set of GPUShaderStage bits an entry of a bind group layout is visible to.

    ShaderStages::all

    ShaderStages::bits

    fn ShaderStages::bits(self : ShaderStages) -> UInt

    ShaderStages::compute

    fn ShaderStages::compute() -> ShaderStages

    ShaderStages::contains

    fn ShaderStages::contains(self : ShaderStages, other : ShaderStages) -> Bool

    ShaderStages::fragment

    fn ShaderStages::fragment() -> ShaderStages

    ShaderStages::intersects

    fn ShaderStages::intersects(self : ShaderStages, other : ShaderStages) -> Bool

    ShaderStages::is_empty

    fn ShaderStages::is_empty(self : ShaderStages) -> Bool

    ShaderStages::none

    ShaderStages::vertex

    fn ShaderStages::vertex() -> ShaderStages

    StencilFaceState

    pub(all) struct StencilFaceState {
    compare : CompareFunction
    fail_op : StencilOperation
    depth_fail_op : StencilOperation
    pass_op : StencilOperation
    } derive(
    Debug
    )

    A GPUStencilFaceState.

    StencilFaceState::new

    fn StencilFaceState::new(compare? : CompareFunction, fail_op? : StencilOperation, depth_fail_op? : StencilOperation, pass_op? : StencilOperation) -> StencilFaceState

    StencilOperation

    pub(all) enum StencilOperation {
    Keep
    Zero
    Replace
    Invert
    IncrementClamp
    DecrementClamp
    IncrementWrap
    DecrementWrap
    } derive(Eq,
    Debug
    )

    GPUStencilOperation.

    StencilState

    pub(all) struct StencilState {
    front : StencilFaceState
    back : StencilFaceState
    read_mask : Int
    write_mask : Int
    } derive(
    Debug
    )

    A GPUStencilState: the same four operations for the two faces.

    StencilState::new

    fn StencilState::new(front? : StencilFaceState, back? : StencilFaceState, read_mask? : Int, write_mask? : Int) -> StencilState

    StorageAccess

    pub(all) enum StorageAccess {
    None
    WriteOnly
    ReadOnly
    Both
    } derive(Eq,
    Debug
    )

    Which GPUStorageTextureAccess values the format offers. None means the format cannot be a storage texture at all.

    StorageTextureAccess

    pub(all) enum StorageTextureAccess {
    WriteOnly
    ReadOnly
    ReadWrite
    } derive(Eq,
    Debug
    )

    GPUStorageTextureAccess.

    StorageTextureBindingLayout

    pub(all) struct StorageTextureBindingLayout {
    access : StorageTextureAccess
    format : TextureFormat
    view_dimension : TextureViewDimension
    } derive(
    Debug
    )

    A GPUStorageTextureBindingLayout.

    StorageTextureBindingLayout::new

    StoreOp

    pub(all) enum StoreOp {
    Store
    Discard
    } derive(Eq,
    Debug
    )

    GPUStoreOp.

    SurfaceCapabilities

    pub(all) struct SurfaceCapabilities {
    formats : Array[TextureFormat]
    alpha_modes : Array[CanvasAlphaMode]
    usages : TextureUsages
    } derive(
    Debug
    )

    What a surface can be configured with, as GPUCanvasContext reports it through the adapter.

    SurfaceCapabilities::new

    SurfaceConfiguration

    pub(all) struct SurfaceConfiguration {
    format : TextureFormat
    usage : TextureUsages
    view_formats : Array[TextureFormat]
    color_space : PredefinedColorSpace
    tone_mapping : CanvasToneMapping
    alpha_mode : CanvasAlphaMode
    } derive(
    Debug
    )

    GPUCanvasConfiguration, minus the device it names.

    The device is a property of the CanvasContext here rather than a field of the configuration: a configuration is handed to a host surface, which has no way to name a device, and the context is where the two are known to be the same one.

    https://www.w3.org/TR/webgpu/#dictdef-gpucanvasconfiguration

    SurfaceConfiguration::new

    fn SurfaceConfiguration::new(format~ : TextureFormat, usage? : TextureUsages, view_formats? : Array[TextureFormat], color_space? : PredefinedColorSpace, tone_mapping? : CanvasToneMapping, alpha_mode? : CanvasAlphaMode) -> SurfaceConfiguration

    The configuration a canvas starts from: renderable, sRGB, opaque, and the standard tone mapping.

    SurfaceFrame

    pub(all) struct SurfaceFrame {
    texture : TextureId
    suboptimal : Bool
    } derive(
    Debug
    )

    One acquired frame: the texture to render into, and whether the surface considers it a poor match for what it can present.

    SurfaceFrame::new

    fn SurfaceFrame::new(texture~ : TextureId, suboptimal? : Bool) -> SurfaceFrame

    TexelCopyBufferInfo

    pub(all) struct TexelCopyBufferInfo {
    buffer : BufferId
    layout : TexelCopyBufferLayout
    } derive(
    Debug
    )

    A GPUTexelCopyBufferInfo: a buffer plus the layout of the texels in it.

    TexelCopyBufferInfo::new

    TexelCopyBufferLayout

    pub(all) struct TexelCopyBufferLayout {
    offset : Int
    bytes_per_row : Int?
    rows_per_image : Int?
    } derive(
    Debug
    )

    Where the bytes of one row start and how far apart rows are: GPUTexelCopyBufferLayout.

    bytes_per_row and rows_per_image are None for a copy that is one row or one layer deep, and must be given for anything larger.

    TexelCopyBufferLayout::new

    fn TexelCopyBufferLayout::new(offset? : Int, bytes_per_row? : Int, rows_per_image? : Int) -> TexelCopyBufferLayout

    TexelCopyTextureInfo

    pub(all) struct TexelCopyTextureInfo {
    texture : TextureId
    mip_level : Int
    origin : Origin3d
    aspect : TextureAspect
    } derive(
    Debug
    )

    A GPUTexelCopyTextureInfo: a subresource of a texture.

    TexelCopyTextureInfo::new

    fn TexelCopyTextureInfo::new(texture~ : TextureId, mip_level? : Int, origin? : Origin3d, aspect? : TextureAspect) -> TexelCopyTextureInfo

    TextureAspect

    pub(all) enum TextureAspect {
    All
    StencilOnly
    DepthOnly
    } derive(Eq,
    Debug
    )

    GPUTextureAspect: which aspect of a depth-stencil texture is addressed.

    TextureBindingLayout

    pub(all) struct TextureBindingLayout {
    sample_type : SampleType
    view_dimension : TextureViewDimension
    multisampled : Bool
    } derive(
    Debug
    )

    A GPUTextureBindingLayout.

    TextureBindingLayout::new

    fn TextureBindingLayout::new(sample_type? : SampleType, view_dimension? : TextureViewDimension, multisampled? : Bool) -> TextureBindingLayout

    TextureDescriptor

    pub(all) struct TextureDescriptor {
    label : String
    size : Extent3d
    mip_level_count : Int
    sample_count : Int
    dimension : TextureDimension
    format : TextureFormat
    usage : TextureUsages
    view_formats : Array[TextureFormat]
    texture_binding_view_dimension : TextureViewDimension?
    } derive(
    Debug
    )

    A GPUTextureDescriptor.

    TextureDescriptor::new

    fn TextureDescriptor::new(size~ : Extent3d, format~ : TextureFormat, usage~ : TextureUsages, mip_level_count? : Int, sample_count? : Int, dimension? : TextureDimension, view_formats? : Array[TextureFormat], texture_binding_view_dimension? : TextureViewDimension, label? : String) -> TextureDescriptor

    A texture of one mip level and one sample, the default every other option starts from.

    TextureDimension

    pub(all) enum TextureDimension {
    D1
    D2
    D3
    } derive(Eq,
    Debug
    )

    GPUTextureDimension: whether a texture is one-, two- or three-dimensional.

    TextureFormat

    pub(all) enum TextureFormat {
    R8unorm
    R8snorm
    R8uint
    R8sint
    R16unorm
    R16snorm
    R16uint
    R16sint
    R16float
    Rg8unorm
    Rg8snorm
    Rg8uint
    Rg8sint
    R32uint
    R32sint
    R32float
    Rg16unorm
    Rg16snorm
    Rg16uint
    Rg16sint
    Rg16float
    Rgba8unorm
    Rgba8unormSrgb
    Rgba8snorm
    Rgba8uint
    Rgba8sint
    Bgra8unorm
    Bgra8unormSrgb
    Rgb9e5ufloat
    Rgb10a2uint
    Rgb10a2unorm
    Rg11b10ufloat
    Rg32uint
    Rg32sint
    Rg32float
    Rgba16unorm
    Rgba16snorm
    Rgba16uint
    Rgba16sint
    Rgba16float
    Rgba32uint
    Rgba32sint
    Rgba32float
    Stencil8
    Depth16unorm
    Depth24plus
    Depth24plusStencil8
    Depth32float
    Depth32floatStencil8
    Bc1RgbaUnorm
    Bc1RgbaUnormSrgb
    Bc2RgbaUnorm
    Bc2RgbaUnormSrgb
    Bc3RgbaUnorm
    Bc3RgbaUnormSrgb
    Bc4RUnorm
    Bc4RSnorm
    Bc5RgUnorm
    Bc5RgSnorm
    Bc6hRgbUfloat
    Bc6hRgbFloat
    Bc7RgbaUnorm
    Bc7RgbaUnormSrgb
    Etc2Rgb8unorm
    Etc2Rgb8unormSrgb
    Etc2Rgb8a1unorm
    Etc2Rgb8a1unormSrgb
    Etc2Rgba8unorm
    Etc2Rgba8unormSrgb
    EacR11unorm
    EacR11snorm
    EacRg11unorm
    EacRg11snorm
    Astc4x4Unorm
    Astc4x4UnormSrgb
    Astc5x4Unorm
    Astc5x4UnormSrgb
    Astc5x5Unorm
    Astc5x5UnormSrgb
    Astc6x5Unorm
    Astc6x5UnormSrgb
    Astc6x6Unorm
    Astc6x6UnormSrgb
    Astc8x5Unorm
    Astc8x5UnormSrgb
    Astc8x6Unorm
    Astc8x6UnormSrgb
    Astc8x8Unorm
    Astc8x8UnormSrgb
    Astc10x5Unorm
    Astc10x5UnormSrgb
    Astc10x6Unorm
    Astc10x6UnormSrgb
    Astc10x8Unorm
    Astc10x8UnormSrgb
    Astc10x10Unorm
    Astc10x10UnormSrgb
    Astc12x10Unorm
    Astc12x10UnormSrgb
    Astc12x12Unorm
    Astc12x12UnormSrgb
    } derive(Eq,
    Debug
    )

    A GPUTextureFormat: the texel layout of a texture.

    The list follows the enumeration the specification prints, in the same order, so that a reader can compare the two side by side. https://www.w3.org/TR/webgpu/#enumdef-gputextureformat

    TextureFormat::all

    Every format the specification defines, in specification order.

    TextureFormat::bytes_per_row

    fn TextureFormat::bytes_per_row(self : TextureFormat, width~ : Int) -> Int

    The bytes one row of width texels of format occupies before padding, not counting the 256-byte alignment a copy imposes.

    TextureFormat::info

    The capabilities of self.

    TextureFormat::name

    fn TextureFormat::name(self : TextureFormat) -> String

    The format string the specification uses, as in "rgba8unorm".

    TextureId

    pub struct TextureId(UInt64) derive(Eq,
    Debug
    )

    The identity of a texture inside one adapter.

    TextureId::from_raw

    fn TextureId::from_raw(raw : UInt64) -> TextureId

    An identity from the integer the backend allocated.

    TextureId::raw

    fn TextureId::raw(self : TextureId) -> UInt64

    TextureUsages

    pub struct TextureUsages(UInt) derive(Eq,
    Debug
    )

    The set of GPUTextureUsage bits of one texture.

    TextureUsages::all

    TextureUsages::bits

    fn TextureUsages::bits(self : TextureUsages) -> UInt

    TextureUsages::contains

    fn TextureUsages::contains(self : TextureUsages, other : TextureUsages) -> Bool

    TextureUsages::copy_dst

    fn TextureUsages::copy_dst() -> TextureUsages

    TextureUsages::copy_src

    fn TextureUsages::copy_src() -> TextureUsages

    TextureUsages::from_bits

    fn TextureUsages::from_bits(bits : UInt) -> TextureUsages

    A usage set from its bits, the counterpart of BufferUsages::from_bits.

    TextureUsages::intersects

    fn TextureUsages::intersects(self : TextureUsages, other : TextureUsages) -> Bool

    TextureUsages::is_empty

    fn TextureUsages::is_empty(self : TextureUsages) -> Bool

    TextureUsages::none

    TextureUsages::render_attachment

    fn TextureUsages::render_attachment() -> TextureUsages

    TextureUsages::storage_binding

    fn TextureUsages::storage_binding() -> TextureUsages

    TextureUsages::texture_binding

    fn TextureUsages::texture_binding() -> TextureUsages

    TextureViewDescriptor

    pub(all) struct TextureViewDescriptor {
    label : String
    format : TextureFormat?
    dimension : TextureViewDimension?
    aspect : TextureAspect
    base_mip_level : Int
    mip_level_count : Int?
    base_array_layer : Int
    array_layer_count : Int?
    usage : TextureUsages?
    swizzle : String?
    } derive(
    Debug
    )

    A GPUTextureViewDescriptor.

    TextureViewDescriptor::new

    fn TextureViewDescriptor::new(label? : String, format? : TextureFormat, dimension? : TextureViewDimension, aspect? : TextureAspect, base_mip_level? : Int, mip_level_count? : Int, base_array_layer? : Int, array_layer_count? : Int, usage? : TextureUsages, swizzle? : String) -> TextureViewDescriptor

    A view of the whole texture in its own format and dimension.

    TextureViewDimension

    pub(all) enum TextureViewDimension {
    D1
    D2
    D2Array
    Cube
    CubeArray
    D3
    } derive(Eq,
    Debug
    )

    GPUTextureViewDimension: how a view reads the texture it stands on.

    TextureViewId

    pub struct TextureViewId(UInt64) derive(Eq,
    Debug
    )

    The identity of a view on a texture.

    TextureViewId::from_raw

    fn TextureViewId::from_raw(raw : UInt64) -> TextureViewId

    An identity from the integer the backend allocated.

    TextureViewId::raw

    fn TextureViewId::raw(self : TextureViewId) -> UInt64

    ToneMappingMode

    pub(all) enum ToneMappingMode {
    Standard
    Extended
    } derive(Eq,
    Debug
    )

    CanvasToneMappingMode: how values outside the displayable range are mapped before they reach the canvas.

    VertexAttribute

    pub(all) struct VertexAttribute {
    format : VertexFormat
    offset : Int
    shader_location : Int
    } derive(
    Debug
    )

    A GPUVertexAttribute.

    VertexAttribute::new

    fn VertexAttribute::new(format~ : VertexFormat, offset~ : Int, shader_location~ : Int) -> VertexAttribute

    VertexBufferLayout

    pub(all) struct VertexBufferLayout {
    array_stride : Int
    step_mode : VertexStepMode
    attributes : Array[VertexAttribute]
    } derive(
    Debug
    )

    A GPUVertexBufferLayout.

    VertexBufferLayout::new

    fn VertexBufferLayout::new(array_stride~ : Int, step_mode~ : VertexStepMode, attributes~ : Array[VertexAttribute]) -> VertexBufferLayout

    VertexDataType

    pub(all) enum VertexDataType {
    Uint
    Sint
    Unorm
    Snorm
    Float
    } derive(Eq,
    Debug
    )

    The scalar type the bytes decode to, which decides what WGSL type the attribute may be declared as.

    VertexFormat

    pub(all) enum VertexFormat {
    Uint8
    Uint8x2
    Uint8x4
    Sint8
    Sint8x2
    Sint8x4
    Unorm8
    Unorm8x2
    Unorm8x4
    Snorm8
    Snorm8x2
    Snorm8x4
    Uint16
    Uint16x2
    Uint16x4
    Sint16
    Sint16x2
    Sint16x4
    Unorm16
    Unorm16x2
    Unorm16x4
    Snorm16
    Snorm16x2
    Snorm16x4
    Float16
    Float16x2
    Float16x4
    Float32
    Float32x2
    Float32x3
    Float32x4
    Uint32
    Uint32x2
    Uint32x3
    Uint32x4
    Sint32
    Sint32x2
    Sint32x3
    Sint32x4
    Unorm1010102
    Unorm8x4Bgra
    Snorm1010102
    } derive(Eq,
    Debug
    )

    How the bytes of one vertex attribute are read, GPUVertexFormat.

    VertexFormat::alignment

    fn VertexFormat::alignment(self : VertexFormat) -> Int

    The alignment an attribute offset must be a multiple of: the smaller of four bytes and the size of the whole attribute.

    VertexFormat::all

    Every vertex format, in specification order.

    VertexFormat::components

    fn VertexFormat::components(self : VertexFormat) -> Int

    How many components the attribute has.

    VertexFormat::info

    The layout of one attribute. Sizes are the byteSize column of the specification's vertex format table; the three packed formats hold four components in four bytes. https://www.w3.org/TR/webgpu/#vertex-formats

    VertexFormat::name

    fn VertexFormat::name(self : VertexFormat) -> String

    The format string the specification uses, as in "unorm10-10-10-2".

    VertexFormat::size

    fn VertexFormat::size(self : VertexFormat) -> Int

    The bytes one vertex of this attribute occupies.

    VertexFormatInfo

    pub(all) struct VertexFormatInfo {
    size : Int
    components : Int
    data_type : VertexDataType
    } derive(Eq,
    Debug
    )

    What a VertexFormat occupies in a vertex buffer.

    VertexState

    pub(all) struct VertexState {
    shader : ShaderModuleId
    entry_point : String
    buffers : Array[VertexBufferLayout]
    } derive(
    Debug
    )

    The vertex stage of a pipeline: which shader, which entry point, and how the vertex buffers are laid out.

    VertexState::new

    fn VertexState::new(shader~ : ShaderModuleId, entry_point~ : String, buffers? : Array[VertexBufferLayout]) -> VertexState

    VertexStepMode

    pub(all) enum VertexStepMode {
    Vertex
    Instance
    } derive(Eq,
    Debug
    )

    GPUVertexStepMode: whether a vertex buffer advances per vertex or per instance.

    WriteTimestamp

    pub(all) struct WriteTimestamp {
    query_set : QuerySetId
    query_index : Int
    } derive(
    Debug
    )

    write_timestamp, inside a pass or on a compute pass.