Debian Codegraph @

third_party/rust/ash/src/extensions/amdx/shader_enqueue.rs

raw
1 //! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_AMDX_shader_enqueue.html>
2
3 use crate::prelude::*;
4 use crate::vk;
5 use crate::RawPtr;
6 use alloc::vec::Vec;
7 use core::mem;
8
9 impl crate::amdx::shader_enqueue::Device {
10 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateExecutionGraphPipelinesAMDX.html>
11 ///
12 /// Pipelines are created and returned as described for [Multiple Pipeline Creation].
13 ///
14 /// [Multiple Pipeline Creation]: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#pipelines-multiple
15 #[inline]
16 pub unsafe fn create_execution_graph_pipelines(
17 &self,
18 pipeline_cache: vk::PipelineCache,
19 create_infos: &[vk::ExecutionGraphPipelineCreateInfoAMDX<'_>],
20 allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
21 ) -> Result<Vec<vk::Pipeline>, (Vec<vk::Pipeline>, vk::Result)> {
22 let mut pipelines = Vec::with_capacity(create_infos.len());
23 let err_code = (self.fp.create_execution_graph_pipelines_amdx)(
24 self.handle,
25 pipeline_cache,
26 create_infos.len() as u32,
27 create_infos.as_ptr(),
28 allocation_callbacks.as_raw_ptr(),
29 pipelines.as_mut_ptr(),
30 );
31 pipelines.set_len(create_infos.len());
32 match err_code {
33 vk::Result::SUCCESS => Ok(pipelines),
34 _ => Err((pipelines, err_code)),
35 }
36 }
37
38 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetExecutionGraphPipelineScratchSizeAMDX.html>
39 #[inline]
40 pub unsafe fn get_execution_graph_pipeline_scratch_size(
41 &self,
42 execution_graph: vk::Pipeline,
43 size_info: &mut vk::ExecutionGraphPipelineScratchSizeAMDX<'_>,
44 ) -> VkResult<()> {
45 (self.fp.get_execution_graph_pipeline_scratch_size_amdx)(
46 self.handle,
47 execution_graph,
48 size_info,
49 )
50 .result()
51 }
52
53 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetExecutionGraphPipelineNodeIndexAMDX.html>
54 #[inline]
55 pub unsafe fn get_execution_graph_pipeline_node_index(
56 &self,
57 execution_graph: vk::Pipeline,
58 node_info: &vk::PipelineShaderStageNodeCreateInfoAMDX<'_>,
59 ) -> VkResult<u32> {
60 let mut node_index = mem::MaybeUninit::uninit();
61 (self.fp.get_execution_graph_pipeline_node_index_amdx)(
62 self.handle,
63 execution_graph,
64 node_info,
65 node_index.as_mut_ptr(),
66 )
67 .assume_init_on_success(node_index)
68 }
69
70 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdInitializeGraphScratchMemoryAMDX.html>
71 #[inline]
72 pub unsafe fn cmd_initialize_graph_scratch_memory(
73 &self,
74 command_buffer: vk::CommandBuffer,
75 scratch: vk::DeviceAddress,
76 ) {
77 (self.fp.cmd_initialize_graph_scratch_memory_amdx)(command_buffer, scratch)
78 }
79
80 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDispatchGraphAMDX.html>
81 #[inline]
82 pub unsafe fn cmd_dispatch_graph(
83 &self,
84 command_buffer: vk::CommandBuffer,
85 scratch: vk::DeviceAddress,
86 count_info: &vk::DispatchGraphCountInfoAMDX,
87 ) {
88 (self.fp.cmd_dispatch_graph_amdx)(command_buffer, scratch, count_info)
89 }
90
91 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDispatchGraphIndirectAMDX.html>
92 #[inline]
93 pub unsafe fn cmd_dispatch_graph_indirect(
94 &self,
95 command_buffer: vk::CommandBuffer,
96 scratch: vk::DeviceAddress,
97 count_info: &vk::DispatchGraphCountInfoAMDX,
98 ) {
99 (self.fp.cmd_dispatch_graph_indirect_amdx)(command_buffer, scratch, count_info)
100 }
101
102 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDispatchGraphIndirectCountAMDX.html>
103 #[inline]
104 pub unsafe fn cmd_dispatch_graph_indirect_count(
105 &self,
106 command_buffer: vk::CommandBuffer,
107 scratch: vk::DeviceAddress,
108 count_info: vk::DeviceAddress,
109 ) {
110 (self.fp.cmd_dispatch_graph_indirect_count_amdx)(command_buffer, scratch, count_info)
111 }
112 }