XU XUv0.13.1
中文

#gpu

import: #gpu

counts: 11 functions, 92 methods, 35 types, 74 constants, 0 method sets

GPU device and buffer transfer

#gpu provides low-level device, buffer, texture, and command recording abstractions in the Xu standard library. It supports windowless devices, buffers, 2D textures and mips, samplers, shaders, graphics and compute pipelines, command encoders, fence synchronization, and byte readback.

All GPU resources support explicit idempotent close and automatic drop. Keep devices, resources, and borrows on the main thread; texture formats and layout rules are defined in gpu/layout.

@main
#gpu

fn main() {
    $device := gpu.open(gpu.DeviceOptions{backend: gpu.AUTO, debug: false, shader_formats: 0}) or {
        println("GPU backend unavailable")
        return
    }
    $buffer := device.buffer(4, gpu.BUFFER_VERTEX) or >>
    input := [u8(0), u8(127), u8(128), u8(255)]
    device.upload(&buffer, 0, &input) or >>
    $result := device.download(&buffer, 0, 4) or >>
    result.wait() or >>
    $output := [u8(0), u8(0), u8(0), u8(0)]
    result.read($&output) or >>
    println("downloaded byte:", output[3])
}

Expected output: downloaded byte: 255.

const AUTO

XuAPI
pub const AUTO = 0

Purpose

Constant AUTO, defining protocol or algorithm parameters.

const METAL

XuAPI
pub const METAL = 1

Purpose

Constant METAL, defining protocol or algorithm parameters.

const VULKAN

XuAPI
pub const VULKAN = 2

Purpose

Constant VULKAN, defining protocol or algorithm parameters.

const D3D12

XuAPI
pub const D3D12 = 3

Purpose

Constant D3D12, defining protocol or algorithm parameters.

const SHADER_SPIRV

XuAPI
pub const SHADER_SPIRV = 1

Purpose

Constant SHADER_SPIRV, defining protocol or algorithm parameters.

const SHADER_DXBC

XuAPI
pub const SHADER_DXBC = 2

Purpose

Constant SHADER_DXBC, defining protocol or algorithm parameters.

const SHADER_DXIL

XuAPI
pub const SHADER_DXIL = 4

Purpose

Constant SHADER_DXIL, defining protocol or algorithm parameters.

const SHADER_MSL

XuAPI
pub const SHADER_MSL = 8

Purpose

Constant SHADER_MSL, defining protocol or algorithm parameters.

const SHADER_METALLIB

XuAPI
pub const SHADER_METALLIB = 16

Purpose

Constant SHADER_METALLIB, defining protocol or algorithm parameters.

const BUFFER_VERTEX

XuAPI
pub const BUFFER_VERTEX = 1

Purpose

Constant BUFFER_VERTEX, defining protocol or algorithm parameters.

const BUFFER_INDEX

XuAPI
pub const BUFFER_INDEX = 2

Purpose

Constant BUFFER_INDEX, defining protocol or algorithm parameters.

const BUFFER_INDIRECT

XuAPI
pub const BUFFER_INDIRECT = 4

Purpose

Constant BUFFER_INDIRECT, defining protocol or algorithm parameters.

const BUFFER_GRAPHICS_STORAGE_READ

XuAPI
pub const BUFFER_GRAPHICS_STORAGE_READ = 8

Purpose

Constant BUFFER_GRAPHICS_STORAGE_READ, defining protocol or algorithm parameters.

const BUFFER_COMPUTE_STORAGE_READ

XuAPI
pub const BUFFER_COMPUTE_STORAGE_READ = 16

Purpose

Constant BUFFER_COMPUTE_STORAGE_READ, defining protocol or algorithm parameters.

const BUFFER_COMPUTE_STORAGE_WRITE

XuAPI
pub const BUFFER_COMPUTE_STORAGE_WRITE = 32

Purpose

Constant BUFFER_COMPUTE_STORAGE_WRITE, defining protocol or algorithm parameters.

const TRANSFER_ALIGNMENT

XuAPI
pub const TRANSFER_ALIGNMENT = 4

Purpose

Constant TRANSFER_ALIGNMENT, defining protocol or algorithm parameters.

struct DeviceOptions

XuAPI
pub struct DeviceOptions {
    pub backend int
    pub debug bool
    pub shader_formats int
}

Purpose

Gpu Configuration parameters and options set.

Public fields

backend int
field (int)
debug bool
field (bool)
shader_formats int
Zero permits all known formats; the selected device reports its subset.

struct Device

XuAPI
pub struct Device {

}

Purpose

Owning, main-thread resources. Device.close invalidates all children. IDs are private and never reused by the backend during the process lifetime.

Public fields

This type has no public fields.

struct Buffer

XuAPI
pub struct Buffer {

}

Purpose

Buffer context or state structure.

Public fields

This type has no public fields.

struct Fence

XuAPI
pub struct Fence {

}

Purpose

Fence context or state structure.

Public fields

This type has no public fields.

struct Readback

XuAPI
pub struct Readback {

}

Purpose

Readback context or state structure.

Public fields

This type has no public fields.

struct Stats

XuAPI
pub struct Stats {
    pub buffer_count int
    pub buffer_bytes int
    pub submission_count int
    pub staging_bytes int
    pub texture_count int
    pub texture_bytes int
    pub sampler_count int
    pub shader_count int
    pub pipeline_count int
    pub encoder_count int
    pub render_pass_count int
    pub compute_pipeline_count int
    pub compute_pass_count int
    pub surface_count int
    pub frame_count int
}

Purpose

Logical requested bytes and live ownership counts, not driver allocations.

Public fields

buffer_count int
field (int)
buffer_bytes int
field (int)
submission_count int
field (int)
staging_bytes int
field (int)
texture_count int
field (int)
texture_bytes int
field (int)
sampler_count int
field (int)
shader_count int
field (int)
pipeline_count int
field (int)
encoder_count int
field (int)
render_pass_count int
field (int)
compute_pipeline_count int
field (int)
compute_pass_count int
field (int)
surface_count int
field (int)
frame_count int
field (int)

is_available

XuAPI
pub fn is_available(options DeviceOptions) bool

Purpose

Probes whether a device can be opened for the given options without retaining it.

Parameters

options DeviceOptions
options (DeviceOptions)

Returns

bool — true or false

open

XuAPI
pub fn open(options DeviceOptions) Device

Purpose

Open resource or establish connection. Throws on failure; handle the error or propagate it to the caller.

Parameters

options DeviceOptions
options (DeviceOptions)

Returns

Device — a value of this type

(&Device) backend

XuAPI
pub fn (device &Device) backend() int

Purpose

Execute backend on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).

Returns

int — a value of this type

(&Device) shader_formats

XuAPI
pub fn (device &Device) shader_formats() int

Purpose

Operation on &Device: shader formats. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).

Returns

int — a value of this type

(&Device) stats

XuAPI
pub fn (device &Device) stats() Stats

Purpose

