jay_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 unsafe {
17 let mut info = mem::MaybeUninit::<vk::ShaderStatisticsInfoAMD>::uninit();
18 let mut size = size_of_val(&info);
19 (self.fp.get_shader_info_amd)(
20 self.handle,
21 pipeline,
22 shader_stage,
23 vk::ShaderInfoTypeAMD::STATISTICS,
24 &mut size,
25 info.as_mut_ptr().cast(),
26 )
27 .result()?;
28 assert_eq!(size, size_of_val(&info));
29 Ok(info.assume_init())
30 }
31 }
32
33 #[inline]
35 pub unsafe fn get_shader_info_binary(
36 &self,
37 pipeline: vk::Pipeline,
38 shader_stage: vk::ShaderStageFlags,
39 ) -> VkResult<Vec<u8>> {
40 unsafe {
41 read_into_uninitialized_vector(|count, data: *mut u8| {
42 (self.fp.get_shader_info_amd)(
43 self.handle,
44 pipeline,
45 shader_stage,
46 vk::ShaderInfoTypeAMD::BINARY,
47 count,
48 data.cast(),
49 )
50 })
51 }
52 }
53
54 #[inline]
56 pub unsafe fn get_shader_info_disassembly(
57 &self,
58 pipeline: vk::Pipeline,
59 shader_stage: vk::ShaderStageFlags,
60 ) -> VkResult<Vec<u8>> {
61 unsafe {
62 read_into_uninitialized_vector(|count, data: *mut u8| {
63 (self.fp.get_shader_info_amd)(
64 self.handle,
65 pipeline,
66 shader_stage,
67 vk::ShaderInfoTypeAMD::DISASSEMBLY,
68 count,
69 data.cast(),
70 )
71 })
72 }
73 }
74}