Skip to content

Commit 27088d7

Browse files
committed
properly doc indirect commands
1 parent effacc3 commit 27088d7

File tree

1 file changed

+52
-6
lines changed

1 file changed

+52
-6
lines changed

crates/spirv-std/src/indirect_command.rs

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,57 @@
1+
//! Indirect command structs from vulkan
2+
13
use glam::UVec3;
24

35
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDeviceSize.html>"]
46
pub type DeviceSize = u64;
57
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDeviceAddress.html>"]
68
pub type DeviceAddress = u64;
79

10+
/// Structure specifying an indirect drawing command
11+
///
12+
/// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawIndirectCommand.html
813
#[repr(C)]
914
#[derive(Copy, Clone, Debug, Default)]
10-
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawIndirectCommand.html>"]
1115
pub struct DrawIndirectCommand {
16+
/// vertexCount is the number of vertices to draw.
1217
pub vertex_count: u32,
18+
/// instanceCount is the number of instances to draw.
1319
pub instance_count: u32,
20+
/// firstVertex is the index of the first vertex to draw.
1421
pub first_vertex: u32,
22+
/// firstInstance is the instance ID of the first instance to draw.
1523
pub first_instance: u32,
1624
}
1725

26+
/// Structure specifying an indexed indirect drawing command
27+
///
28+
/// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawIndexedIndirectCommand.html
1829
#[repr(C)]
1930
#[derive(Copy, Clone, Debug, Default)]
20-
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawIndexedIndirectCommand.html>"]
2131
pub struct DrawIndexedIndirectCommand {
32+
/// indexCount is the number of vertices to draw.
2233
pub index_count: u32,
34+
/// instanceCount is the number of instances to draw.
2335
pub instance_count: u32,
36+
/// firstIndex is the base index within the index buffer.
2437
pub first_index: u32,
38+
/// vertexOffset is the value added to the vertex index before indexing into the vertex buffer.
2539
pub vertex_offset: i32,
40+
/// firstInstance is the instance ID of the first instance to draw.
2641
pub first_instance: u32,
2742
}
2843

44+
/// Structure specifying an indirect dispatching command
45+
///
46+
/// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDispatchIndirectCommand.html
2947
#[repr(C)]
3048
#[derive(Copy, Clone, Debug, Default)]
31-
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDispatchIndirectCommand.html>"]
3249
pub struct DispatchIndirectCommand {
50+
/// x is the number of local workgroups to dispatch in the X dimension.
3351
pub x: u32,
52+
/// y is the number of local workgroups to dispatch in the Y dimension.
3453
pub y: u32,
54+
/// z is the number of local workgroups to dispatch in the Z dimension.
3555
pub z: u32,
3656
}
3757

@@ -55,12 +75,17 @@ impl From<DispatchIndirectCommand> for UVec3 {
5575
}
5676
}
5777

78+
/// Structure specifying a mesh tasks draw indirect command
79+
///
80+
/// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawMeshTasksIndirectCommandEXT.html
5881
#[repr(C)]
5982
#[derive(Copy, Clone, Debug, Default)]
60-
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDrawMeshTasksIndirectCommandEXT.html>"]
6183
pub struct DrawMeshTasksIndirectCommandEXT {
84+
/// groupCountX is the number of local workgroups to dispatch in the X dimension.
6285
pub group_count_x: u32,
86+
/// groupCountY is the number of local workgroups to dispatch in the Y dimension.
6387
pub group_count_y: u32,
88+
/// groupCountZ is the number of local workgroups to dispatch in the Z dimension.
6489
pub group_count_z: u32,
6590
}
6691

@@ -84,12 +109,17 @@ impl From<DrawMeshTasksIndirectCommandEXT> for UVec3 {
84109
}
85110
}
86111

112+
/// Structure specifying the parameters of an indirect ray tracing command
113+
///
114+
/// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkTraceRaysIndirectCommandKHR.html
87115
#[repr(C)]
88116
#[derive(Copy, Clone, Debug, Default)]
89-
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkTraceRaysIndirectCommandKHR.html>"]
90117
pub struct TraceRaysIndirectCommandKHR {
118+
/// width is the width of the ray trace query dimensions.
91119
pub width: u32,
120+
/// height is height of the ray trace query dimensions.
92121
pub height: u32,
122+
/// depth is depth of the ray trace query dimensions.
93123
pub depth: u32,
94124
}
95125

@@ -113,23 +143,39 @@ impl From<TraceRaysIndirectCommandKHR> for UVec3 {
113143
}
114144
}
115145

146+
/// Structure specifying the parameters of an indirect trace ray command with indirect shader binding tables
147+
///
148+
/// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkTraceRaysIndirectCommand2KHR.html
116149
#[repr(C)]
117150
#[derive(Copy, Clone, Debug, Default)]
118-
#[doc = "<https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkTraceRaysIndirectCommand2KHR.html>"]
119151
#[must_use]
120152
pub struct TraceRaysIndirectCommand2KHR {
153+
/// raygenShaderRecordAddress is a VkDeviceAddress of the ray generation shader binding table record used by this command.
121154
pub raygen_shader_record_address: DeviceAddress,
155+
/// raygenShaderRecordSize is a VkDeviceSize number of bytes corresponding to the ray generation shader binding table record at base address raygenShaderRecordAddress.
122156
pub raygen_shader_record_size: DeviceSize,
157+
/// missShaderBindingTableAddress is a VkDeviceAddress of the first record in the miss shader binding table used by this command.
123158
pub miss_shader_binding_table_address: DeviceAddress,
159+
/// missShaderBindingTableSize is a VkDeviceSize number of bytes corresponding to the total size of the miss shader binding table at missShaderBindingTableAddress that may be accessed by this command.
124160
pub miss_shader_binding_table_size: DeviceSize,
161+
/// missShaderBindingTableStride is a VkDeviceSize number of bytes between records of the miss shader binding table.
125162
pub miss_shader_binding_table_stride: DeviceSize,
163+
/// hitShaderBindingTableAddress is a VkDeviceAddress of the first record in the hit shader binding table used by this command.
126164
pub hit_shader_binding_table_address: DeviceAddress,
165+
/// hitShaderBindingTableSize is a VkDeviceSize number of bytes corresponding to the total size of the hit shader binding table at hitShaderBindingTableAddress that may be accessed by this command.
127166
pub hit_shader_binding_table_size: DeviceSize,
167+
/// hitShaderBindingTableStride is a VkDeviceSize number of bytes between records of the hit shader binding table.
128168
pub hit_shader_binding_table_stride: DeviceSize,
169+
/// callableShaderBindingTableAddress is a VkDeviceAddress of the first record in the callable shader binding table used by this command.
129170
pub callable_shader_binding_table_address: DeviceAddress,
171+
/// callableShaderBindingTableSize is a VkDeviceSize number of bytes corresponding to the total size of the callable shader binding table at callableShaderBindingTableAddress that may be accessed by this command.
130172
pub callable_shader_binding_table_size: DeviceSize,
173+
/// callableShaderBindingTableStride is a VkDeviceSize number of bytes between records of the callable shader binding table.
131174
pub callable_shader_binding_table_stride: DeviceSize,
175+
/// width is the width of the ray trace query dimensions.
132176
pub width: u32,
177+
/// height is height of the ray trace query dimensions.
133178
pub height: u32,
179+
/// depth is depth of the ray trace query dimensions.
134180
pub depth: u32,
135181
}

0 commit comments

Comments
 (0)