Execute stats on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).

Returns

Stats — a value of this type

(&Device) buffer

XuAPI
pub fn (device &Device) buffer(size_bytes int, usage int) Buffer

Purpose

Execute buffer on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
size_bytes int
size_bytes (int)
usage int
usage text (int)

Returns

Buffer — a value of this type

(&Buffer) size_bytes

XuAPI
pub fn (buffer &Buffer) size_bytes() int

Purpose

Operation on &Buffer: size bytes.

Parameters

buffer &Buffer
The Buffer instance used by this call (borrow).

Returns

int — a value of this type

(&Device) upload

XuAPI
pub fn (device &Device) upload(buffer &Buffer, offset int, bytes &[]u8) Fence

Purpose

Each transfer is submitted before returning. Upload copies the borrowed bytes to owned staging synchronously; no Xu pointer survives the call. Fence.close releases ownership without waiting; SDL defers in-flight frees. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
buffer &Buffer
buffer (read-only borrow; caller keeps the original; type &Buffer)
offset int
offset (int)
bytes &[]u8
bytes (read-only borrow; caller keeps the original; type &[]u8)

Returns

Fence — a value of this type

(&Device) copy

XuAPI
pub fn (device &Device) copy(source &Buffer, source_offset int, destination &Buffer, destination_offset int, size_bytes int) Fence

Purpose

Execute copy on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
source &Buffer
source (read-only borrow; caller keeps the original; type &Buffer)
source_offset int
source_offset (int)
destination &Buffer
destination (read-only borrow; caller keeps the original; type &Buffer)
destination_offset int
destination_offset (int)
size_bytes int
size_bytes (int)

Returns

Fence — a value of this type

(&Device) download

XuAPI
pub fn (device &Device) download(buffer &Buffer, offset int, size_bytes int) Readback

Purpose

Execute download on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
buffer &Buffer
buffer (read-only borrow; caller keeps the original; type &Buffer)
offset int
offset (int)
size_bytes int
size_bytes (int)

Returns

Readback — a value of this type

(&Fence) ready

XuAPI
pub fn (fence &Fence) ready() bool

Purpose

Execute ready on &Fence. Throws on failure; handle the error or propagate it to the caller.

Parameters

fence &Fence
The Fence instance used by this call (borrow).

Returns

bool — true or false

(&Fence) wait

XuAPI
pub fn (fence &Fence) wait() int

Purpose

Execute wait on &Fence. Throws on failure; handle the error or propagate it to the caller.

Parameters

fence &Fence
The Fence instance used by this call (borrow).

Returns

int — a value of this type

(&Readback) ready

XuAPI
pub fn (readback &Readback) ready() bool

Purpose

Execute ready on &Readback. Throws on failure; handle the error or propagate it to the caller.

Parameters

readback &Readback
The Readback instance used by this call (borrow).

Returns

bool — true or false

(&Readback) wait

XuAPI
pub fn (readback &Readback) wait() int

Purpose

Execute wait on &Readback. Throws on failure; handle the error or propagate it to the caller.

Parameters

readback &Readback
The Readback instance used by this call (borrow).

Returns

int — a value of this type

(&Readback) size_bytes

XuAPI
pub fn (readback &Readback) size_bytes() int

Purpose

Operation on &Readback: size bytes.

Parameters

readback &Readback
The Readback instance used by this call (borrow).

Returns

int — a value of this type

(&Readback) read

XuAPI
pub fn (readback &Readback) read(output $&[]u8) int

Purpose

Requires a completed submission and an exact-size destination. Failure leaves the byte array untouched. Waiting is explicit and may block. Throws on failure; handle the error or propagate it to the caller.

Parameters

readback &Readback
The Readback instance used by this call (borrow).
output $&[]u8
output (exclusive borrow; may modify the original; type $&[]u8)

Returns

int — a value of this type

($&Device) close

XuAPI
pub fn (device $&Device) close() int

Purpose

Operation on $&Device: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

device $&Device
The Device instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Buffer) close

XuAPI
pub fn (buffer $&Buffer) close() int

Purpose

Operation on $&Buffer: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

buffer $&Buffer
The Buffer instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Fence) close

XuAPI
pub fn (fence $&Fence) close() int

Purpose

Operation on $&Fence: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

fence $&Fence
The Fence instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Readback) close

XuAPI
pub fn (readback $&Readback) close() int

Purpose

Operation on $&Readback: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

readback $&Readback
The Readback instance used by this call (exclusive borrow).

Returns

int — a value of this type

const LOAD

XuAPI
pub const LOAD = 0

Purpose

Constant LOAD, defining protocol or algorithm parameters.

const CLEAR

XuAPI
pub const CLEAR = 1

Purpose

Constant CLEAR, defining protocol or algorithm parameters.

const DISCARD

XuAPI
pub const DISCARD = 2

Purpose

Constant DISCARD, defining protocol or algorithm parameters.

const STORE

XuAPI
pub const STORE = 0

Purpose

Constant STORE, defining protocol or algorithm parameters.

const DONT_STORE

XuAPI
pub const DONT_STORE = 1

Purpose

Constant DONT_STORE, defining protocol or algorithm parameters.

const INDEX16

XuAPI
pub const INDEX16 = 2

Purpose

Constant INDEX16, defining protocol or algorithm parameters.

const INDEX32

XuAPI
pub const INDEX32 = 4

Purpose

Constant INDEX32, defining protocol or algorithm parameters.

struct Color

XuAPI
pub struct Color {
    pub r f64
    pub g f64
    pub b f64
    pub a f64
}

Purpose

Structure encapsulating r, g, b, a.

Public fields

r f64
rune (Unicode code point)
g f64
field (f64)
b f64
field (f64)
a f64
field (f64)

struct ColorAttachment

XuAPI
pub struct ColorAttachment {
    pub view TextureSlice
    pub load int
    pub store int
    pub clear Color
}

Purpose

Structure encapsulating view, load, store, clear.

Public fields

view TextureSlice
field (TextureSlice)
load int
field (int)
store int
field (int)
clear Color
field (Color)

struct DepthAttachment

XuAPI
pub struct DepthAttachment {

}

Purpose

DepthAttachment context or state structure.

Public fields

This type has no public fields.

no_depth

XuAPI
pub fn no_depth() DepthAttachment

Purpose

No depth.

Parameters

No arguments are required.

Returns

DepthAttachment — a value of this type

depth_attachment

XuAPI
pub fn depth_attachment(texture &Texture, load int, store int, clear f64) DepthAttachment

Purpose

Depth attachment uses mip zero; its extent must match the color view.

Parameters

texture &Texture
texture (read-only borrow; caller keeps the original; type &Texture)
load int
load (int)
store int
store (int)
clear f64
clear (f64)

Returns

DepthAttachment — a value of this type

struct CommandEncoder

XuAPI
pub struct CommandEncoder {

}

Purpose

CommandEncoder context or state structure.

Public fields

This type has no public fields.

struct RenderPass

