ash/extensions/amdx/
shader_enqueue.rs1use crate::prelude::*;
4use crate::vk;
5use crate::RawPtr;
6use alloc::vec::Vec;
7use core::mem;
8
9impl crate::amdx::shader_enqueue::Device {
10 #[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 #[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 #[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 #[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 #[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 #[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 #[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}