tycho

    Tycho RHI — unified pure-MoonBit render hardware interface (Vulkan 1.3 backend + DX12 backend seam; Metal planned)

    graphics
    rhi
    vulkan
    gpu
    tycho
    Download zip
    Version
    0.11.0
    License
    Apache-2.0
    Last updated
    3 days ago
    Downloads
    98

    #laplaceliu/tycho

    Unified pure-MoonBit Render Hardware Interface (RHI) built atop laplaceliu/tycho_vulkan, laplaceliu/tycho_window, and laplaceliu/tycho_shader with zero C stubs.

    #Install

    moon add laplaceliu/tycho

    No cc-link-flags are required. laplaceliu/tycho_vulkan and laplaceliu/tycho_window resolve the Vulkan loader (libvulkan.so.1 / vulkan-1.dll / libvulkan.1.dylib / libMoltenVK.dylib) and the OS windowing libraries (libwayland-client, libX11, user32, AppKit + QuartzCore) at runtime through dlopen / LoadLibraryA, so downstream moon.pkg files only need the imports.

    Requirements: a Vulkan 1.3 loader + driver (dynamicRendering + synchronization2). No Vulkan SDK, -I, VULKAN_SDK, or -lvulkan / -lX11 / libx11-dev / libvulkan-dev dev package is needed at build time; the loader and windowing libraries only have to be present at runtime (standard on desktop Linux, Windows, and macOS).

    #Features (Vulkan 1.3 Backend)

    • Backend-opaque handles: Device, Swapchain, Pipeline, Buffer, Texture, Sampler, CommandBuffer, Fence, TimestampPool, BindlessHeap, AccelStruct
    • Vulkan 1.3 Dynamic Rendering + Synchronization2, 2 frames-in-flight, X11 + runtime-loaded Wayland swapchains, and automatic recreation on resize / OUT_OF_DATE
    • Pure-MoonBit free-list GPU memory sub-allocator (RegionPool / SubAllocator) with GpuOnly/CpuToGpu/GpuToCpu tiers, deferred deletion queue, and VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT when Ray Query is supported
    • SPIR-V Auto-Reflection: PipelineDesc::from_spirv and Device::create_compute_pipeline_auto derive vertex layouts, descriptor bindings (UBO, texture, SSBO, storage image, OpTypeAccelerationStructureKHR), push constant ranges, and MRT attachment counts directly from SPIR-V bytecode
    • Modern GPU Features: MRT, 4x MSAA Offscreen Resolve, Hardware Mipmap Generation, Compute Storage Images, Indirect / Indirect-Count Draw, Bindless Heap, Mesh Shaders, StencilState + dynamic set_stencil_reference, Inline Ray Query (create_blas / create_tlas / bind_accel_struct), and GPU Timestamp Queries (TimestampPool)
    • Deterministic backend errors: a cross-backend misuse (DX12 resource on a Vulkan command buffer or vice versa, a command the other backend does not implement) is recorded in CommandBuffer::first_error and raised from Device::end_commands / Swapchain::end_frame as RhiError::BackendUnsupported. Recording calls never drop a mistake silently.
    • Grouped pipeline state: PipelineDesc stores its drawing state as raster : RasterState, depth_stencil : DepthStencilState? and color_targets : Array[ColorTargetState] instead of 20 mirror fields, and PipelineDesc::graphics(vert, frag, raster=…, depth_stencil=…, color_targets=…) builds it without 38 flat arguments. PipelineDesc::new(...) keeps the flat keyword signature for existing call sites, raster_state() / depth_stencil_state() / color_target_states() expose views over the same storage, and color_target(i) / effective_blend_mode() give the backends the per-attachment view.
    • Scoped passes and bind groups: CommandBuffer::render_pass(colors, depth?, fn(pass) { … }) and swapchain_pass(sc, load_op?, clear_color?, fn(pass) { … }) close the pass even when the callback raises, so a recording session cannot be left half-open; compute_pass(fn) does the same for dispatch. BindGroup records a descriptor set once (.uniform(…).texture(…).storage(…)) for bind_group(group) to replay per draw. The 3D renderer records its shadow-atlas, main, bloom and tonemap passes this way, and the 2D renderer uses it for every self-contained pass (downsample, blur H/V, MSAA resolve, batched path flush, present).
    • Composable resource descriptors: TextureDesc (width/height/format/usage/dimension/mip_levels/samples) plus TextureUsage and BufferUsage bitflags replace the factory-per-combination API: Device::create_texture_desc and Device::create_buffer_usage express things like a Storage | Indirect draw buffer or a RenderAttachment | Sampled target, while the existing create_texture* / create_buffer* helpers stay as thin wrappers.
    • Wide vertex formats: VertexFormat covers Float1/Float2/Float3/Float4, Int1/Uint1, packed Unorm8x4 and Uint16x4, mapped to the matching VkFormat/DXGI_FORMAT (per-vertex code + byte size live in VertexFormat::code / bytes).
    • Native optional parameters: pipeline/sampler/render-target descriptions use MoonBit optional arguments (depth_format? : TextureFormat, compare_op? : CompareOp, resolve_texture? : Texture, …), so call sites read depth_format=TextureFormat::Depth32F instead of depth_format=Some(TextureFormat::Depth32F), and an existing Option forwards with depth_format?=maybe_depth.

    #Math

    The RHI depends on laplaceliu/tycho_math so the whole stack speaks one math dialect (column-major, GPU-upload ready, explicit clip space). The dependency is used only in the façade, for typed conveniences:

    • RayInstanceDesc::from_affine3(blas, Affine3) — and the identity default of RayInstanceDesc::new — produce the row-major 3x4 TLAS transform via Affine3::to_vk_transform_3x4(), so the VkTransformMatrixKHR layout lives in one place.
    • CommandBuffer::push_constants_mat4(pipe, Mat4).

    The raw APIs stay first-class: Buffer::upload_floats, push_constants_floats / push_constants_bytes still take FixedArray[Float] / Bytes, so you can bypass math entirely, and the Vulkan backend (vk_backend.mbt) never imports @tmath so it remains replaceable. check-math-layering.sh enforces both directions: tycho_math keeps zero laplaceliu/* dependencies and never references the RHI.

    Every typed helper is a thin wrapper over the raw call (raw stays the primitive), and falls into one of two classes: completeness twins of an existing raw call (upload_mat4, push_constants_mat4, RayInstanceDesc::from_affine3), which are covered by equivalence tests with non-degenerate matrices, and exploratory APIs, which require a real call site before they are added because a test cannot validate an API's shape. See ADR-002 §3.

    CursorMode

    CursorShape

    KeyCode

    Logical key identity. The platform layer reports X11 keysyms for historical reasons; from_keysym / to_keysym translate losslessly, and keys the enum does not name are preserved as Unknown(keysym).

    Modifiers

    Keyboard modifiers, decoded from the X11-compatible mask the platform layer reports (Shift=1, Lock=2, Ctrl=4, Mod1/Alt=8, Mod4/Super=64).

    MouseButton

    ReflectedBinding

    ReflectedDescriptorKind

    ReflectedStage

    ReflectedVertexFormat

    ReflectedVertexInput

    ShaderStage

    Shader stage identity, re-exported from laplaceliu/tycho_shader so the RHI and the compiler helpers agree on one enum (including ray-tracing stages).

    ShaderTarget

    glslangValidator --target-env selection.

    SpirvReflection

    RhiError

    pub suberror RhiError {
    InitFailed(String)
    DeviceFailed(String)
    SwapchainFailed(String)
    PipelineFailed(String)
    AllocationFailed(String)
    CommandFailed(String)
    InvalidArgument(String)
    BackendUnsupported(String)
    }

    impl Show for RhiError

    AccelStruct

    pub struct AccelStruct {
    // private fields
    }

    A BLAS or TLAS. Ray queries read it from a shader; there is no trace_rays pipeline path yet (that would need D3D12 state objects and a shader binding table).

    AccelStruct::destroy

    fn AccelStruct::destroy(self : AccelStruct) -> Unit

    AddressMode

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

    BackendKind

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

    BindGroup

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

    A reusable set of bindings. Recording the descriptor set once and replaying it per object removes the bind_uniform(pipeline, slot, ...) repetition that the flat CommandBuffer API forces on every draw.

    BindGroup::accel

    fn BindGroup::accel(self : BindGroup, pipeline : Pipeline, slot : Int, accel : AccelStruct) -> BindGroup

    BindGroup::is_empty

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

    BindGroup::len

    fn BindGroup::len(self : BindGroup) -> Int

    BindGroup::new

    fn BindGroup::new() -> BindGroup

    BindGroup::storage

    fn BindGroup::storage(self : BindGroup, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> BindGroup

    BindGroup::storage_image

    fn BindGroup::storage_image(self : BindGroup, pipeline : Pipeline, slot : Int, texture : Texture) -> BindGroup

    BindGroup::texture

    fn BindGroup::texture(self : BindGroup, pipeline : Pipeline, slot : Int, texture : Texture, sampler : Sampler) -> BindGroup

    BindGroup::uniform

    fn BindGroup::uniform(self : BindGroup, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> BindGroup

    BindlessHeap

    pub struct BindlessHeap {
    // private fields
    }

    BindlessHeap::destroy

    fn BindlessHeap::destroy(self : BindlessHeap) -> Unit

    BindlessHeap::register_texture

    fn BindlessHeap::register_texture(self : BindlessHeap, texture : Texture, sampler : Sampler) -> Int raise RhiError

    BindlessHeap::unregister_texture

    fn BindlessHeap::unregister_texture(self : BindlessHeap, index : Int) -> Unit

    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
    )

    Buffer

    pub struct Buffer {
    // private fields
    }

    Buffer::destroy

    fn Buffer::destroy(self : Buffer) -> Unit

    Buffer::download

    fn Buffer::download(self : Buffer) -> Bytes raise RhiError

    Buffer::size

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

    Buffer::upload_bytes

    fn Buffer::upload_bytes(self : Buffer, data : Bytes, offset? : Int, count? : Int) -> Unit raise RhiError

    Buffer::upload_floats

    fn Buffer::upload_floats(self : Buffer, data : FixedArray[Float], offset? : Int, count? : Int) -> Unit raise RhiError

    Buffer::upload_mat4

    fn Buffer::upload_mat4(self : Buffer, m :
    Mat4
    , offset? : Int) -> Unit raise RhiError

    Upload a column-major Mat4 (16 floats) at offset bytes.

    Provisional (ADR-002 §3.2): a completeness twin of upload_floats, covered by the equivalence test in examples/rhi/hardening; the shape may still change in a 0.x minor until it sees external use.

    Buffer::upload_uint16

    fn Buffer::upload_uint16(self : Buffer, data : FixedArray[UInt16], offset? : Int, count? : Int) -> Unit raise RhiError

    Buffer::upload_uint32

    fn Buffer::upload_uint32(self : Buffer, data : FixedArray[UInt], offset? : Int, count? : Int) -> Unit raise RhiError

    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

    CommandBuffer

    pub struct CommandBuffer {
    // private fields
    }

    CommandBuffer::barrier

    fn CommandBuffer::barrier(self : CommandBuffer) -> Unit

    CommandBuffer::begin_render_pass

    fn CommandBuffer::begin_render_pass(self : CommandBuffer, colors : Array[RenderTargetDesc], depth? : DepthTargetDesc) -> Unit raise RhiError

    CommandBuffer::begin_swapchain_pass

    fn CommandBuffer::begin_swapchain_pass(self : CommandBuffer, swapchain : Swapchain, load_op? : LoadOp, clear_color? : ClearColor) -> Unit

    CommandBuffer::bind_accel_struct

    fn CommandBuffer::bind_accel_struct(self : CommandBuffer, pipeline : Pipeline, slot : Int, accel : AccelStruct) -> Unit

    CommandBuffer::bind_bindless_heap

    fn CommandBuffer::bind_bindless_heap(self : CommandBuffer, pipeline : Pipeline, heap : BindlessHeap, set_index? : Int) -> Unit

    CommandBuffer::bind_group

    fn CommandBuffer::bind_group(self : CommandBuffer, group : BindGroup) -> Unit

    Replays every recorded binding in insertion order.

    CommandBuffer::bind_index

    fn CommandBuffer::bind_index(self : CommandBuffer, buffer : Buffer, index_type : IndexType, offset? : Int) -> Unit

    CommandBuffer::bind_pipeline

    fn CommandBuffer::bind_pipeline(self : CommandBuffer, pipeline : Pipeline) -> Unit

    CommandBuffer::bind_storage

    fn CommandBuffer::bind_storage(self : CommandBuffer, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> Unit

    CommandBuffer::bind_storage_image

    fn CommandBuffer::bind_storage_image(self : CommandBuffer, pipeline : Pipeline, slot : Int, texture : Texture) -> Unit

    CommandBuffer::bind_texture

    fn CommandBuffer::bind_texture(self : CommandBuffer, pipeline : Pipeline, slot : Int, texture : Texture, sampler : Sampler) -> Unit

    CommandBuffer::bind_uniform

    fn CommandBuffer::bind_uniform(self : CommandBuffer, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> Unit

    CommandBuffer::bind_vertex

    fn CommandBuffer::bind_vertex(self : CommandBuffer, slot : Int, buffer : Buffer, offset? : Int) -> Unit

    CommandBuffer::blit_texture

    fn CommandBuffer::blit_texture(self : CommandBuffer, src : Texture, dst : Texture, filter? : Filter) -> Unit

    CommandBuffer::blit_to_swapchain

    fn CommandBuffer::blit_to_swapchain(self : CommandBuffer, src : Texture, swapchain : Swapchain) -> Unit

    CommandBuffer::compute_pass

    fn CommandBuffer::compute_pass(self : CommandBuffer, encode : (ComputePass) -> Unit raise RhiError) -> Unit raise RhiError

    CommandBuffer::copy_buffer

    fn CommandBuffer::copy_buffer(self : CommandBuffer, src : Buffer, dst : Buffer, size : Int) -> Unit

    CommandBuffer::dispatch

    fn CommandBuffer::dispatch(self : CommandBuffer, x : Int, y : Int, z : Int) -> Unit

    CommandBuffer::dispatch_indirect

    fn CommandBuffer::dispatch_indirect(self : CommandBuffer, buffer : Buffer, offset? : Int) -> Unit

    CommandBuffer::draw

    fn CommandBuffer::draw(self : CommandBuffer, vertices : Int, instances : Int) -> Unit

    CommandBuffer::draw_indexed

    fn CommandBuffer::draw_indexed(self : CommandBuffer, index_count : Int, instances? : Int) -> Unit

    CommandBuffer::draw_indexed_full

    fn CommandBuffer::draw_indexed_full(self : CommandBuffer, index_count : Int, instances : Int, first_index : Int, vertex_offset : Int, first_instance : Int) -> Unit

    CommandBuffer::draw_indexed_indirect

    fn CommandBuffer::draw_indexed_indirect(self : CommandBuffer, buffer : Buffer, draw_count : Int, offset? : Int, stride? : Int) -> Unit

    CommandBuffer::draw_indexed_indirect_count

    fn CommandBuffer::draw_indexed_indirect_count(self : CommandBuffer, buffer : Buffer, count_buffer : Buffer, max_draw_count : Int, offset? : Int, count_offset? : Int, stride? : Int) -> Unit

    CommandBuffer::draw_indirect

    fn CommandBuffer::draw_indirect(self : CommandBuffer, buffer : Buffer, draw_count : Int, offset? : Int, stride? : Int) -> Unit

    CommandBuffer::draw_indirect_count

    fn CommandBuffer::draw_indirect_count(self : CommandBuffer, buffer : Buffer, count_buffer : Buffer, max_draw_count : Int, offset? : Int, count_offset? : Int, stride? : Int) -> Unit

    CommandBuffer::draw_instanced

    fn CommandBuffer::draw_instanced(self : CommandBuffer, vertices : Int, instances : Int, first_vertex : Int, first_instance : Int) -> Unit

    CommandBuffer::draw_mesh_tasks

    fn CommandBuffer::draw_mesh_tasks(self : CommandBuffer, x : Int, y : Int, z : Int) -> Unit

    CommandBuffer::draw_mesh_tasks_indirect

    fn CommandBuffer::draw_mesh_tasks_indirect(self : CommandBuffer, buffer : Buffer, draw_count : Int, offset? : Int, stride? : Int) -> Unit

    CommandBuffer::end_render_pass

    fn CommandBuffer::end_render_pass(self : CommandBuffer) -> Unit

    CommandBuffer::end_swapchain_pass

    fn CommandBuffer::end_swapchain_pass(self : CommandBuffer) -> Unit

    CommandBuffer::first_error

    fn CommandBuffer::first_error(self : CommandBuffer) -> String?

    The first recorded error, if any. end_commands raises it; callers can also inspect it when they only want to log.

    CommandBuffer::frame_slot

    fn CommandBuffer::frame_slot(self : CommandBuffer) -> Int

    CommandBuffer::push_constants_bytes

    fn CommandBuffer::push_constants_bytes(self : CommandBuffer, pipeline : Pipeline, data : Bytes, offset? : Int) -> Unit

    CommandBuffer::push_constants_floats

    fn CommandBuffer::push_constants_floats(self : CommandBuffer, pipeline : Pipeline, data : FixedArray[Float], offset? : Int) -> Unit

    CommandBuffer::push_constants_mat4

    fn CommandBuffer::push_constants_mat4(self : CommandBuffer, pipeline : Pipeline, m :
    Mat4
    , offset? : Int) -> Unit

    Push a column-major Mat4 as the 16 floats of a mat4 push constant.

    CommandBuffer::render_pass

    fn CommandBuffer::render_pass(self : CommandBuffer, colors : Array[RenderTargetDesc], depth? : DepthTargetDesc, draw : (RenderPass) -> Unit raise RhiError) -> Unit raise RhiError

    Records draw inside a begin_render_pass / end_render_pass pair.

    CommandBuffer::reset_timestamps

    fn CommandBuffer::reset_timestamps(self : CommandBuffer, pool : TimestampPool) -> Unit

    CommandBuffer::set_scissor

    fn CommandBuffer::set_scissor(self : CommandBuffer, x : Int, y : Int, w : Int, h : Int) -> Unit

    CommandBuffer::set_stencil_reference

    fn CommandBuffer::set_stencil_reference(self : CommandBuffer, reference : Int) -> Unit

    CommandBuffer::set_viewport

    fn CommandBuffer::set_viewport(self : CommandBuffer, x : Float, y : Float, w : Float, h : Float) -> Unit

    CommandBuffer::swapchain_pass

    fn CommandBuffer::swapchain_pass(self : CommandBuffer, swapchain : Swapchain, load_op? : LoadOp, clear_color? : ClearColor, draw : (RenderPass) -> Unit raise RhiError) -> Unit raise RhiError

    Records draw inside a begin_swapchain_pass / end_swapchain_pass pair, closing the pass even when the callback raises.

    CommandBuffer::transition_for_compute

    fn CommandBuffer::transition_for_compute(self : CommandBuffer, texture : Texture) -> Unit

    CommandBuffer::transition_for_sampling

    fn CommandBuffer::transition_for_sampling(self : CommandBuffer, texture : Texture) -> Unit

    CommandBuffer::write_timestamp

    fn CommandBuffer::write_timestamp(self : CommandBuffer, pool : TimestampPool, index : Int, at_start? : Bool) -> Unit

    CompareOp

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

    ComputePass

    pub struct ComputePass {
    // private fields
    }

    A scoped compute encoder. Compute has no begin/end on either backend, so the handle only narrows the API surface to compute-relevant calls.

    ComputePass::bind_bindless_heap

    fn ComputePass::bind_bindless_heap(self : ComputePass, pipeline : Pipeline, heap : BindlessHeap, set_index? : Int) -> Unit

    ComputePass::bind_group

    fn ComputePass::bind_group(self : ComputePass, group : BindGroup) -> Unit

    ComputePass::bind_pipeline

    fn ComputePass::bind_pipeline(self : ComputePass, pipeline : Pipeline) -> Unit

    ComputePass::bind_storage

    fn ComputePass::bind_storage(self : ComputePass, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> Unit

    ComputePass::bind_storage_image

    fn ComputePass::bind_storage_image(self : ComputePass, pipeline : Pipeline, slot : Int, texture : Texture) -> Unit

    ComputePass::bind_uniform

    fn ComputePass::bind_uniform(self : ComputePass, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> Unit

    ComputePass::dispatch

    fn ComputePass::dispatch(self : ComputePass, x : Int, y : Int, z : Int) -> Unit

    ComputePass::dispatch_indirect

    fn ComputePass::dispatch_indirect(self : ComputePass, buffer : Buffer, offset? : Int) -> Unit

    ComputePass::push_constants_bytes

    fn ComputePass::push_constants_bytes(self : ComputePass, pipeline : Pipeline, data : Bytes, offset? : Int) -> Unit

    ComputePass::push_constants_floats

    fn ComputePass::push_constants_floats(self : ComputePass, pipeline : Pipeline, data : FixedArray[Float], offset? : Int) -> Unit

    ComputePass::transition_for_compute

    fn ComputePass::transition_for_compute(self : ComputePass, texture : Texture) -> Unit

    ComputePass::write_timestamp

    fn ComputePass::write_timestamp(self : ComputePass, pool : TimestampPool, index : Int, at_start? : Bool) -> Unit

    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 : Texture
    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 : Texture, load_op? : LoadOp, store_op? : StoreOp, clear_depth? : Float, stencil_load_op? : LoadOp, stencil_store_op? : StoreOp, clear_stencil? : Int) -> DepthTargetDesc

    Device

    pub struct Device {
    // private fields
    }

    Device::allocator_stats

    fn Device::allocator_stats(self : Device) -> (Int, Int)

    Device::allocator_used_bytes

    fn Device::allocator_used_bytes(self : Device) -> UInt64

    Device::backend

    fn Device::backend(self : Device) -> BackendKind

    Device::begin_commands

    fn Device::begin_commands(self : Device) -> CommandBuffer raise RhiError

    Device::capabilities

    fn Device::capabilities(self : Device) -> DeviceCapabilities

    Device::create_bindless_heap

    fn Device::create_bindless_heap(self : Device, max_textures? : Int) -> BindlessHeap raise RhiError

    Device::create_blas

    fn Device::create_blas(self : Device, geometries : Array[RayGeometryDesc]) -> AccelStruct raise RhiError

    Device::create_buffer

    fn Device::create_buffer(self : Device, size : Int, kind : BufferKind) -> Buffer raise RhiError

    Device::create_buffer_usage

    fn Device::create_buffer_usage(self : Device, size : Int, usage : BufferUsage, location? : MemoryLocation) -> Buffer raise RhiError

    Allocate a buffer with composable usage flags. This is the entry point for combinations the single-role BufferKind cannot express, e.g. BufferUsage::storage().combine(BufferUsage::indirect()).

    Device::create_buffer_with

    fn Device::create_buffer_with(self : Device, size : Int, kind : BufferKind, location? : MemoryLocation) -> Buffer raise RhiError

    Device::create_compute_pipeline

    fn Device::create_compute_pipeline(self : Device, spv : FixedArray[UInt], uniform_slots : Int, storage_slots : Int, storage_image_slots? : Int, accel_slots? : Int, push_constant_size? : Int) -> Pipeline raise RhiError

    Device::create_compute_pipeline_auto

    fn Device::create_compute_pipeline_auto(self : Device, spv : FixedArray[UInt]) -> Pipeline raise RhiError

    Device::create_cubemap

    fn Device::create_cubemap(self : Device, size : Int, format : TextureFormat, faces : Array[Bytes]) -> Texture raise RhiError

    Device::create_cubemap_mipmapped

    fn Device::create_cubemap_mipmapped(self : Device, size : Int, format : TextureFormat, levels : Array[Array[Bytes]]) -> Texture raise RhiError

    Create a cubemap with an explicit, CPU-prefiltered mip chain. levels[m][f] is mip m face f (mip 0 is size x size).

    Device::create_depth_texture

    fn Device::create_depth_texture(self : Device, width : Int, height : Int, samples? : SampleCount) -> Texture raise RhiError

    Device::create_depth_texture_format

    fn Device::create_depth_texture_format(self : Device, width : Int, height : Int, format : TextureFormat, samples? : SampleCount) -> Texture raise RhiError

    Device::create_fence

    fn Device::create_fence(self : Device, signaled : Bool) -> Fence raise RhiError

    Device::create_graphics_pipeline

    fn Device::create_graphics_pipeline(self : Device, desc : PipelineDesc) -> Pipeline raise RhiError

    Device::create_mesh_pipeline

    fn Device::create_mesh_pipeline(self : Device, desc : MeshPipelineDesc) -> Pipeline raise RhiError

    Device::create_render_target

    fn Device::create_render_target(self : Device, width : Int, height : Int, format : TextureFormat, samples? : SampleCount) -> Texture raise RhiError

    Device::create_sampler

    fn Device::create_sampler(self : Device) -> Sampler raise RhiError

    Device::create_sampler_desc

    fn Device::create_sampler_desc(self : Device, desc : SamplerDesc) -> Sampler raise RhiError

    Device::create_storage_texture

    fn Device::create_storage_texture(self : Device, width : Int, height : Int, format : TextureFormat) -> Texture raise RhiError

    Device::create_swapchain

    fn Device::create_swapchain(self : Device, title : String, width : Int, height : Int) -> Swapchain raise RhiError

    Device::create_swapchain_desc

    fn Device::create_swapchain_desc(self : Device, desc : SwapchainDesc) -> Swapchain raise RhiError

    Device::create_texture

    fn Device::create_texture(self : Device, width : Int, height : Int, pixels : Bytes) -> Texture raise RhiError

    Device::create_texture_array

    fn Device::create_texture_array(self : Device, width : Int, height : Int, layers : Int, format : TextureFormat, pixels : Bytes) -> Texture raise RhiError

    Device::create_texture_desc

    fn Device::create_texture_desc(self : Device, desc : TextureDesc, data? : Bytes) -> Texture raise RhiError

    The single texture-creation entry point: shape, usage flags, format, mips and sample count come from one TextureDesc, instead of a factory per combination. The create_texture* helpers below are thin wrappers.

    Device::create_texture_format

    fn Device::create_texture_format(self : Device, width : Int, height : Int, format : TextureFormat, pixels : Bytes) -> Texture raise RhiError

    Device::create_texture_mipmapped

    fn Device::create_texture_mipmapped(self : Device, width : Int, height : Int, format : TextureFormat, pixels : Bytes) -> Texture raise RhiError

    Device::create_timestamp_pool

    fn Device::create_timestamp_pool(self : Device, count : Int) -> TimestampPool raise RhiError

    Device::create_tlas

    fn Device::create_tlas(self : Device, instances : Array[RayInstanceDesc]) -> AccelStruct raise RhiError

    Device::destroy

    fn Device::destroy(self : Device) -> Unit

    Device::end_commands

    fn Device::end_commands(self : Device, cmd : CommandBuffer) -> Unit raise RhiError

    Device::new

    fn Device::new(app_name : String, validation : Bool) -> Device raise RhiError

    Device::new_desc

    fn Device::new_desc(desc : DeviceDesc) -> Device raise RhiError

    Device::pipeline_cache_data

    fn Device::pipeline_cache_data(self : Device) -> Bytes

    Device::raytracing_tier

    fn Device::raytracing_tier(self : Device) -> Int

    Ray tracing capability: 0 = none, 1 = tier 1.0 / VK_KHR_ray_query. Ray queries are the only ray tracing path the RHI exposes so far, so a value of 1 means acceleration structures plus in-shader queries are usable.

    Device::submit_commands

    fn Device::submit_commands(self : Device, cmd : CommandBuffer, fence : Fence) -> Unit raise RhiError

    Device::validation_errors

    fn Device::validation_errors(self : Device) -> Int

    Device::wait_idle

    fn Device::wait_idle(self : Device) -> Unit

    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
    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

    Fence

    pub struct Fence {
    // private fields
    }

    Fence::destroy

    fn Fence::destroy(self : Fence) -> Unit

    Fence::reset

    fn Fence::reset(self : Fence) -> Unit

    Fence::wait

    fn Fence::wait(self : Fence) -> Unit

    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 : BindlessHeap?
    }

    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? : BindlessHeap) -> MeshPipelineDesc

    Pipeline

    pub struct Pipeline {
    // private fields
    }

    Pipeline::destroy

    fn Pipeline::destroy(self : Pipeline) -> Unit

    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
    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 : BindlessHeap?
    }

    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? : BindlessHeap) -> 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? : BindlessHeap) -> 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? : BindlessHeap) -> PipelineDesc

    PipelineDesc::raster_state

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

    The rasterisation half of a pipeline description.

    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 : Buffer
    vertex_count : Int
    vertex_stride : Int
    index_buffer : Buffer?
    index_count : Int
    index_type : IndexType
    is_opaque : Bool
    }

    RayGeometryDesc::new

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

    RayInstanceDesc

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

    RayInstanceDesc::from_affine3

    fn RayInstanceDesc::from_affine3(blas : AccelStruct, 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 : AccelStruct, transform? : FixedArray[Float], custom_index? : Int, mask? : Int) -> RayInstanceDesc

    RenderPass

    pub struct RenderPass {
    // private fields
    }

    A scoped render pass. Drawing goes through this handle instead of the raw CommandBuffer, and the pass is closed even when the closure raises, so a recording session cannot be left half-open.

    RenderPass::bind_accel_struct

    fn RenderPass::bind_accel_struct(self : RenderPass, pipeline : Pipeline, slot : Int, accel : AccelStruct) -> Unit

    RenderPass::bind_bindless_heap

    fn RenderPass::bind_bindless_heap(self : RenderPass, pipeline : Pipeline, heap : BindlessHeap, set_index? : Int) -> Unit

    RenderPass::bind_group

    fn RenderPass::bind_group(self : RenderPass, group : BindGroup) -> Unit

    RenderPass::bind_index

    fn RenderPass::bind_index(self : RenderPass, buffer : Buffer, index_type : IndexType, offset? : Int) -> Unit

    RenderPass::bind_pipeline

    fn RenderPass::bind_pipeline(self : RenderPass, pipeline : Pipeline) -> Unit

    RenderPass::bind_storage

    fn RenderPass::bind_storage(self : RenderPass, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> Unit

    RenderPass::bind_texture

    fn RenderPass::bind_texture(self : RenderPass, pipeline : Pipeline, slot : Int, texture : Texture, sampler : Sampler) -> Unit

    RenderPass::bind_uniform

    fn RenderPass::bind_uniform(self : RenderPass, pipeline : Pipeline, slot : Int, buffer : Buffer, offset? : Int, size? : Int) -> Unit

    RenderPass::bind_vertex

    fn RenderPass::bind_vertex(self : RenderPass, slot : Int, buffer : Buffer, offset? : Int) -> Unit

    RenderPass::draw

    fn RenderPass::draw(self : RenderPass, vertices : Int, instances : Int) -> Unit

    RenderPass::draw_indexed

    fn RenderPass::draw_indexed(self : RenderPass, index_count : Int, instances? : Int) -> Unit

    RenderPass::draw_indexed_full

    fn RenderPass::draw_indexed_full(self : RenderPass, index_count : Int, instances : Int, first_index : Int, vertex_offset : Int, first_instance : Int) -> Unit

    RenderPass::draw_indexed_indirect

    fn RenderPass::draw_indexed_indirect(self : RenderPass, buffer : Buffer, draw_count : Int, offset? : Int, stride? : Int) -> Unit

    RenderPass::draw_indexed_indirect_count

    fn RenderPass::draw_indexed_indirect_count(self : RenderPass, buffer : Buffer, count_buffer : Buffer, max_draw_count : Int, offset? : Int, count_offset? : Int, stride? : Int) -> Unit

    RenderPass::draw_indirect

    fn RenderPass::draw_indirect(self : RenderPass, buffer : Buffer, draw_count : Int, offset? : Int, stride? : Int) -> Unit

    RenderPass::draw_indirect_count

    fn RenderPass::draw_indirect_count(self : RenderPass, buffer : Buffer, count_buffer : Buffer, max_draw_count : Int, offset? : Int, count_offset? : Int, stride? : Int) -> Unit

    RenderPass::draw_instanced

    fn RenderPass::draw_instanced(self : RenderPass, vertices : Int, instances : Int, first_vertex : Int, first_instance : Int) -> Unit

    RenderPass::draw_mesh_tasks

    fn RenderPass::draw_mesh_tasks(self : RenderPass, x : Int, y : Int, z : Int) -> Unit

    RenderPass::push_constants_bytes

    fn RenderPass::push_constants_bytes(self : RenderPass, pipeline : Pipeline, data : Bytes, offset? : Int) -> Unit

    RenderPass::push_constants_floats

    fn RenderPass::push_constants_floats(self : RenderPass, pipeline : Pipeline, data : FixedArray[Float], offset? : Int) -> Unit

    RenderPass::push_constants_mat4

    fn RenderPass::push_constants_mat4(self : RenderPass, pipeline : Pipeline, value :
    Mat4
    ) -> Unit

    RenderPass::set_scissor

    fn RenderPass::set_scissor(self : RenderPass, x : Int, y : Int, w : Int, h : Int) -> Unit

    RenderPass::set_stencil_reference

    fn RenderPass::set_stencil_reference(self : RenderPass, reference : Int) -> Unit

    RenderPass::set_viewport

    fn RenderPass::set_viewport(self : RenderPass, x : Float, y : Float, w : Float, h : Float) -> Unit

    RenderPass::transition_for_sampling

    fn RenderPass::transition_for_sampling(self : RenderPass, texture : Texture) -> Unit

    RenderTargetDesc

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

    RenderTargetDesc::new

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

    SampleCount

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

    Sampler

    pub struct Sampler {
    // private fields
    }

    Sampler::destroy

    fn Sampler::destroy(self : Sampler) -> Unit

    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

    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
    )

    Swapchain

    pub struct Swapchain {
    // private fields
    }

    Swapchain::begin_frame

    fn Swapchain::begin_frame(self : Swapchain) -> CommandBuffer raise RhiError

    Swapchain::begin_frame_commands

    fn Swapchain::begin_frame_commands(self : Swapchain) -> CommandBuffer raise RhiError

    Swapchain::clipboard_text

    fn Swapchain::clipboard_text(self : Swapchain) -> String

    Swapchain::color_format

    fn Swapchain::color_format(self : Swapchain) -> TextureFormat

    Swapchain::content_scale

    fn Swapchain::content_scale(self : Swapchain) -> Double

    Swapchain::create_mesh_pipeline

    fn Swapchain::create_mesh_pipeline(self : Swapchain, desc : MeshPipelineDesc) -> Pipeline raise RhiError

    Swapchain::create_pipeline

    fn Swapchain::create_pipeline(self : Swapchain, vert_spv : FixedArray[UInt], frag_spv : FixedArray[UInt], uniform_slots : Int) -> Pipeline raise RhiError

    Swapchain::create_pipeline_desc

    fn Swapchain::create_pipeline_desc(self : Swapchain, desc : PipelineDesc) -> Pipeline raise RhiError

    Swapchain::depth_format

    fn Swapchain::depth_format(self : Swapchain) -> TextureFormat

    Swapchain::destroy

    fn Swapchain::destroy(self : Swapchain) -> Unit

    Swapchain::end_frame

    fn Swapchain::end_frame(self : Swapchain, cmd : CommandBuffer) -> Unit raise RhiError

    Swapchain::framebuffer_size

    fn Swapchain::framebuffer_size(self : Swapchain) -> (Int, Int)

    Swapchain::has_depth

    fn Swapchain::has_depth(self : Swapchain) -> Bool

    Swapchain::height

    fn Swapchain::height(self : Swapchain) -> Int

    Swapchain::is_fullscreen

    fn Swapchain::is_fullscreen(self : Swapchain) -> Bool

    Swapchain::is_mouse_down

    fn Swapchain::is_mouse_down(self : Swapchain, button :
    MouseButton
    ) -> Bool

    Swapchain::mouse_pos

    fn Swapchain::mouse_pos(self : Swapchain) -> (Double, Double)

    Swapchain::poll_events

    Swapchain::present_texture

    fn Swapchain::present_texture(self : Swapchain, src : Texture) -> Unit raise RhiError

    Swapchain::readback

    fn Swapchain::readback(self : Swapchain) -> FixedArray[Byte]

    Swapchain::set_clipboard_text

    fn Swapchain::set_clipboard_text(self : Swapchain, text : String) -> Unit

    Swapchain::set_cursor_mode

    fn Swapchain::set_cursor_mode(self : Swapchain, mode :
    CursorMode
    ) -> Unit

    Swapchain::set_cursor_shape

    fn Swapchain::set_cursor_shape(self : Swapchain, shape :
    CursorShape
    ) -> Unit

    Swapchain::set_fullscreen

    fn Swapchain::set_fullscreen(self : Swapchain, fullscreen : Bool) -> Unit

    Swapchain::set_title

    fn Swapchain::set_title(self : Swapchain, title : String) -> Unit

    Swapchain::should_close

    fn Swapchain::should_close(self : Swapchain) -> Bool

    Swapchain::sync_size

    fn Swapchain::sync_size(self : Swapchain) -> Unit raise RhiError

    Swapchain::time

    fn Swapchain::time() -> Double

    Swapchain::wait_events

    fn Swapchain::wait_events(timeout_ms? : Int) -> Unit

    Swapchain::width

    fn Swapchain::width(self : Swapchain) -> Int

    Swapchain::window

    The window this swapchain presents to, as a typed @win.Window so callers never handle the raw platform pointer.

    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
    }

    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) -> SwapchainDesc

    Texture

    pub struct Texture {
    // private fields
    }

    Texture::destroy

    fn Texture::destroy(self : Texture) -> Unit

    Texture::format

    fn Texture::format(self : Texture) -> TextureFormat

    Texture::height

    fn Texture::height(self : Texture) -> Int

    Texture::layers

    fn Texture::layers(self : Texture) -> Int

    Texture::mip_levels

    fn Texture::mip_levels(self : Texture) -> Int

    Texture::readback

    fn Texture::readback(self : Texture) -> FixedArray[Byte] raise RhiError

    Texture::readback_mip

    fn Texture::readback_mip(self : Texture, level : Int) -> FixedArray[Byte] raise RhiError

    Texture::upload_subregion

    fn Texture::upload_subregion(self : Texture, x : Int, y : Int, width : Int, height : Int, pixels : Bytes, layer? : Int, mip_level? : Int) -> Unit raise RhiError

    Texture::upload_subregions

    fn Texture::upload_subregions(self : Texture, regions : Array[(Int, Int, Int, Int, Bytes)]) -> Unit raise RhiError

    Texture::width

    fn Texture::width(self : Texture) -> Int

    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

    TimestampPool

    pub struct TimestampPool {
    // private fields
    }

    GPU timestamps. On DX12 the queries are resolved by end_commands, which is the only point where every write is recorded and the copy still reaches the GPU, so reading is valid as soon as the submission returns.

    TimestampPool::destroy

    fn TimestampPool::destroy(self : TimestampPool) -> Unit

    TimestampPool::elapsed_ms

    fn TimestampPool::elapsed_ms(self : TimestampPool, start_idx : Int, end_idx : Int) -> Double raise RhiError

    TimestampPool::resolve_ns

    fn TimestampPool::resolve_ns(self : TimestampPool) -> FixedArray[Double] raise RhiError

    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
    )

    compile_glsl

    fn compile_glsl(path : String, stage :
    ShaderStage
    ) -> FixedArray[UInt]

    compile_glsl_source

    fn compile_glsl_source(source : String, stage :
    ShaderStage
    ) -> FixedArray[UInt]

    compile_slang

    fn compile_slang(path : String, entry : String) -> FixedArray[UInt]

    dx12_available

    fn dx12_available() -> Bool

    Whether the DX12 backend can be created on this host (d3d12.dll / dxgi.dll loadable). Callers use this to SKIP instead of failing on non-Windows hosts.

    load_spirv

    fn load_spirv(path : String) -> FixedArray[UInt]

    load_spirv_checked

    fn load_spirv_checked(path : String) -> FixedArray[UInt] raise
    ShaderError

    Load a .spv file, raising ShaderError::LoadFailed when it is missing or holds no code.

    reflect_spirv

    fn reflect_spirv(spv : FixedArray[UInt]) ->
    SpirvReflection