XuAPI
pub struct RenderPass {

}

Purpose

RenderPass context or state structure.

Public fields

This type has no public fields.

(&Device) command_encoder

XuAPI
pub fn (device &Device) command_encoder() CommandEncoder

Purpose

Operation on &Device: command encoder. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).

Returns

CommandEncoder — a value of this type

(&CommandEncoder) begin_render

XuAPI
pub fn (encoder &CommandEncoder) begin_render(color ColorAttachment, depth DepthAttachment) RenderPass

Purpose

Operation on &CommandEncoder: begin render. Throws on failure; handle the error or propagate it to the caller.

Parameters

encoder &CommandEncoder
The CommandEncoder instance used by this call (borrow).
color ColorAttachment
color (ColorAttachment)
depth DepthAttachment
depth (DepthAttachment)

Returns

RenderPass — a value of this type

($&CommandEncoder) submit

XuAPI
pub fn (encoder $&CommandEncoder) submit() Fence

Purpose

Submit requires all passes ended. Success consumes the native encoder failure may also consume it, so close/drop is idempotent on stale IDs. Throws on failure; handle the error or propagate it to the caller.

Parameters

encoder $&CommandEncoder
The CommandEncoder instance used by this call (exclusive borrow).

Returns

Fence — a value of this type

(&RenderPass) pipeline

XuAPI
pub fn (pass &RenderPass) pipeline(pipeline &GraphicsPipeline) int

Purpose

Execute pipeline on &RenderPass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
pipeline &GraphicsPipeline
pipeline (read-only borrow; caller keeps the original; type &GraphicsPipeline)

Returns

int — a value of this type

(&RenderPass) vertex_buffer

XuAPI
pub fn (pass &RenderPass) vertex_buffer(slot int, buffer &Buffer, offset int) int

Purpose

Set the pipeline before bindings; a pipeline change resets required bindings. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
slot int
slot (int)
buffer &Buffer
buffer (read-only borrow; caller keeps the original; type &Buffer)
offset int
offset (int)

Returns

int — a value of this type

(&RenderPass) index_buffer

XuAPI
pub fn (pass &RenderPass) index_buffer(buffer &Buffer, offset int, element_size int) int

Purpose

Operation on &RenderPass: index buffer. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
buffer &Buffer
buffer (read-only borrow; caller keeps the original; type &Buffer)
offset int
offset (int)
element_size int
element_size (int)

Returns

int — index; see the description for its range and special values

(&RenderPass) sampler

XuAPI
pub fn (pass &RenderPass) sampler(stage int, slot int, texture &Texture, sampler &Sampler) int

Purpose

Execute sampler on &RenderPass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
stage int
stage (int)
slot int
slot (int)
texture &Texture
texture (read-only borrow; caller keeps the original; type &Texture)
sampler &Sampler
sampler (read-only borrow; caller keeps the original; type &Sampler)

Returns

int — a value of this type

(&RenderPass) uniform

XuAPI
pub fn (pass &RenderPass) uniform(stage int, slot int, bytes &[]u8) int

Purpose

Execute uniform on &RenderPass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
stage int
stage (int)
slot int
slot (int)
bytes &[]u8
bytes (read-only borrow; caller keeps the original; type &[]u8)

Returns

int — a value of this type

(&RenderPass) viewport

XuAPI
pub fn (pass &RenderPass) viewport(x int, y int, width int, height int) int

Purpose

Execute viewport on &RenderPass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
x int
value (int)
y int
value (int)
width int
width (int)
height int
height (int)

Returns

int — a value of this type

(&RenderPass) scissor

XuAPI
pub fn (pass &RenderPass) scissor(x int, y int, width int, height int) int

Purpose

Execute scissor on &RenderPass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
x int
value (int)
y int
value (int)
width int
width (int)
height int
height (int)

Returns

int — a value of this type

(&RenderPass) draw

XuAPI
pub fn (pass &RenderPass) draw(vertex_count int, first_vertex int, instance_count int, first_instance int) int

Purpose

Execute draw on &RenderPass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
vertex_count int
vertex_count (int)
first_vertex int
first_vertex (int)
instance_count int
instance_count (int)
first_instance int
first_instance (int)

Returns

int — a value of this type

(&RenderPass) draw_indexed

XuAPI
pub fn (pass &RenderPass) draw_indexed(index_count int, first_index int, vertex_offset int, instance_count int, first_instance int) int

Purpose

Index values and shader accesses must address valid vertex/storage data. The API checks the index-byte range without reading GPU buffers on the CPU. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
index_count int
index_count (int)
first_index int
first_index (int)
vertex_offset int
vertex_offset (int)
instance_count int
instance_count (int)
first_instance int
first_instance (int)

Returns

int — index; see the description for its range and special values

($&RenderPass) end

XuAPI
pub fn (pass $&RenderPass) end() int

Purpose

Execute end on $&RenderPass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass $&RenderPass
The RenderPass instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&CommandEncoder) close

XuAPI
pub fn (encoder $&CommandEncoder) close() int

Purpose

Cancel closes an active pass, discards recorded commands and frees references. Throws on failure; handle the error or propagate it to the caller.

Parameters

encoder $&CommandEncoder
The CommandEncoder instance used by this call (exclusive borrow).

Returns

int — a value of this type

const MAX_COMPUTE_STORAGE_BUFFERS

XuAPI
pub const MAX_COMPUTE_STORAGE_BUFFERS = 8

Purpose

Constant MAX_COMPUTE_STORAGE_BUFFERS, defining protocol or algorithm parameters.

const MAX_COMPUTE_THREADS

XuAPI
pub const MAX_COMPUTE_THREADS = 1024

Purpose

Constant MAX_COMPUTE_THREADS, defining protocol or algorithm parameters.

const MAX_COMPUTE_THREADS_Z

XuAPI
pub const MAX_COMPUTE_THREADS_Z = 64

Purpose

Constant MAX_COMPUTE_THREADS_Z, defining protocol or algorithm parameters.

const MAX_COMPUTE_GROUPS_PER_DIMENSION

XuAPI
pub const MAX_COMPUTE_GROUPS_PER_DIMENSION = 65535

Purpose

Constant MAX_COMPUTE_GROUPS_PER_DIMENSION, defining protocol or algorithm parameters.

struct ComputePipelineDesc

XuAPI
pub struct ComputePipelineDesc {
    pub format int
    pub entrypoint string
    pub read_buffers int
    pub write_buffers int
    pub uniform_sizes []int
    pub threads_x int
    pub threads_y int
    pub threads_z int
}

Purpose

Buffer-only compute. Resource counts, uniforms and thread dimensions must match the shader; code is not reflected or sandboxed by the runtime.

Public fields

format int
field (int)
entrypoint string
field (string)
read_buffers int
field (int)
write_buffers int
field (int)
uniform_sizes []int
field ([]int)
threads_x int
field (int)
threads_y int
field (int)
threads_z int
field (int)

struct ComputePipeline

