Skip to content

Commit 8d6d3b1

Browse files
committed
indirect command structs: added, mostly copied from ash
1 parent 18b9f75 commit 8d6d3b1

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
use glam::UVec3;
2+
3+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDeviceSize.html>"]
4+
pub type DeviceSize = u64;
5+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDeviceAddress.html>"]
6+
pub type DeviceAddress = u64;
7+
8+
#[repr(C)]
9+
#[derive(Copy, Clone, Debug, Default)]
10+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawIndirectCommand.html>"]
11+
pub struct DrawIndirectCommand {
12+
pub vertex_count: u32,
13+
pub instance_count: u32,
14+
pub first_vertex: u32,
15+
pub first_instance: u32,
16+
}
17+
18+
#[repr(C)]
19+
#[derive(Copy, Clone, Debug, Default)]
20+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawIndexedIndirectCommand.html>"]
21+
pub struct DrawIndexedIndirectCommand {
22+
pub index_count: u32,
23+
pub instance_count: u32,
24+
pub first_index: u32,
25+
pub vertex_offset: i32,
26+
pub first_instance: u32,
27+
}
28+
29+
#[repr(C)]
30+
#[derive(Copy, Clone, Debug, Default)]
31+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDispatchIndirectCommand.html>"]
32+
pub struct DispatchIndirectCommand {
33+
pub x: u32,
34+
pub y: u32,
35+
pub z: u32,
36+
}
37+
38+
impl From<UVec3> for DispatchIndirectCommand {
39+
fn from(v: UVec3) -> Self {
40+
Self {
41+
x: v.x,
42+
y: v.y,
43+
z: v.z,
44+
}
45+
}
46+
}
47+
48+
impl From<DispatchIndirectCommand> for UVec3 {
49+
fn from(v: DispatchIndirectCommand) -> Self {
50+
Self {
51+
x: v.x,
52+
y: v.y,
53+
z: v.z,
54+
}
55+
}
56+
}
57+
58+
#[repr(C)]
59+
#[derive(Copy, Clone, Debug, Default)]
60+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawMeshTasksIndirectCommandEXT.html>"]
61+
pub struct DrawMeshTasksIndirectCommandEXT {
62+
pub group_count_x: u32,
63+
pub group_count_y: u32,
64+
pub group_count_z: u32,
65+
}
66+
67+
impl From<UVec3> for DrawMeshTasksIndirectCommandEXT {
68+
fn from(v: UVec3) -> Self {
69+
Self {
70+
group_count_x: v.x,
71+
group_count_y: v.y,
72+
group_count_z: v.z,
73+
}
74+
}
75+
}
76+
77+
impl From<DrawMeshTasksIndirectCommandEXT> for UVec3 {
78+
fn from(v: DrawMeshTasksIndirectCommandEXT) -> Self {
79+
Self {
80+
x: v.group_count_x,
81+
y: v.group_count_y,
82+
z: v.group_count_z,
83+
}
84+
}
85+
}
86+
87+
#[repr(C)]
88+
#[derive(Copy, Clone, Debug, Default)]
89+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkTraceRaysIndirectCommandKHR.html>"]
90+
pub struct TraceRaysIndirectCommandKHR {
91+
pub width: u32,
92+
pub height: u32,
93+
pub depth: u32,
94+
}
95+
96+
impl From<UVec3> for TraceRaysIndirectCommandKHR {
97+
fn from(v: UVec3) -> Self {
98+
Self {
99+
width: v.x,
100+
height: v.y,
101+
depth: v.z,
102+
}
103+
}
104+
}
105+
106+
impl From<TraceRaysIndirectCommandKHR> for UVec3 {
107+
fn from(v: TraceRaysIndirectCommandKHR) -> Self {
108+
Self {
109+
x: v.width,
110+
y: v.height,
111+
z: v.depth,
112+
}
113+
}
114+
}
115+
116+
#[repr(C)]
117+
#[derive(Copy, Clone, Debug, Default)]
118+
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkTraceRaysIndirectCommand2KHR.html>"]
119+
#[must_use]
120+
pub struct TraceRaysIndirectCommand2KHR {
121+
pub raygen_shader_record_address: DeviceAddress,
122+
pub raygen_shader_record_size: DeviceSize,
123+
pub miss_shader_binding_table_address: DeviceAddress,
124+
pub miss_shader_binding_table_size: DeviceSize,
125+
pub miss_shader_binding_table_stride: DeviceSize,
126+
pub hit_shader_binding_table_address: DeviceAddress,
127+
pub hit_shader_binding_table_size: DeviceSize,
128+
pub hit_shader_binding_table_stride: DeviceSize,
129+
pub callable_shader_binding_table_address: DeviceAddress,
130+
pub callable_shader_binding_table_size: DeviceSize,
131+
pub callable_shader_binding_table_stride: DeviceSize,
132+
pub width: u32,
133+
pub height: u32,
134+
pub depth: u32,
135+
}

crates/spirv-std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ pub mod arch;
9999
pub mod byte_addressable_buffer;
100100
pub mod float;
101101
pub mod image;
102+
pub mod indirect_command;
102103
pub mod integer;
103104
pub mod memory;
104105
pub mod number;

0 commit comments

Comments
 (0)