ash/extensions/amd/
shader_info.rs1use crate::prelude::*;
4use crate::vk;
5use alloc::vec::Vec;
6use core::mem;
7
8impl crate::amd::shader_info::Device {
9 #[inline]
11 pub unsafe fn get_shader_info_statistics(
12 &self,
13 pipeline: vk::Pipeline,
14 shader_stage: vk::ShaderStageFlags,
15 ) -> VkResult<vk::ShaderStatisticsInfoAMD> {
16 let mut info = mem::MaybeUninit::<vk::ShaderStatisticsInfoAMD>::uninit();
17 let mut size = mem::size_of_val(&info);
18 (self.fp.get_shader_info_amd)(
19 self.handle,
20 pipeline,
21 shader_stage,
22 vk::ShaderInfoTypeAMD::STATISTICS,
23 &mut size,
24 info.as_mut_ptr().cast(),
25 )
26 .result()?;
27 assert_eq!(size, mem::size_of_val(&info));
28 Ok(info.assume_init())
29 }
30
31 #[inline]
33 pub unsafe fn get_shader_info_binary(
34 &self,
35 pipeline: vk::Pipeline,
36 shader_stage: vk::ShaderStageFlags,
37 ) -> VkResult<Vec<u8>> {
38 read_into_uninitialized_vector(|count, data: *mut u8| {
39 (self.fp.get_shader_info_amd)(
40 self.handle,
41 pipeline,
42 shader_stage,
43 vk::ShaderInfoTypeAMD::BINARY,
44 count,
45 data.cast(),
46 )
47 })
48 }
49
50 #[inline]
52 pub unsafe fn get_shader_info_disassembly(
53 &self,
54 pipeline: vk::Pipeline,
55 shader_stage: vk::ShaderStageFlags,
56 ) -> VkResult<Vec<u8>> {
57 read_into_uninitialized_vector(|count, data: *mut u8| {
58 (self.fp.get_shader_info_amd)(
59 self.handle,
60 pipeline,
61 shader_stage,
62 vk::ShaderInfoTypeAMD::DISASSEMBLY,
63 count,
64 data.cast(),
65 )
66 })
67 }
68}