XuAPI
pub struct ComputePipeline {

}

Purpose

ComputePipeline context or state structure.

Public fields

This type has no public fields.

struct StorageBufferWrite

XuAPI
pub struct StorageBufferWrite {

}

Purpose

Non-owning write target. cycle=true discards prior contents when SDL cycles an in-use allocation. Use false when a later pass reads the previous result.

Public fields

This type has no public fields.

write_buffer

XuAPI
pub fn write_buffer(buffer &Buffer, cycle bool) StorageBufferWrite

Purpose

Write buffer.

Parameters

buffer &Buffer
buffer (read-only borrow; caller keeps the original; type &Buffer)
cycle bool
cycle (bool)

Returns

StorageBufferWrite — a value of this type

struct ComputePass

XuAPI
pub struct ComputePass {

}

Purpose

ComputePass context or state structure.

Public fields

This type has no public fields.

(&Device) compute_pipeline

XuAPI
pub fn (device &Device) compute_pipeline(desc &ComputePipelineDesc, code &[]u8) ComputePipeline

Purpose

Operation on &Device: compute pipeline. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
desc &ComputePipelineDesc
desc (read-only borrow; caller keeps the original; type &ComputePipelineDesc)
code &[]u8
code (read-only borrow; caller keeps the original; type &[]u8)

Returns

ComputePipeline — a value of this type

(&CommandEncoder) begin_compute

XuAPI
pub fn (encoder &CommandEncoder) begin_compute(writes &[]StorageBufferWrite) ComputePass

Purpose

Write slots are fixed for the pass. End the pass between dependent dispatches: dispatches within one pass have no implicit memory barrier. Throws on failure; handle the error or propagate it to the caller.

Parameters

encoder &CommandEncoder
The CommandEncoder instance used by this call (borrow).
writes &[]StorageBufferWrite
writes (read-only borrow; caller keeps the original; type &[]StorageBufferWrite)

Returns

ComputePass — a value of this type

(&ComputePass) pipeline

XuAPI
pub fn (pass &ComputePass) pipeline(pipeline &ComputePipeline) int

Purpose

Changing the pipeline requires read buffers and uniforms to be rebound. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &ComputePass
The ComputePass instance used by this call (borrow).
pipeline &ComputePipeline
pipeline (read-only borrow; caller keeps the original; type &ComputePipeline)

Returns

int — a value of this type

(&ComputePass) read_buffer

XuAPI
pub fn (pass &ComputePass) read_buffer(slot int, buffer &Buffer) int

Purpose

Operation on &ComputePass: read buffer. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &ComputePass
The ComputePass instance used by this call (borrow).
slot int
slot (int)
buffer &Buffer
buffer (read-only borrow; caller keeps the original; type &Buffer)

Returns

int — a value of this type

(&ComputePass) uniform

XuAPI
pub fn (pass &ComputePass) uniform(slot int, bytes &[]u8) int

Purpose

Execute uniform on &ComputePass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &ComputePass
The ComputePass instance used by this call (borrow).
slot int
slot (int)
bytes &[]u8
bytes (read-only borrow; caller keeps the original; type &[]u8)

Returns

int — a value of this type

(&ComputePass) dispatch

XuAPI
pub fn (pass &ComputePass) dispatch(groups_x int, groups_y int, groups_z int) int

Purpose

Group counts are 1...65535 per axis. Shader indexing and storage bounds remain the author's contract; GPU execution is asynchronous and unsandboxed. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &ComputePass
The ComputePass instance used by this call (borrow).
groups_x int
groups_x (int)
groups_y int
groups_y (int)
groups_z int
groups_z (int)

Returns

int — a value of this type

($&ComputePass) end

XuAPI
pub fn (pass $&ComputePass) end() int

Purpose

Execute end on $&ComputePass. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass $&ComputePass
The ComputePass instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&ComputePipeline) close

XuAPI
pub fn (pipeline $&ComputePipeline) close() int

Purpose

Operation on $&ComputePipeline: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

pipeline $&ComputePipeline
The ComputePipeline instance used by this call (exclusive borrow).

Returns

int — a value of this type

const VERTEX

XuAPI
pub const VERTEX = 0

Purpose

Constant VERTEX, defining protocol or algorithm parameters.

const FRAGMENT

XuAPI
pub const FRAGMENT = 1

Purpose

Constant FRAGMENT, defining protocol or algorithm parameters.

const NEAREST

XuAPI
pub const NEAREST = 0

Purpose

Constant NEAREST, defining protocol or algorithm parameters.

const LINEAR

XuAPI
pub const LINEAR = 1

Purpose

Constant LINEAR, defining protocol or algorithm parameters.

const REPEAT

XuAPI
pub const REPEAT = 0

Purpose

Constant REPEAT, defining protocol or algorithm parameters.

const MIRRORED_REPEAT

XuAPI
pub const MIRRORED_REPEAT = 1

Purpose

Constant MIRRORED_REPEAT, defining protocol or algorithm parameters.

const CLAMP_TO_EDGE

XuAPI
pub const CLAMP_TO_EDGE = 2

Purpose

Constant CLAMP_TO_EDGE, defining protocol or algorithm parameters.

const TRIANGLES

XuAPI
pub const TRIANGLES = 0

Purpose

Constant TRIANGLES, defining protocol or algorithm parameters.

const TRIANGLE_STRIP

XuAPI
pub const TRIANGLE_STRIP = 1

Purpose

Constant TRIANGLE_STRIP, defining protocol or algorithm parameters.

const LINES

XuAPI
pub const LINES = 2

Purpose

Constant LINES, defining protocol or algorithm parameters.

const LINE_STRIP

XuAPI
pub const LINE_STRIP = 3

Purpose

Constant LINE_STRIP, defining protocol or algorithm parameters.

const POINTS

XuAPI
pub const POINTS = 4

Purpose

Constant POINTS, defining protocol or algorithm parameters.

const CULL_NONE

XuAPI
pub const CULL_NONE = 0

Purpose

Constant CULL_NONE, defining protocol or algorithm parameters.

const CULL_FRONT

XuAPI
pub const CULL_FRONT = 1

Purpose

Constant CULL_FRONT, defining protocol or algorithm parameters.

const CULL_BACK

XuAPI
pub const CULL_BACK = 2

Purpose

Constant CULL_BACK, defining protocol or algorithm parameters.

const COUNTER_CLOCKWISE

XuAPI
pub const COUNTER_CLOCKWISE = 0

Purpose

Constant COUNTER_CLOCKWISE, defining protocol or algorithm parameters.

const CLOCKWISE

XuAPI
pub const CLOCKWISE = 1

Purpose

Constant CLOCKWISE, defining protocol or algorithm parameters.

const DEPTH_DISABLED

XuAPI
pub const DEPTH_DISABLED = 0

Purpose

Constant DEPTH_DISABLED, defining protocol or algorithm parameters.

const NEVER

XuAPI
pub const NEVER = 1

