Skip to main content

rotex_types/
graph.rs

1use crate::frame::{ComputePassDescriptor, PassDescriptor};
2use crate::resource::ids::{BindGroupId, BufferId, MaterialId, MeshId};
3use crate::resource::{AccessType, ShaderStageFlags};
4
5#[derive(Debug, Clone)]
6pub enum RhiCommand {
7    /// Select the in-flight frame slot. User owns the ring index.
8    BeginFrame {
9        frame_index: u32,
10    },
11    /// Acquire the next swapchain image for the current frame slot.
12    AcquireSwapchainImage,
13    /// CPU-side buffer upload (staging copy or mapped write in HAL).
14    WriteBuffer {
15        buffer: BufferId,
16        offset: u64,
17        data: Vec<u8>,
18    },
19    TransitionBuffer {
20        buffer: BufferId,
21        from: AccessType,
22        to: AccessType,
23    },
24    DispatchCompute(ComputePassDescriptor),
25    BeginRenderPass {
26        pass: PassDescriptor,
27        image_index: u32,
28    },
29    EndRenderPass,
30    BindGraphicsPipeline {
31        material: MaterialId,
32        mesh: MeshId,
33        depth_enabled: bool,
34    },
35    BindDescriptorSets {
36        first_set: u32,
37        bind_groups: Vec<BindGroupId>,
38        dynamic_offsets: Vec<u32>,
39    },
40    PushConstants {
41        stages: ShaderStageFlags,
42        offset: u32,
43        data: Vec<u8>,
44    },
45    SetVertexBuffers {
46        mesh: MeshId,
47        first_binding: u32,
48    },
49    SetIndexBuffer {
50        mesh: MeshId,
51    },
52    DrawIndexed {
53        index_count: u32,
54        instance_count: u32,
55        first_index: u32,
56        vertex_offset: i32,
57        first_instance: u32,
58    },
59    SubmitFrame {
60        present: bool,
61    },
62}