tycho

    Tycho RHI — unified pure-MoonBit render hardware interface (Vulkan 1.3 dynamic rendering + sub-allocator; Metal/DX12 planned)

    graphics
    rhi
    vulkan
    gpu
    tycho
    Download zip
    Version
    0.6.0
    License
    Apache-2.0
    Last updated
    2 hours ago
    Downloads
    10

    #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

    Link flags are not transitive in MoonBit: the final executable must declare them itself. Add this to the moon.pkg of your executable package:

    // moon.pkg
    options(
    "link": {
    "native": {
    "cc": "cc",
    "cc-link-flags": "-lvulkan -lX11", // -lX11 only needed for windowing/WSI
    },
    },
    )

    Requirements: a Vulkan 1.3 loader + driver (libvulkan-dev, libx11-dev on Debian/Ubuntu). No Vulkan SDK, -I, or env var is needed at build time.

    #Features (Vulkan 1.3 Backend)

    • Backend-opaque handles: Device, Swapchain, Pipeline, Buffer, Texture, Sampler, CommandBuffer, Fence, TimestampPool
    • Vulkan 1.3 Dynamic Rendering + Synchronization2, 2 frames-in-flight, and automatic swapchain recreation on resize / OUT_OF_DATE
    • Pure-MoonBit free-list GPU memory sub-allocator (RegionPool / SubAllocator) with persistent mapping for host-visible buffers and separated buffer/image blocks
    • SPIR-V Auto-Reflection: PipelineDesc::from_spirv and Device::create_compute_pipeline_auto derive vertex layouts, descriptor bindings, push constant ranges, and MRT attachment counts directly from SPIR-V bytecode
    • Multiple Render Targets (MRT), 4x MSAA Offscreen Resolve, Hardware Mipmap Generation (create_texture_mipmapped, readback_mip, sampler LOD control), Compute Storage Images (create_storage_texture, bind_storage_image), and GPU Timestamp Queries (TimestampPool)

    CursorMode

    ReflectedBinding

    ReflectedDescriptorKind

    ReflectedStage

    ReflectedVertexFormat

    ReflectedVertexInput

    SpirvReflection

    RhiError

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

    impl Show for RhiError

    AddressMode

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

    BackendKind

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

    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

    BlendMode

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

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

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

    Buffer::upload_floats

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

    Buffer::upload_uint16

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

    Buffer::upload_uint32

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

    BufferKind

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

    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

    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_bindless_heap

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

    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) -> 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) -> 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::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_indirect

    fn CommandBuffer::draw_indirect(self : CommandBuffer, buffer : Buffer, draw_count : Int, 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::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::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_viewport

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

    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
    )

    CullMode

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

    DepthTargetDesc

    pub(all) struct DepthTargetDesc {
    texture : Texture
    load_op : LoadOp
    store_op : StoreOp
    clear_depth : Float
    }

    DepthTargetDesc::new

    fn DepthTargetDesc::new(texture : Texture, load_op? : LoadOp, store_op? : StoreOp, clear_depth? : Float) -> 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_buffer

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

    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, 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_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_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::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::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
    }

    DeviceDesc::new

    fn DeviceDesc::new(app_name : String, validation? : Bool, headless? : Bool, pipeline_cache? : Bytes) -> 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
    depth_test : Bool
    depth_write : Bool
    depth_compare : CompareOp
    depth_format : TextureFormat?
    cull_mode : CullMode
    front_face : FrontFace
    blend : Bool
    blend_mode : BlendMode?
    samples : SampleCount
    color_format : TextureFormat?
    color_formats : Array[TextureFormat]
    bindless_heap : BindlessHeap?
    }

    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?, 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
    uniform_bindings : Array[Int]
    texture_bindings : Array[Int]
    storage_bindings : Array[Int]
    storage_image_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
    cull_mode : CullMode
    front_face : FrontFace
    blend : Bool
    blend_mode : BlendMode?
    samples : SampleCount
    color_format : TextureFormat?
    color_formats : Array[TextureFormat]
    bindless_heap : BindlessHeap?
    }

    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, cull_mode? : CullMode, front_face? : FrontFace, blend? : Bool, blend_mode? : BlendMode?, samples? : SampleCount, color_format? : TextureFormat?, color_formats? : Array[TextureFormat], vertex_layouts? : Array[VertexBufferLayout], bindless_heap? : BindlessHeap?) -> PipelineDesc

    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, uniform_bindings? : Array[Int], texture_bindings? : Array[Int], storage_bindings? : Array[Int], storage_image_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, cull_mode? : CullMode, front_face? : FrontFace, blend? : Bool, blend_mode? : BlendMode?, samples? : SampleCount, color_format? : TextureFormat?, color_formats? : Array[TextureFormat], bindless_heap? : BindlessHeap?) -> PipelineDesc

    PresentMode

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

    PrimitiveTopology

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

    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

    ShaderStage

    pub(all) enum ShaderStage {
    Vertex
    Fragment
    Compute
    Task
    Mesh
    } derive(Eq,
    Debug
    )

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

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

    Swapchain::end_frame

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

    Swapchain::height

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

    Swapchain::is_fullscreen

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

    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_cursor_mode

    fn Swapchain::set_cursor_mode(self : Swapchain, mode :
    CursorMode
    ) -> 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::time

    fn Swapchain::time() -> Double

    Swapchain::width

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

    SwapchainDesc

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

    SwapchainDesc::new

    fn SwapchainDesc::new(title : String, width : Int, height : Int, depth? : Bool, 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::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::width

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

    TextureFormat

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

    TimestampPool

    pub struct TimestampPool {
    // private fields
    }

    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
    } derive(Eq,
    Debug
    )

    VertexStepMode

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

    KEY_0

    let KEY_0 : Int

    KEY_1

    let KEY_1 : Int

    KEY_2

    let KEY_2 : Int

    KEY_3

    let KEY_3 : Int

    KEY_4

    let KEY_4 : Int

    KEY_5

    let KEY_5 : Int

    KEY_6

    let KEY_6 : Int

    KEY_7

    let KEY_7 : Int

    KEY_8

    let KEY_8 : Int

    KEY_9

    let KEY_9 : Int

    KEY_A

    let KEY_A : Int

    KEY_B

    let KEY_B : Int

    KEY_BACKSPACE

    let KEY_BACKSPACE : Int

    KEY_C

    let KEY_C : Int

    KEY_D

    let KEY_D : Int

    KEY_DOWN

    let KEY_DOWN : Int

    KEY_E

    let KEY_E : Int

    KEY_ESCAPE

    let KEY_ESCAPE : Int

    KEY_F

    let KEY_F : Int

    KEY_F1

    let KEY_F1 : Int

    KEY_F10

    let KEY_F10 : Int

    KEY_F11

    let KEY_F11 : Int

    KEY_F12

    let KEY_F12 : Int

    KEY_F2

    let KEY_F2 : Int

    KEY_F3

    let KEY_F3 : Int

    KEY_F4

    let KEY_F4 : Int

    KEY_F5

    let KEY_F5 : Int

    KEY_F6

    let KEY_F6 : Int

    KEY_F7

    let KEY_F7 : Int

    KEY_F8

    let KEY_F8 : Int

    KEY_F9

    let KEY_F9 : Int

    KEY_G

    let KEY_G : Int

    KEY_H

    let KEY_H : Int

    KEY_I

    let KEY_I : Int

    KEY_J

    let KEY_J : Int

    KEY_K

    let KEY_K : Int

    KEY_L

    let KEY_L : Int

    KEY_LALT

    let KEY_LALT : Int

    KEY_LCTRL

    let KEY_LCTRL : Int

    KEY_LEFT

    let KEY_LEFT : Int

    KEY_LSHIFT

    let KEY_LSHIFT : Int

    KEY_M

    let KEY_M : Int

    KEY_N

    let KEY_N : Int

    KEY_O

    let KEY_O : Int

    KEY_P

    let KEY_P : Int

    KEY_Q

    let KEY_Q : Int

    KEY_R

    let KEY_R : Int

    KEY_RALT

    let KEY_RALT : Int

    KEY_RCTRL

    let KEY_RCTRL : Int

    KEY_RETURN

    let KEY_RETURN : Int

    KEY_RIGHT

    let KEY_RIGHT : Int

    KEY_RSHIFT

    let KEY_RSHIFT : Int

    KEY_S

    let KEY_S : Int

    KEY_SPACE

    let KEY_SPACE : Int

    KEY_T

    let KEY_T : Int

    KEY_TAB

    let KEY_TAB : Int

    KEY_U

    let KEY_U : Int

    KEY_UP

    let KEY_UP : Int

    KEY_V

    let KEY_V : Int

    KEY_W

    let KEY_W : Int

    KEY_X

    let KEY_X : Int

    KEY_Y

    let KEY_Y : Int

    KEY_Z

    let KEY_Z : Int

    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]

    load_hdr_image

    fn load_hdr_image(path : String) -> (FixedArray[Float], Int, Int)

    load_image

    fn load_image(path : String) -> (FixedArray[Byte], Int, Int)

    load_spirv

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

    read_file_bytes

    fn read_file_bytes(path : String) -> Bytes

    reflect_spirv

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

    save_png

    fn save_png(path : String, width : Int, height : Int, rgba : FixedArray[Byte], bgra? : Bool) -> Bool

    screenshot_path

    fn screenshot_path() -> String

    want_window

    fn want_window() -> Bool