Purpose

Constant NEVER, defining protocol or algorithm parameters.

const LESS

XuAPI
pub const LESS = 2

Purpose

Constant LESS, defining protocol or algorithm parameters.

const EQUAL

XuAPI
pub const EQUAL = 3

Purpose

Constant EQUAL, defining protocol or algorithm parameters.

const LESS_EQUAL

XuAPI
pub const LESS_EQUAL = 4

Purpose

Constant LESS_EQUAL, defining protocol or algorithm parameters.

const GREATER

XuAPI
pub const GREATER = 5

Purpose

Constant GREATER, defining protocol or algorithm parameters.

const NOT_EQUAL

XuAPI
pub const NOT_EQUAL = 6

Purpose

Constant NOT_EQUAL, defining protocol or algorithm parameters.

const GREATER_EQUAL

XuAPI
pub const GREATER_EQUAL = 7

Purpose

Constant GREATER_EQUAL, defining protocol or algorithm parameters.

const ALWAYS

XuAPI
pub const ALWAYS = 8

Purpose

Constant ALWAYS, defining protocol or algorithm parameters.

const BLEND_DISABLED

XuAPI
pub const BLEND_DISABLED = 0

Purpose

Constant BLEND_DISABLED, defining protocol or algorithm parameters.

const BLEND_ALPHA

XuAPI
pub const BLEND_ALPHA = 1

Purpose

Constant BLEND_ALPHA, defining protocol or algorithm parameters.

const BLEND_PREMULTIPLIED

XuAPI
pub const BLEND_PREMULTIPLIED = 2

Purpose

Constant BLEND_PREMULTIPLIED, defining protocol or algorithm parameters.

const PER_VERTEX

XuAPI
pub const PER_VERTEX = 0

Purpose

Constant PER_VERTEX, defining protocol or algorithm parameters.

const PER_INSTANCE

XuAPI
pub const PER_INSTANCE = 1

Purpose

Constant PER_INSTANCE, defining protocol or algorithm parameters.

const FLOAT

XuAPI
pub const FLOAT = 1

Purpose

Constant FLOAT, defining protocol or algorithm parameters.

const FLOAT2

XuAPI
pub const FLOAT2 = 2

Purpose

Constant FLOAT2, defining protocol or algorithm parameters.

const FLOAT3

XuAPI
pub const FLOAT3 = 3

Purpose

Constant FLOAT3, defining protocol or algorithm parameters.

const FLOAT4

XuAPI
pub const FLOAT4 = 4

Purpose

Constant FLOAT4, defining protocol or algorithm parameters.

const UNORM8X4

XuAPI
pub const UNORM8X4 = 5

Purpose

Constant UNORM8X4, defining protocol or algorithm parameters.

const UINT

XuAPI
pub const UINT = 6

Purpose

Constant UINT, defining protocol or algorithm parameters.

const UINT2

XuAPI
pub const UINT2 = 7

Purpose

Constant UINT2, defining protocol or algorithm parameters.

const UINT3

XuAPI
pub const UINT3 = 8

Purpose

Constant UINT3, defining protocol or algorithm parameters.

const UINT4

XuAPI
pub const UINT4 = 9

Purpose

Constant UINT4, defining protocol or algorithm parameters.

struct SamplerDesc

XuAPI
pub struct SamplerDesc {
    pub min_filter int
    pub mag_filter int
    pub mip_filter int
    pub address_u int
    pub address_v int
    pub address_w int
    pub min_lod f64
    pub max_lod f64
}

Purpose

Structure encapsulating min_filter, mag_filter, mip_filter, address_u, address_v.

Public fields

min_filter int
field (int)
mag_filter int
field (int)
mip_filter int
field (int)
address_u int
field (int)
address_v int
field (int)
address_w int
field (int)
min_lod f64
field (f64)
max_lod f64
field (f64)

sampler_defaults

XuAPI
pub fn sampler_defaults() SamplerDesc

Purpose

Sampler defaults.

Parameters

No arguments are required.

Returns

SamplerDesc — a value of this type

struct ShaderDesc

XuAPI
pub struct ShaderDesc {
    pub stage int
    pub format int
    pub entrypoint string
    pub samplers int
    pub uniform_sizes []int
}

Purpose

Structure encapsulating stage, format, entrypoint, samplers, uniform_sizes.

Public fields

stage int
field (int)
format int
field (int)
entrypoint string
field (string)
samplers int
field (int)
uniform_sizes []int
One exact std140-compatible byte size per uniform slot (16...16384). The caller must match these declarations and bindings to the shader.

struct VertexBufferLayout

XuAPI
pub struct VertexBufferLayout {
    pub slot int
    pub stride int
    pub rate int
}

Purpose

Structure encapsulating slot, stride, rate.

Public fields

slot int
field (int)
stride int
field (int)
rate int
field (int)

struct VertexAttribute

XuAPI
pub struct VertexAttribute {
    pub location int
    pub slot int
    pub format int
    pub offset int
}

Purpose

Structure encapsulating location, slot, format, offset.

Public fields

location int
field (int)
slot int
field (int)
format int
field (int)
offset int
offset

struct PipelineDesc

XuAPI
pub struct PipelineDesc {
    pub color_format int
    pub depth_format int
    pub primitive int
    pub cull int
    pub front_face int
    pub depth_compare int
    pub depth_write bool
    pub blend int
    pub vertex_buffers []VertexBufferLayout
    pub attributes []VertexAttribute
}

Purpose

Structure encapsulating color_format, depth_format, primitive, cull, front_face.

Public fields

color_format int
field (int)
depth_format int
Zero means no depth attachment.
primitive int
field (int)
cull int
field (int)
front_face int
field (int)
depth_compare int
field (int)
depth_write bool
field (bool)
blend int
field (int)
vertex_buffers []VertexBufferLayout
field ([]VertexBufferLayout)
attributes []VertexAttribute
field ([]VertexAttribute)

pipeline_defaults

XuAPI
pub fn pipeline_defaults(color_format int) PipelineDesc

Purpose

Pipeline defaults.

Parameters

color_format int
color_format (int)

Returns

PipelineDesc — a value of this type

struct Sampler

XuAPI
pub struct Sampler {

}

Purpose

Sampler context or state structure.

Public fields

This type has no public fields.

struct Shader

XuAPI
pub struct Shader {

}

Purpose

Shader context or state structure.

Public fields

This type has no public fields.

struct GraphicsPipeline

XuAPI
pub struct GraphicsPipeline {

}

Purpose

GraphicsPipeline context or state structure.

Public fields

This type has no public fields.

(&Device) sampler

XuAPI
pub fn (device &Device) sampler(desc SamplerDesc) Sampler

Purpose

Execute sampler on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
desc SamplerDesc
desc (SamplerDesc)

Returns

Sampler — a value of this type

(&Device) shader

XuAPI
pub fn (device &Device) shader(desc &ShaderDesc, code &[]u8) Shader

Purpose

