globject_rs/
glcmdbuf.rs

1
2use std::{
3	fmt::Debug,
4};
5
6/// The data for `glMultiDrawArraysIndirect` to submit multiple draw array commands at once with instancing
7/// Must be binded to the `BufferTarget::DrawIndirectBuffer`
8#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
9pub struct DrawArrayCommand {
10	vertex_count: u32,
11	instance_count: u32,
12	first_index: u32,
13	base_instance: u32,
14}
15
16/// The data for `glMultiDrawElementsIndirect` to submit multiple draw element commands at once with instancing
17/// Must be binded to the `BufferTarget::DrawIndirectBuffer`
18#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
19pub struct DrawElementsCommand {
20	element_count: u32,
21	instance_count: u32,
22	first_index: u32,
23	base_vertex: i32,
24	base_instance: u32,
25}
26
27/// The data for `glDispatchComputeIndirect` to submit multiple compute commands at once
28/// Must be binded to the `BufferTarget::DispatchIndirectBuffer`
29#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
30pub struct DispatchIndirectCommand {
31	num_groups_x: u32,
32	num_groups_y: u32,
33	num_groups_z: u32,
34}
35
36/// The trait for all of the commands
37pub trait DrawCommand: Default + Clone + Copy + Sized + Debug {}
38
39impl DrawCommand for DrawArrayCommand {}
40impl DrawCommand for DrawElementsCommand {}
41impl DrawCommand for DispatchIndirectCommand {}