laplaceliu/tycho/rhi/types does not have a README file

    AddressMode

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

    BackendKind

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

    BackendKind::name

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

    BackendKind::shader_language

    fn BackendKind::shader_language(self : BackendKind) -> ShaderLanguage

    BindingLayout

    pub(all) struct BindingLayout {
    texture_base : Int
    sampler_base : Int
    storage_base : Int
    uniform_base : Int
    push : Int
    } derive(Eq,
    Debug
    )

    Where a pipeline's shader expects each kind of resource.

    The RHI binds by slot; WGSL binds by number. Until now the two agreed only because a single global formula (textures 0..n, samplers n..2n, push 2n) happened to fit the one converted shader. It does not scale: any shader that occupies a binding of its own -- 2d's blur uses binding 2, prim2d uses 0 and 1 for storage buffers -- collides with it.

    So the layout travels with the pipeline. legacy reproduces the old formula exactly, which is what every SPIR-V pipeline still means.

    BindingLayout::legacy

    fn BindingLayout::legacy(texture_slots : Int) -> BindingLayout

    The layout every pipeline used before per-shader plans existed: textures from 0, samplers one panel later, push constants after both.

    BlendFactor

    pub(all) enum BlendFactor {
    Zero
    One
    SrcColor
    OneMinusSrcColor
    DstColor
    OneMinusDstColor
    SrcAlpha
    OneMinusSrcAlpha
    DstAlpha
    OneMinusDstAlpha
    } derive(Eq,
    Debug
    )

    BlendMode

    pub(all) enum BlendMode {
    Opaque
    Alpha
    Additive
    Premultiplied
    Multiply
    DstIn
    SrcIn
    Clear
    } derive(Eq,
    Debug
    )

    BlendOp

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

    BlendState

    pub(all) struct BlendState {
    src_color : BlendFactor
    dst_color : BlendFactor
    color_op : BlendOp
    src_alpha : BlendFactor
    dst_alpha : BlendFactor
    alpha_op : BlendOp
    } derive(Eq,
    Debug
    )

    BlendState::new

    fn BlendState::new(src_color : BlendFactor, dst_color : BlendFactor, src_alpha : BlendFactor, dst_alpha : BlendFactor, color_op? : BlendOp, alpha_op? : BlendOp) -> BlendState

    BorderColor

    pub(all) enum BorderColor {
    TransparentBlack
    OpaqueBlack
    OpaqueWhite
    } derive(Eq,
    Debug
    )

    BufferKind

    pub(all) enum BufferKind {
    Vertex
    Index
    Uniform
    Storage
    Staging
    Indirect
    } derive(Eq,
    Debug
    )

    BufferUsage

    pub(all) struct BufferUsage {
    // private fields
    }

    Composable buffer usage flags. BufferKind remains the shortcut for the common single-purpose cases; this type expresses the combinations GPU-driven pipelines need (Storage | Indirect, Storage | Vertex, ...).

    BufferUsage::as_kind

    fn BufferUsage::as_kind(self : BufferUsage) -> BufferKind

    The single-purpose kind that best describes usage, for backends that only distinguish storage from everything else.

    BufferUsage::bits

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

    BufferUsage::combine

    fn BufferUsage::combine(self : BufferUsage, other : BufferUsage) -> BufferUsage

    BufferUsage::contains

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

    BufferUsage::copy_dst

    fn BufferUsage::copy_dst() -> BufferUsage

    BufferUsage::copy_src

    fn BufferUsage::copy_src() -> BufferUsage

    BufferUsage::from_kind

    fn BufferUsage::from_kind(kind : BufferKind) -> BufferUsage

    The usage set the legacy BufferKind implies (including the transfer bits the backends used to add implicitly).

    BufferUsage::index

    fn BufferUsage::index() -> BufferUsage

    BufferUsage::indirect

    fn BufferUsage::indirect() -> BufferUsage

    BufferUsage::none

    fn BufferUsage::none() -> BufferUsage

    BufferUsage::storage

    fn BufferUsage::storage() -> BufferUsage

    BufferUsage::uniform

    fn BufferUsage::uniform() -> BufferUsage

    BufferUsage::vertex

    fn BufferUsage::vertex() -> BufferUsage

    ClearColor

    pub(all) struct ClearColor {
    r : Float
    g : Float
    b : Float
    a : Float
    }

    ClearColor::black

    fn ClearColor::black() -> ClearColor

    ClearColor::rgba

    fn ClearColor::rgba(r : Float, g : Float, b : Float, a : Float) -> ClearColor

    ColorTargetState

    pub(all) struct ColorTargetState {
    format : TextureFormat?
    write : Bool
    blend_mode : BlendMode?
    blend_state : BlendState?
    }

    One colour attachment: format plus its write mask and blend state.

    ColorTargetState::effective_blend_mode

    fn ColorTargetState::effective_blend_mode(self : ColorTargetState) -> BlendMode

    The resolved blend mode, Opaque when the target does not ask for blending.

    ColorTargetState::new

    fn ColorTargetState::new(format? : TextureFormat, write? : Bool, blend_mode? : BlendMode, blend_state? : BlendState) -> ColorTargetState

    CompareOp

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

    CullMode

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

    DepthStencilState

    pub(all) struct DepthStencilState {
    depth_test : Bool
    write : Bool
    compare : CompareOp
    format : TextureFormat?
    depth_only : Bool
    bias : Bool
    bias_constant : Float
    bias_slope : Float
    stencil : StencilState?
    }

    Depth/stencil state, grouped out of the flat PipelineDesc.

    DepthStencilState::new

    fn DepthStencilState::new(depth_test? : Bool, write? : Bool, compare? : CompareOp, format? : TextureFormat, depth_only? : Bool, bias? : Bool, bias_constant? : Float, bias_slope? : Float, stencil? : StencilState) -> DepthStencilState

    DepthTargetDesc

    pub(all) struct DepthTargetDesc {
    texture : UInt64
    load_op : LoadOp
    store_op : StoreOp
    clear_depth : Float
    stencil_load_op : LoadOp
    stencil_store_op : StoreOp
    clear_stencil : Int
    }

    DepthTargetDesc::new

    fn DepthTargetDesc::new(texture : UInt64, load_op? : LoadOp, store_op? : StoreOp, clear_depth? : Float, stencil_load_op? : LoadOp, stencil_store_op? : StoreOp, clear_stencil? : Int) -> DepthTargetDesc

    DeviceCapabilities

    pub(all) struct DeviceCapabilities {
    device_name : String
    is_discrete : Bool
    api_version : UInt
    driver_version : UInt
    max_image_dimension_2d : Int
    max_framebuffer_samples : Int
    max_sampler_anisotropy : Float
    min_uniform_buffer_offset_alignment : Int
    supports_anisotropy : Bool
    supports_indirect_draw : Bool
    supports_bindless : Bool
    supports_mesh_shader : Bool
    supports_ray_query : Bool
    }

    DeviceDesc

    pub(all) struct DeviceDesc {
    app_name : String
    validation : Bool
    headless : Bool
    pipeline_cache : Bytes
    backend : BackendKind
    }

    DeviceDesc::new

    fn DeviceDesc::new(app_name : String, validation? : Bool, headless? : Bool, pipeline_cache? : Bytes, backend? : BackendKind) -> DeviceDesc

    ExternalSurface

    pub(all) struct ExternalSurface {
    kind : ExternalSurfaceKind
    display : UInt64
    handle : UInt64
    } derive(Eq,
    Debug
    )

    Host-owned surface handle passed into SwapchainDesc when the OS/app owns window creation (mandatory on iOS/Android, optional on desktop/web). display / handle meanings match ExternalSurfaceKind:
    • Xlib: (Display*, Window)
    • Wayland: (wl_display*, wl_surface*)
    • Win32: (HINSTANCE, HWND)
    • MetalLayer: (0, CAMetalLayer*)
    • AndroidNativeWindow: (0, ANativeWindow*)
    • WebCanvas: (canvas_id, 0)

    ExternalSurface::new

    fn ExternalSurface::new(kind : ExternalSurfaceKind, display : UInt64, handle : UInt64) -> ExternalSurface

    ExternalSurfaceKind

    pub(all) enum ExternalSurfaceKind {
    Xlib
    Xcb
    Wayland
    Win32
    MetalLayer
    AndroidNativeWindow
    WebCanvas
    Headless
    } derive(Eq,
    Debug
    )

    Native surface kind for externally owned surfaces (iOS CAMetalLayer, Android ANativeWindow, embedded desktop windows, or an existing web canvas). Pure L1 data so rhi/types stays independent of plat.

    Filter

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

    FrontFace

    pub(all) enum FrontFace {
    Clockwise
    CounterClockwise
    } derive(Eq,
    Debug
    )

    IndexType

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

    LoadOp

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

    MemoryLocation

    pub(all) enum MemoryLocation {
    GpuOnly
    CpuToGpu
    GpuToCpu
    } derive(Eq,
    Debug
    )

    MeshPipelineDesc

    pub(all) struct MeshPipelineDesc {
    task : FixedArray[UInt]?
    mesh : FixedArray[UInt]
    frag : FixedArray[UInt]
    task_entry : String
    mesh_entry : String
    frag_entry : String
    uniform_slots : Int
    texture_slots : Int
    storage_slots : Int
    storage_image_slots : Int
    uniform_bindings : Array[Int]
    texture_bindings : Array[Int]
    storage_bindings : Array[Int]
    storage_image_bindings : Array[Int]
    push_constant_size : Int
    raster : RasterState
    depth_stencil : DepthStencilState?
    color_targets : Array[ColorTargetState]
    bindless_heap : UInt64?
    }

    MeshPipelineDesc::color_target

    fn MeshPipelineDesc::color_target(self : MeshPipelineDesc, index : Int) -> ColorTargetState

    The colour target at index, falling back to a default when the mesh pipeline descriptor has no explicit target.

    MeshPipelineDesc::depth_or_default

    fn MeshPipelineDesc::depth_or_default(self : MeshPipelineDesc) -> DepthStencilState

    The depth/stencil state of a mesh pipeline, with defaults filled in.

    MeshPipelineDesc::new

    fn MeshPipelineDesc::new(mesh : FixedArray[UInt], frag : FixedArray[UInt], task? : FixedArray[UInt], task_entry? : String, mesh_entry? : String, frag_entry? : String, uniform_slots? : Int, texture_slots? : Int, storage_slots? : Int, storage_image_slots? : Int, uniform_bindings? : Array[Int], texture_bindings? : Array[Int], storage_bindings? : Array[Int], storage_image_bindings? : Array[Int], push_constant_size? : Int, depth_test? : Bool, depth_write? : Bool, depth_compare? : CompareOp, depth_format? : TextureFormat, cull_mode? : CullMode, front_face? : FrontFace, blend? : Bool, blend_mode? : BlendMode, color_write? : Bool, samples? : SampleCount, color_format? : TextureFormat, color_formats? : Array[TextureFormat], bindless_heap? : UInt64) -> MeshPipelineDesc

    PipelineDesc

    pub(all) struct PipelineDesc {
    vert : FixedArray[UInt]
    frag : FixedArray[UInt]
    vert_entry : String
    frag_entry : String
    vertex_formats : Array[VertexFormat]
    vertex_layouts : Array[VertexBufferLayout]
    uniform_slots : Int
    texture_slots : Int
    layout : BindingLayout
    storage_slots : Int
    storage_image_slots : Int
    accel_slots : Int
    uniform_bindings : Array[Int]
    texture_bindings : Array[Int]
    storage_bindings : Array[Int]
    storage_image_bindings : Array[Int]
    accel_bindings : Array[Int]
    push_constant_size : Int
    raster : RasterState
    depth_stencil : DepthStencilState?
    color_targets : Array[ColorTargetState]
    bindless_heap : UInt64?
    }

    PipelineDesc::color_target

    fn PipelineDesc::color_target(self : PipelineDesc, index : Int) -> ColorTargetState

    The colour target at index, falling back to a default when the descriptor has no explicit target (single-target pipelines without a format).

    PipelineDesc::color_target_states

    fn PipelineDesc::color_target_states(self : PipelineDesc) -> Array[ColorTargetState]

    The colour attachments, one entry per target. A single target is reported through color_format, an MRT list through color_formats.

    PipelineDesc::depth_or_default

    fn PipelineDesc::depth_or_default(self : PipelineDesc) -> DepthStencilState

    The depth/stencil state with defaults filled in, for backends that always need a value.

    PipelineDesc::depth_stencil_state

    fn PipelineDesc::depth_stencil_state(self : PipelineDesc) -> DepthStencilState?

    The depth/stencil half, or None when the pipeline has no depth or stencil state at all.

    PipelineDesc::from_spirv

    fn PipelineDesc::from_spirv(vert : FixedArray[UInt], frag : FixedArray[UInt], topology? : PrimitiveTopology, depth_test? : Bool, depth_write? : Bool, depth_compare? : CompareOp, depth_format? : TextureFormat, depth_only? : Bool, depth_bias? : Bool, depth_bias_constant? : Float, depth_bias_slope? : Float, stencil? : StencilState, cull_mode? : CullMode, front_face? : FrontFace, blend? : Bool, blend_mode? : BlendMode, blend_state? : BlendState, color_write? : Bool, samples? : SampleCount, color_format? : TextureFormat, color_formats? : Array[TextureFormat], vertex_layouts? : Array[VertexBufferLayout], bindless_heap? : UInt64) -> PipelineDesc

    PipelineDesc::graphics

    fn PipelineDesc::graphics(vert : FixedArray[UInt], frag : FixedArray[UInt], vert_entry? : String, frag_entry? : String, raster? : RasterState, depth_stencil? : DepthStencilState, color_targets? : Array[ColorTargetState], vertex_formats? : Array[VertexFormat], vertex_layouts? : Array[VertexBufferLayout], uniform_slots? : Int, texture_slots? : Int, storage_slots? : Int, storage_image_slots? : Int, accel_slots? : Int, uniform_bindings? : Array[Int], texture_bindings? : Array[Int], storage_bindings? : Array[Int], storage_image_bindings? : Array[Int], accel_bindings? : Array[Int], push_constant_size? : Int, bindless_heap? : UInt64) -> PipelineDesc

    Build a graphics pipeline from grouped state instead of 38 flat arguments. The result is the same PipelineDesc the flat constructor produces, so the two styles interoperate.

    PipelineDesc::new

    fn PipelineDesc::new(vert : FixedArray[UInt], frag : FixedArray[UInt], vert_entry? : String, frag_entry? : String, vertex_formats? : Array[VertexFormat], vertex_layouts? : Array[VertexBufferLayout], uniform_slots? : Int, texture_slots? : Int, storage_slots? : Int, storage_image_slots? : Int, accel_slots? : Int, uniform_bindings? : Array[Int], texture_bindings? : Array[Int], storage_bindings? : Array[Int], storage_image_bindings? : Array[Int], accel_bindings? : Array[Int], push_constant_size? : Int, topology? : PrimitiveTopology, depth_test? : Bool, depth_write? : Bool, depth_compare? : CompareOp, depth_format? : TextureFormat, depth_only? : Bool, depth_bias? : Bool, depth_bias_constant? : Float, depth_bias_slope? : Float, stencil? : StencilState, cull_mode? : CullMode, front_face? : FrontFace, blend? : Bool, blend_mode? : BlendMode, blend_state? : BlendState, color_write? : Bool, samples? : SampleCount, color_format? : TextureFormat, color_formats? : Array[TextureFormat], bindless_heap? : UInt64) -> PipelineDesc

    PipelineDesc::raster_state

    fn PipelineDesc::raster_state(self : PipelineDesc) -> RasterState

    The rasterisation half of a pipeline description.

    PipelineDesc::with_wgsl

    fn PipelineDesc::with_wgsl(self : PipelineDesc, vert : String, frag : String) -> PipelineDesc

    Swap this pipeline's shaders for WGSL equivalents.

    Callers hold both forms because the format is chosen at runtime, not at build time: the same example links against whichever backend the target provides (ADR-005 D7). Pass "" for a pipeline that has no WGSL yet -- the descriptor is left alone, and a backend that needs WGSL will reject the SPIR-V by magic number with a message naming the stage, rather than building a pipeline from an empty module.

    PresentMode

    pub(all) enum PresentMode {
    Fifo
    Mailbox
    Immediate
    } derive(Eq,
    Debug
    )

    PrimitiveTopology

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

    RasterState

    pub(all) struct RasterState {
    topology : PrimitiveTopology
    cull_mode : CullMode
    front_face : FrontFace
    samples : SampleCount
    }

    Rasterisation state, grouped out of the flat PipelineDesc.

    RasterState::new

    fn RasterState::new(topology? : PrimitiveTopology, cull_mode? : CullMode, front_face? : FrontFace, samples? : SampleCount) -> RasterState

    RayGeometryDesc

    pub(all) struct RayGeometryDesc {
    vertex_buffer : UInt64
    vertex_count : Int
    vertex_stride : Int
    index_buffer : UInt64?
    index_count : Int
    index_type : IndexType
    is_opaque : Bool
    }

    RayGeometryDesc::new

    fn RayGeometryDesc::new(vertex_buffer : UInt64, vertex_count : Int, vertex_stride? : Int, index_buffer? : UInt64, index_count? : Int, index_type? : IndexType, is_opaque? : Bool) -> RayGeometryDesc

    RayInstanceDesc

    pub(all) struct RayInstanceDesc {
    blas : UInt64
    transform : FixedArray[Float]
    custom_index : Int
    mask : Int
    }

    RayInstanceDesc::from_affine3

    fn RayInstanceDesc::from_affine3(blas : UInt64, affine :
    Affine3
    , custom_index? : Int, mask? : Int) -> RayInstanceDesc

    Instance descriptor whose TLAS transform comes from an affine transform (row-major 3x4, the same layout as VkTransformMatrixKHR).

    RayInstanceDesc::new

    fn RayInstanceDesc::new(blas : UInt64, transform? : FixedArray[Float], custom_index? : Int, mask? : Int) -> RayInstanceDesc

    RenderTargetDesc

    pub(all) struct RenderTargetDesc {
    texture : UInt64
    load_op : LoadOp
    store_op : StoreOp
    clear_color : ClearColor
    resolve_texture : UInt64?
    }

    RenderTargetDesc::new

    fn RenderTargetDesc::new(texture : UInt64, load_op? : LoadOp, store_op? : StoreOp, clear_color? : ClearColor, resolve_texture? : UInt64) -> RenderTargetDesc

    SampleCount

    pub(all) enum SampleCount {
    X1
    X4
    } derive(Eq,
    Debug
    )

    SamplerDesc

    pub(all) struct SamplerDesc {
    mag : Filter
    min : Filter
    mipmap : Filter
    address : AddressMode
    border_color : BorderColor
    min_lod : Float
    max_lod : Float
    mip_lod_bias : Float
    anisotropy : Float
    compare_op : CompareOp?
    }

    SamplerDesc::new

    fn SamplerDesc::new(mag? : Filter, min? : Filter, mipmap? : Filter, address? : AddressMode, border_color? : BorderColor, min_lod? : Float, max_lod? : Float, mip_lod_bias? : Float, anisotropy? : Float, compare_op? : CompareOp) -> SamplerDesc

    ShaderLanguage

    pub(all) enum ShaderLanguage {
    SpirV
    Wgsl
    Dxil
    Msl
    } derive(Eq,
    Debug
    )

    The shader blob format a backend can consume (ADR-005 D7).

    The same FixedArray[UInt32] channel carries whichever of these the device wants -- SPIR-V words as-is, WGSL as UTF-8 zero-padded to a 4-byte boundary -- so a pipeline descriptor does not need a dozen shader fields. What the caller must not do is guess: ask the device.

    Dxil exists so that asking has an honest answer before a DX12 backend can build pipelines; a caller that only knows SPIR-V and WGSL must report it as unsupported rather than shipping the wrong bytes.

    StencilFaceState

    pub(all) struct StencilFaceState {
    fail_op : StencilOp
    pass_op : StencilOp
    depth_fail_op : StencilOp
    compare_op : CompareOp
    }

    StencilFaceState::new

    fn StencilFaceState::new(fail_op? : StencilOp, pass_op? : StencilOp, depth_fail_op? : StencilOp, compare_op? : CompareOp) -> StencilFaceState

    StencilOp

    pub(all) enum StencilOp {
    Keep
    Zero
    Replace
    IncrementAndClamp
    DecrementAndClamp
    Invert
    IncrementAndWrap
    DecrementAndWrap
    } derive(Eq,
    Debug
    )

    StencilState

    pub(all) struct StencilState {
    front : StencilFaceState
    back : StencilFaceState
    compare_mask : UInt
    write_mask : UInt
    reference : UInt
    }

    StencilState::new

    fn StencilState::new(front? : StencilFaceState, back? : StencilFaceState, compare_mask? : UInt, write_mask? : UInt, reference? : UInt) -> StencilState

    StoreOp

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

    SwapchainDesc

    pub(all) struct SwapchainDesc {
    title : String
    width : Int
    height : Int
    depth : Bool
    depth_format : TextureFormat
    clear_color : ClearColor
    enable_readback : Bool
    present_mode : PresentMode
    external_surface : ExternalSurface?
    }

    SwapchainDesc::new

    fn SwapchainDesc::new(title : String, width : Int, height : Int, depth? : Bool, depth_format? : TextureFormat, clear_color? : ClearColor, enable_readback? : Bool, present_mode? : PresentMode, external_surface? : ExternalSurface) -> SwapchainDesc

    TextureDesc

    pub(all) struct TextureDesc {
    width : Int
    height : Int
    format : TextureFormat
    usage : TextureUsage
    dimension : TextureDimension
    mip_levels : Int
    samples : SampleCount
    }

    One descriptor for every texture shape: 2D, 2D array and cubemap, with composable usage flags instead of a factory per combination.

    TextureDesc::new

    fn TextureDesc::new(width : Int, height : Int, format : TextureFormat, usage? : TextureUsage, dimension? : TextureDimension, mip_levels? : Int, samples? : SampleCount) -> TextureDesc

    TextureDimension

    pub(all) enum TextureDimension {
    D2
    D2Array(Int)
    Cube
    }

    TextureFormat

    pub(all) enum TextureFormat {
    RGBA8
    BGRA8
    RGBA8Srgb
    BGRA8Srgb
    RGBA16F
    RG16F
    R8
    RGBA32F
    Depth32F
    Depth24Stencil8
    } derive(Eq,
    Debug
    )

    TextureUsage

    pub(all) struct TextureUsage {
    // private fields
    }

    Composable texture usage flags.

    TextureUsage::bits

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

    TextureUsage::combine

    fn TextureUsage::combine(self : TextureUsage, other : TextureUsage) -> TextureUsage

    TextureUsage::contains

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

    TextureUsage::copy_dst

    fn TextureUsage::copy_dst() -> TextureUsage

    TextureUsage::copy_src

    fn TextureUsage::copy_src() -> TextureUsage

    TextureUsage::none

    TextureUsage::render_attachment

    fn TextureUsage::render_attachment() -> TextureUsage

    TextureUsage::sampled

    fn TextureUsage::sampled() -> TextureUsage

    TextureUsage::storage

    fn TextureUsage::storage() -> TextureUsage

    VertexAttribute

    pub(all) struct VertexAttribute {
    location : Int
    format : VertexFormat
    offset : Int
    }

    VertexAttribute::new

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

    VertexBufferLayout

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

    VertexBufferLayout::new

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

    VertexFormat

    pub(all) enum VertexFormat {
    Float2
    Float3
    Float4
    Float1
    Int1
    Uint1
    Unorm8x4
    Uint16x4
    } derive(Eq,
    Debug
    )

    VertexFormat::bytes

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

    Bytes consumed per vertex attribute.

    VertexFormat::code

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

    Backend-neutral encoding index. The DX12 shim uses the same numbering for its DXGI_FORMAT table, so keep the two in sync.

    VertexStepMode

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

    wgsl_words

    fn wgsl_words(text : String) -> FixedArray[UInt]

    Pack WGSL text into the shader blob channel.

    WebGPU takes WGSL as text, but the pipeline channel is FixedArray[UInt32], so the established encoding (tools/gen-wgsl-shaders.py, and the legacy wgpu_backend.mbt) is UTF-8 zero-padded to a 4-byte boundary. Packing it here keeps that detail out of every renderer.

    Source Files