Execute shader on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
desc &ShaderDesc
desc (read-only borrow; caller keeps the original; type &ShaderDesc)
code &[]u8
code (read-only borrow; caller keeps the original; type &[]u8)

Returns

Shader — a value of this type

(&Device) graphics_pipeline

XuAPI
pub fn (device &Device) graphics_pipeline(vertex &Shader, fragment &Shader, desc &PipelineDesc) GraphicsPipeline

Purpose

Operation on &Device: graphics pipeline. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
vertex &Shader
vertex (read-only borrow; caller keeps the original; type &Shader)
fragment &Shader
fragment (read-only borrow; caller keeps the original; type &Shader)
desc &PipelineDesc
desc (read-only borrow; caller keeps the original; type &PipelineDesc)

Returns

GraphicsPipeline — a value of this type

($&Sampler) close

XuAPI
pub fn (sampler $&Sampler) close() int

Purpose

Operation on $&Sampler: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

sampler $&Sampler
The Sampler instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Shader) close

XuAPI
pub fn (shader $&Shader) close() int

Purpose

Operation on $&Shader: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

shader $&Shader
The Shader instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&GraphicsPipeline) close

XuAPI
pub fn (pipeline $&GraphicsPipeline) close() int

Purpose

Operation on $&GraphicsPipeline: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

pipeline $&GraphicsPipeline
The GraphicsPipeline instance used by this call (exclusive borrow).

Returns

int — a value of this type

struct DeviceRef

XuAPI
pub struct DeviceRef {

}

Purpose

Copyable, non-owning identities for retained draw lists and resource tables. They never extend owner lifetime. Validation and every binding check the backend's never-reused identity, including after the owner/device closes. Zero/default references are invalid; no raw platform handles are exposed.

Public fields

This type has no public fields.

struct BufferRef

XuAPI
pub struct BufferRef {

}

Purpose

BufferRef context or state structure.

Public fields

This type has no public fields.

struct TextureRef

XuAPI
pub struct TextureRef {

}

Purpose

TextureRef context or state structure.

Public fields

This type has no public fields.

struct SamplerRef

XuAPI
pub struct SamplerRef {

}

Purpose

SamplerRef context or state structure.

Public fields

This type has no public fields.

(&Device) reference

XuAPI
pub fn (device &Device) reference() DeviceRef

Purpose

Execute reference on &Device.

Parameters

device &Device
The Device instance used by this call (borrow).

Returns

DeviceRef — a value of this type

(&Buffer) reference

XuAPI
pub fn (buffer &Buffer) reference() BufferRef

Purpose

Execute reference on &Buffer.

Parameters

buffer &Buffer
The Buffer instance used by this call (borrow).

Returns

BufferRef — a value of this type

(&Texture) reference

XuAPI
pub fn (texture &Texture) reference() TextureRef

Purpose

Execute reference on &Texture.

Parameters

texture &Texture
The Texture instance used by this call (borrow).

Returns

TextureRef — a value of this type

(&Sampler) reference

XuAPI
pub fn (sampler &Sampler) reference() SamplerRef

Purpose

Execute reference on &Sampler.

Parameters

sampler &Sampler
The Sampler instance used by this call (borrow).

Returns

SamplerRef — a value of this type

(DeviceRef) same

XuAPI
pub fn (reference DeviceRef) same(other DeviceRef) bool

Purpose

Identity comparison does not assert liveness. Two zero references never match.

Parameters

reference DeviceRef
The DeviceRef instance used by this call (value receiver).
other DeviceRef
the other value of the same type (DeviceRef)

Returns

bool — true or false

(DeviceRef) validate

XuAPI
pub fn (reference DeviceRef) validate() int

Purpose

Execute validate on DeviceRef. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference DeviceRef
The DeviceRef instance used by this call (value receiver).

Returns

int — a value of this type

(BufferRef) validate

XuAPI
pub fn (reference BufferRef) validate() int

Purpose

Execute validate on BufferRef. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference BufferRef
The BufferRef instance used by this call (value receiver).

Returns

int — a value of this type

(TextureRef) validate

XuAPI
pub fn (reference TextureRef) validate() int

Purpose

Execute validate on TextureRef. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference TextureRef
The TextureRef instance used by this call (value receiver).

Returns

int — a value of this type

(SamplerRef) validate

XuAPI
pub fn (reference SamplerRef) validate() int

Purpose

Execute validate on SamplerRef. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference SamplerRef
The SamplerRef instance used by this call (value receiver).

Returns

int — a value of this type

(BufferRef) size_bytes

XuAPI
pub fn (reference BufferRef) size_bytes() int

Purpose

Operation on BufferRef: size bytes.

Parameters

reference BufferRef
The BufferRef instance used by this call (value receiver).

Returns

int — a value of this type

(DeviceRef) validate_buffer

XuAPI
pub fn (reference DeviceRef) validate_buffer(buffer BufferRef) int

Purpose

Operation on DeviceRef: validate buffer. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference DeviceRef
The DeviceRef instance used by this call (value receiver).
buffer BufferRef
buffer (BufferRef)

Returns

int — a value of this type

(DeviceRef) validate_texture

XuAPI
pub fn (reference DeviceRef) validate_texture(texture TextureRef) int

Purpose

Operation on DeviceRef: validate texture. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference DeviceRef
The DeviceRef instance used by this call (value receiver).
texture TextureRef
texture (TextureRef)

Returns

int — a value of this type

(DeviceRef) validate_sampler

XuAPI
pub fn (reference DeviceRef) validate_sampler(sampler SamplerRef) int

Purpose

Operation on DeviceRef: validate sampler. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference DeviceRef
The DeviceRef instance used by this call (value receiver).
sampler SamplerRef
sampler (SamplerRef)

Returns

int — a value of this type

(&RenderPass) vertex_buffer_ref

XuAPI
pub fn (pass &RenderPass) vertex_buffer_ref(slot int, buffer BufferRef, offset int) int

Purpose

Operation on &RenderPass: vertex buffer ref. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
slot int
slot (int)
buffer BufferRef
buffer (BufferRef)
offset int
offset (int)

Returns

int — a value of this type

(&RenderPass) index_buffer_ref

XuAPI
pub fn (pass &RenderPass) index_buffer_ref(buffer BufferRef, offset int, element_size int) int

Purpose

Operation on &RenderPass: index buffer ref. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
buffer BufferRef
buffer (BufferRef)
offset int
offset (int)
element_size int
element_size (int)

Returns

int — index; see the description for its range and special values

(&RenderPass) sampler_ref

XuAPI
pub fn (pass &RenderPass) sampler_ref(stage int, slot int, texture TextureRef, sampler SamplerRef) int

Purpose

Operation on &RenderPass: sampler ref. Throws on failure; handle the error or propagate it to the caller.

Parameters

pass &RenderPass
The RenderPass instance used by this call (borrow).
stage int
stage (int)
slot int
slot (int)
texture TextureRef
texture (TextureRef)
sampler SamplerRef
sampler (SamplerRef)

