Expand description
Wire format of the 0x1 GPU API (“sg-gpu v1”).
The guest (a sandboxed wasm module) never holds a GPU object. It holds Ids
that index a per-game table in the host. Requests are postcard-encoded
Req values passed to the sg.gpu_call import; the host validates every
field and replies with a postcard-encoded Reply. Command encoders are
recorded entirely on the guest side and sent as one Req::CreateCommandBuffer
when finished, so a frame costs a handful of host calls, not thousands.
Bulk data (buffer/texture uploads, mapped-range reads/writes) bypasses the
serializer through dedicated imports; see sg-guest::sys.
The descriptor structs embed wgpu-types 30 types. Their postcard encoding
is part of this wire format, so the protocol version must be bumped if the
pinned wgpu-types version changes in a layout-affecting way.
Modules§
- error_
kind - Error kinds, matching
wgpu::ErrorFilterorder. - frame_
controls Req::FrameControlsreplies.- surface_
status - Surface acquisition status, matching
wgpu::SurfaceStatussemantics.
Structs§
- Adapter
Desc - Bind
Group Entry - Blas
Build - Blas
Triangles - Buffer
Binding - Color
Attachment - Compilation
Message - Compute
Pipeline Desc - Depth
Stencil Attachment - Error
Info - Frame
Controls - Inputs a game gives the host’s frame pass for the next presented frame.
- Mesh
Pipeline Desc - Programmable
Stage - Render
Bundle Encoder Desc - Render
Pass Desc - Render
Pipeline Desc - Surface
Caps - Texel
Copy Buffer Info - Timestamp
Writes - Tlas
Build - Tlas
Instance - Vertex
Buffer Layout - Write
Texture - Write to a texture from guest memory (the data travels separately).
Enums§
Constants§
- MIN_
VERSION - The oldest guest protocol a host accepts.
- VERSION
- Bumped on any incompatible change to the types below. v2 added
Req::FrameControls; hosts still accept v1 guests (which never send it).
Functions§
Type Aliases§
- Id
- A host object handle.
0is never a valid handle and encodes “none”. - Label
- Texel
Copy Texture Info