ui

source of pkg::alloy::gpu::commands

1// Commands recorded for the device to run when submitted: every backend2// runs the same list, the CPU device directly, Vulkan from a command3// buffer it records, WebGPU through the browser's encoder.45import std::vector;6import std::option;78import gpu;910pub type DrawCommand = struct {11    pub count: u32, // vertices, or indices for an indexed draw12    pub instances: u32,13    pub first: u32, // the first vertex, or index14    pub base_vertex: i32,15    pub first_instance: u32,16};1718pub type VertexBufferCommand = struct {19    pub slot: u32,20    pub buffer: Buffer,21    pub offset: u64,22};2324pub type IndexBufferCommand = struct {25    pub buffer: Buffer,26    pub offset: u64,27    pub wide: bool, // 32-bit indices, else 16-bit28};2930pub type RenderPassCommand = struct {31    pub target: Texture,32    pub clear: Option<Color>,33};3435pub type Scissor = struct {36    pub x: u32,37    pub y: u32,38    pub width: u32,39    pub height: u32,40};4142pub type CopyCommand = struct {43    pub source: Buffer,44    pub source_offset: u64,45    pub destination: Buffer,46    pub destination_offset: u64,47    pub size: u64,48};4950// A whole texture copied over another of its size and format.51pub type TextureCopyCommand = struct {52    pub source: Texture,53    pub destination: Texture,54};5556pub type Command = enum {57    BeginRenderPass: RenderPassCommand,58    EndRenderPass,59    SetPipeline: RenderPipeline,60    SetComputePipeline: ComputePipeline,61    SetBindGroup: BindGroup,62    SetVertexBuffer: VertexBufferCommand,63    SetIndexBuffer: IndexBufferCommand,64    SetScissor: Scissor,65    Draw: DrawCommand,66    DrawIndexed: DrawCommand,67    Dispatch: [u32 : 3],68    CopyBuffer: CopyCommand,69    CopyTexture: TextureCopyCommand,70};