Returns

int — a value of this type

struct SoftBlob

XuAPI
pub struct SoftBlob {

}

Purpose

SoftBlob context or state structure.

Public fields

This type has no public fields.

struct SoftBlobRef

XuAPI
pub struct SoftBlobRef {

}

Purpose

SoftBlobRef context or state structure.

Public fields

This type has no public fields.

soft_owner_new

XuAPI
pub fn soft_owner_new() int

Purpose

Allocates an opaque soft-device owner id used by SoftBlobRef.validate. Throws on failure; handle the error or propagate it to the caller.

Parameters

No arguments are required.

Returns

int — a value of this type

soft_owner_close

XuAPI
pub fn soft_owner_close(owner int) int

Purpose

Soft owner close. Throws on failure; handle the error or propagate it to the caller.

Parameters

owner int
owner (int)

Returns

int — a value of this type

soft_blob_create

XuAPI
pub fn soft_blob_create(owner int, bytes &[]u8) SoftBlob

Purpose

Soft blob create. Throws on failure; handle the error or propagate it to the caller.

Parameters

owner int
owner (int)
bytes &[]u8
bytes (read-only borrow; caller keeps the original; type &[]u8)

Returns

SoftBlob — a value of this type

empty_soft_blob_ref

XuAPI
pub fn empty_soft_blob_ref() SoftBlobRef

Purpose

Empty soft blob ref.

Parameters

No arguments are required.

Returns

SoftBlobRef — a value of this type

(&SoftBlob) reference

XuAPI
pub fn (blob &SoftBlob) reference() SoftBlobRef

Purpose

Execute reference on &SoftBlob.

Parameters

blob &SoftBlob
The SoftBlob instance used by this call (borrow).

Returns

SoftBlobRef — a value of this type

($&SoftBlob) close

XuAPI
pub fn (blob $&SoftBlob) close() int

Purpose

Operation on $&SoftBlob: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

blob $&SoftBlob
The SoftBlob instance used by this call (exclusive borrow).

Returns

int — a value of this type

(SoftBlobRef) validate

XuAPI
pub fn (reference SoftBlobRef) validate(owner int) int

Purpose

Execute validate on SoftBlobRef. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference SoftBlobRef
The SoftBlobRef instance used by this call (value receiver).
owner int
owner (int)

Returns

int — a value of this type

(SoftBlobRef) read_u32

XuAPI
pub fn (reference SoftBlobRef) read_u32(offset int) int

Purpose

Operation on SoftBlobRef: read u32. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference SoftBlobRef
The SoftBlobRef instance used by this call (value receiver).
offset int
offset (int)

Returns

int — a value of this type

(SoftBlobRef) read_f32

XuAPI
pub fn (reference SoftBlobRef) read_f32(offset int) f64

Purpose

Operation on SoftBlobRef: read f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference SoftBlobRef
The SoftBlobRef instance used by this call (value receiver).
offset int
offset (int)

Returns

f64 — a value of this type

(SoftBlobRef) read_rgba8

XuAPI
pub fn (reference SoftBlobRef) read_rgba8(index int) int

Purpose

Packed RGBA8 texel (R in the high 8 bits) matching game software sampling. Throws on failure; handle the error or propagate it to the caller.

Parameters

reference SoftBlobRef
The SoftBlobRef instance used by this call (value receiver).
index int
index (int)

Returns

int — a value of this type

const PRESENT_VSYNC

XuAPI
pub const PRESENT_VSYNC = 0

Purpose

Constant PRESENT_VSYNC, defining protocol or algorithm parameters.

const PRESENT_IMMEDIATE

XuAPI
pub const PRESENT_IMMEDIATE = 1

Purpose

Constant PRESENT_IMMEDIATE, defining protocol or algorithm parameters.

const PRESENT_MAILBOX

XuAPI
pub const PRESENT_MAILBOX = 2

Purpose

Constant PRESENT_MAILBOX, defining protocol or algorithm parameters.

struct SurfaceOptions

XuAPI
pub struct SurfaceOptions {
    pub present_mode int
}

Purpose

Gpu Configuration parameters and options set.

Public fields

present_mode int
field (int)

struct Surface

XuAPI
pub struct Surface {

}

Purpose

Surface context or state structure.

Public fields

This type has no public fields.

struct Frame

XuAPI
pub struct Frame {

}

Purpose

Gpu Protocol data frame encapsulation.

Public fields

This type has no public fields.

(&Device) surface

XuAPI
pub fn (device &Device) surface(target &window.Window, options SurfaceOptions) Surface

Purpose

Execute surface on &Device. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
target &window.Window
target (read-only borrow; caller keeps the original; type &window.Window)
options SurfaceOptions
options (SurfaceOptions)

Returns

Surface — a value of this type

(&Surface) format

XuAPI
pub fn (surface &Surface) format() int

Purpose

Operation on &Surface: format as a string. Throws on failure; handle the error or propagate it to the caller.

Parameters

surface &Surface
The Surface instance used by this call (borrow).

Returns

int — a value of this type

(&Surface) supports_present_mode

XuAPI
pub fn (surface &Surface) supports_present_mode(mode int) bool

Purpose

Operation on &Surface: supports present mode. Throws on failure; handle the error or propagate it to the caller.

Parameters

surface &Surface
The Surface instance used by this call (borrow).
mode int
mode (int)

Returns

bool — true or false

(&Surface) set_present_mode

XuAPI
pub fn (surface &Surface) set_present_mode(mode int) int

Purpose

Reconfiguration requires no acquired frame and may wait for GPU work. Throws on failure; handle the error or propagate it to the caller.

Parameters

surface &Surface
The Surface instance used by this call (borrow).
mode int
mode (int)

Returns

int — a value of this type

(&Surface) acquire

XuAPI
pub fn (surface &Surface) acquire() Frame

Purpose

A successful acquire can have no image (e.g. minimized). Test has_image before rendering. Dimensions/format describe this acquired image in pixels. Throws on failure; handle the error or propagate it to the caller.

Parameters

surface &Surface
The Surface instance used by this call (borrow).

Returns

Frame — a value of this type

(&Frame) has_image

XuAPI
pub fn (frame &Frame) has_image() bool

Purpose

Operation on &Frame: whether it has image.

Parameters

frame &Frame
The Frame instance used by this call (borrow).

Returns

bool — true or false

(&Frame) width

XuAPI
pub fn (frame &Frame) width() int

Purpose

Execute width on &Frame.

Parameters

frame &Frame
The Frame instance used by this call (borrow).

Returns

int — a value of this type

(&Frame) height

XuAPI
pub fn (frame &Frame) height() int

Purpose

Execute height on &Frame.

Parameters

frame &Frame
The Frame instance used by this call (borrow).

Returns

int — a value of this type

(&Frame) format

XuAPI
pub fn (frame &Frame) format() int

Purpose

Operation on &Frame: format as a string.

Parameters

frame &Frame
The Frame instance used by this call (borrow).

Returns

int — a value of this type

(&Frame) begin_render

XuAPI
pub fn (frame &Frame) begin_render(load int, clear Color, depth DepthAttachment) RenderPass

Purpose

Swapchain images are write-only, restricted to this frame, and always STORE. LOAD needs an earlier render pass in the same frame. No owning Texture/view or independent CommandEncoder can escape the acquired-image lifetime. Throws on failure; handle the error or propagate it to the caller.

Parameters

frame &Frame
The Frame instance used by this call (borrow).
load int
load (int)
clear Color
clear (Color)
depth DepthAttachment
depth (DepthAttachment)

Returns

RenderPass — a value of this type

(&Frame) begin_compute

XuAPI
pub fn (frame &Frame) begin_compute(writes &[]StorageBufferWrite) ComputePass

Purpose

Operation on &Frame: begin compute. Throws on failure; handle the error or propagate it to the caller.

Parameters

frame &Frame
The Frame instance used by this call (borrow).
writes &[]StorageBufferWrite
writes (read-only borrow; caller keeps the original; type &[]StorageBufferWrite)

Returns

ComputePass — a value of this type

($&Frame) present

XuAPI
pub fn (frame $&Frame) present() Fence

Purpose

End every active pass before presenting. Submission consumes the frame even on driver failure; close/drop is safe if a stale CPU owner remains afterward. Throws on failure; handle the error or propagate it to the caller.

Parameters

frame $&Frame
The Frame instance used by this call (exclusive borrow).

Returns

Fence — a value of this type

($&Frame) close

XuAPI
pub fn (frame $&Frame) close() int

Purpose

An acquired image cannot be cancelled. Abandonment ends active passes, clears opaque black and submits without a fence. Errors are reported teardown still consumes the command. No per-frame GPU-idle wait is added. Throws on failure; handle the error or propagate it to the caller.

Parameters

frame $&Frame
The Frame instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Surface) close

XuAPI
pub fn (surface $&Surface) close() int

Purpose

Closing a surface safely finishes/invalidate its pending frame before unclaiming the window. Device/window closure also invalidates descendants. Throws on failure; handle the error or propagate it to the caller.

Parameters

surface $&Surface
The Surface instance used by this call (exclusive borrow).

Returns

int — a value of this type

const TEXTURE_SAMPLED

XuAPI
pub const TEXTURE_SAMPLED = 1

Purpose

Constant TEXTURE_SAMPLED, defining protocol or algorithm parameters.

const TEXTURE_COLOR_TARGET

XuAPI
pub const TEXTURE_COLOR_TARGET = 2

Purpose

Constant TEXTURE_COLOR_TARGET, defining protocol or algorithm parameters.

const TEXTURE_DEPTH_TARGET

XuAPI
pub const TEXTURE_DEPTH_TARGET = 4

Purpose

Constant TEXTURE_DEPTH_TARGET, defining protocol or algorithm parameters.

const MAX_TEXTURE_SIZE_2D

XuAPI
pub const MAX_TEXTURE_SIZE_2D = 16384

Purpose

SDL's portable 2D limit. Actual format/usage support is device-specific.

struct Texture2DDesc

XuAPI
pub struct Texture2DDesc {
    pub format int
    pub width int
    pub height int
    pub levels int
    pub usage int
}

Purpose

Structure encapsulating format, width, height, levels, usage.

Public fields

format int
field (int)
width int
field (int)
height int
field (int)
levels int
Zero requests a full mip chain. Depth targets currently require one.
usage int
usage text

struct Texture

XuAPI
pub struct Texture {

}

Purpose

Texture context or state structure.

Public fields

This type has no public fields.

struct TextureSlice

XuAPI
pub struct TextureSlice {

}

Purpose

Non-owning subresource identity. Use after owner/device closure is rejected.

Public fields

This type has no public fields.

(&Device) supports_texture_2d

XuAPI
pub fn (device &Device) supports_texture_2d(format int, usage int) bool

Purpose

Operation on &Device: supports texture 2d. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
format int
format (int)
usage int
usage text (int)

Returns

bool — true or false

(&Device) texture_2d

XuAPI
pub fn (device &Device) texture_2d(desc Texture2DDesc) Texture

Purpose

Operation on &Device: texture 2d. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
desc Texture2DDesc
desc (Texture2DDesc)

Returns

Texture — a value of this type

(&Texture) level_count

XuAPI
pub fn (texture &Texture) level_count() int

Purpose

Operation on &Texture: level count.

Parameters

texture &Texture
The Texture instance used by this call (borrow).

Returns

int — a value of this type

(&Texture) size_bytes

XuAPI
pub fn (texture &Texture) size_bytes() int

Purpose

Operation on &Texture: size bytes.

Parameters

texture &Texture
The Texture instance used by this call (borrow).

Returns

int — a value of this type

(&Texture) level_layout

XuAPI
pub fn (texture &Texture) level_layout(mip int) layout.Level2D

Purpose

Operation on &Texture: level layout. Throws on failure; handle the error or propagate it to the caller.

Parameters

texture &Texture
The Texture instance used by this call (borrow).
mip int
mip (int)

Returns

layout.Level2D — a value of this type

(&Texture) view

XuAPI
pub fn (texture &Texture) view(mip int) TextureSlice

Purpose

Operation on &Texture: view. Throws on failure; handle the error or propagate it to the caller.

Parameters

texture &Texture
The Texture instance used by this call (borrow).
mip int
mip (int)

Returns

TextureSlice — a value of this type

(&Device) upload_texture

XuAPI
pub fn (device &Device) upload_texture(texture &Texture, mip int, bytes &[]u8) Fence

Purpose

Transfers copy a complete tightly packed mip. Compression follows gpu/layout depth transfers are unsupported. Input bytes are copied before returning. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
texture &Texture
texture (read-only borrow; caller keeps the original; type &Texture)
mip int
mip (int)
bytes &[]u8
bytes (read-only borrow; caller keeps the original; type &[]u8)

Returns

Fence — a value of this type

(&Device) download_texture

XuAPI
pub fn (device &Device) download_texture(texture &Texture, mip int) Readback

Purpose

Operation on &Device: download texture. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
texture &Texture
texture (read-only borrow; caller keeps the original; type &Texture)
mip int
mip (int)

Returns

Readback — a value of this type

(&Device) generate_mips

XuAPI
pub fn (device &Device) generate_mips(texture &Texture) Fence

Purpose

Operation on &Device: generate mips. Throws on failure; handle the error or propagate it to the caller.

Parameters

device &Device
The Device instance used by this call (borrow).
texture &Texture
texture (read-only borrow; caller keeps the original; type &Texture)

Returns

Fence — a value of this type

($&Texture) close

XuAPI
pub fn (texture $&Texture) close() int

Purpose

Operation on $&Texture: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

texture $&Texture
The Texture instance used by this call (exclusive borrow).

Returns

int — a value of this type