@@ -4,10 +4,12 @@ use crate::prelude::*;
44use crate :: vk;
55use crate :: RawPtr as _;
66use core:: mem;
7+ use core:: ptr;
78
89impl crate :: khr:: video_queue:: Device {
9- #[ inline]
1010 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkBindVideoSessionMemoryKHR.html>
11+ #[ doc( alias = "vkBindVideoSessionMemoryKHR" ) ]
12+ #[ inline]
1113 pub unsafe fn bind_video_session_memory (
1214 & self ,
1315 video_session : vk:: VideoSessionKHR ,
@@ -22,72 +24,78 @@ impl crate::khr::video_queue::Device {
2224 . result ( )
2325 }
2426
25- #[ inline]
2627 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdBeginVideoCodingKHR.html>
28+ #[ doc( alias = "vkCmdBeginVideoCodingKHR" ) ]
29+ #[ inline]
2730 pub unsafe fn cmd_begin_video_coding (
2831 & self ,
2932 command_buffer : vk:: CommandBuffer ,
3033 begin_info : & vk:: VideoBeginCodingInfoKHR < ' _ > ,
3134 ) {
32- ( self . fp . cmd_begin_video_coding_khr ) ( command_buffer, begin_info) ;
35+ ( self . fp . cmd_begin_video_coding_khr ) ( command_buffer, begin_info)
3336 }
3437
35- #[ inline]
3638 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdControlVideoCodingKHR.html>
39+ #[ doc( alias = "vkCmdControlVideoCodingKHR" ) ]
40+ #[ inline]
3741 pub unsafe fn cmd_control_video_coding (
3842 & self ,
3943 command_buffer : vk:: CommandBuffer ,
4044 coding_control_info : & vk:: VideoCodingControlInfoKHR < ' _ > ,
4145 ) {
42- ( self . fp . cmd_control_video_coding_khr ) ( command_buffer, coding_control_info) ;
46+ ( self . fp . cmd_control_video_coding_khr ) ( command_buffer, coding_control_info)
4347 }
4448
45- #[ inline]
4649 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdEndVideoCodingKHR.html>
50+ #[ doc( alias = "vkCmdEndVideoCodingKHR" ) ]
51+ #[ inline]
4752 pub unsafe fn cmd_end_video_coding (
4853 & self ,
4954 command_buffer : vk:: CommandBuffer ,
5055 end_coding_info : & vk:: VideoEndCodingInfoKHR < ' _ > ,
5156 ) {
52- ( self . fp . cmd_end_video_coding_khr ) ( command_buffer, end_coding_info) ;
57+ ( self . fp . cmd_end_video_coding_khr ) ( command_buffer, end_coding_info)
5358 }
5459
55- #[ inline]
5660 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateVideoSessionKHR.html>
61+ #[ doc( alias = "vkCreateVideoSessionKHR" ) ]
62+ #[ inline]
5763 pub unsafe fn create_video_session (
5864 & self ,
5965 create_info : & vk:: VideoSessionCreateInfoKHR < ' _ > ,
6066 allocation_callbacks : Option < & vk:: AllocationCallbacks < ' _ > > ,
6167 ) -> VkResult < vk:: VideoSessionKHR > {
62- let mut video_session = mem:: zeroed ( ) ;
68+ let mut video_session = mem:: MaybeUninit :: uninit ( ) ;
6369 ( self . fp . create_video_session_khr ) (
6470 self . handle ,
6571 create_info,
6672 allocation_callbacks. as_raw_ptr ( ) ,
67- & mut video_session,
73+ video_session. as_mut_ptr ( ) ,
6874 )
69- . result_with_success ( video_session)
75+ . assume_init_on_success ( video_session)
7076 }
7177
72- #[ inline]
7378 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateVideoSessionParametersKHR.html>
79+ #[ doc( alias = "vkCreateVideoSessionParametersKHR" ) ]
80+ #[ inline]
7481 pub unsafe fn create_video_session_parameters (
7582 & self ,
7683 create_info : & vk:: VideoSessionParametersCreateInfoKHR < ' _ > ,
7784 allocation_callbacks : Option < & vk:: AllocationCallbacks < ' _ > > ,
7885 ) -> VkResult < vk:: VideoSessionParametersKHR > {
79- let mut video_session_parameters = mem:: zeroed ( ) ;
86+ let mut video_session_parameters = mem:: MaybeUninit :: uninit ( ) ;
8087 ( self . fp . create_video_session_parameters_khr ) (
8188 self . handle ,
8289 create_info,
8390 allocation_callbacks. as_raw_ptr ( ) ,
84- & mut video_session_parameters,
91+ video_session_parameters. as_mut_ptr ( ) ,
8592 )
86- . result_with_success ( video_session_parameters)
93+ . assume_init_on_success ( video_session_parameters)
8794 }
8895
89- #[ inline]
9096 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkDestroyVideoSessionKHR.html>
97+ #[ doc( alias = "vkDestroyVideoSessionKHR" ) ]
98+ #[ inline]
9199 pub unsafe fn destroy_video_session (
92100 & self ,
93101 video_session : vk:: VideoSessionKHR ,
@@ -97,11 +105,12 @@ impl crate::khr::video_queue::Device {
97105 self . handle ,
98106 video_session,
99107 allocation_callbacks. as_raw_ptr ( ) ,
100- ) ;
108+ )
101109 }
102110
103- #[ inline]
104111 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkDestroyVideoSessionParametersKHR.html>
112+ #[ doc( alias = "vkDestroyVideoSessionParametersKHR" ) ]
113+ #[ inline]
105114 pub unsafe fn destroy_video_session_parameters (
106115 & self ,
107116 video_session_parameters : vk:: VideoSessionParametersKHR ,
@@ -111,27 +120,53 @@ impl crate::khr::video_queue::Device {
111120 self . handle ,
112121 video_session_parameters,
113122 allocation_callbacks. as_raw_ptr ( ) ,
114- ) ;
123+ )
115124 }
116125
126+ /// Retrieve the number of elements to pass to [`get_video_session_memory_requirements()`][Self::get_video_session_memory_requirements],
117127 #[ inline]
128+ pub unsafe fn get_video_session_memory_requirements_len (
129+ & self ,
130+ video_session : vk:: VideoSessionKHR ,
131+ ) -> VkResult < usize > {
132+ let mut req_count = mem:: MaybeUninit :: uninit ( ) ;
133+ ( self . fp . get_video_session_memory_requirements_khr ) (
134+ self . handle ,
135+ video_session,
136+ req_count. as_mut_ptr ( ) ,
137+ ptr:: null_mut ( ) ,
138+ )
139+ . assume_init_on_success ( req_count)
140+ . map ( |c| c as usize )
141+ }
142+
118143 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetVideoSessionMemoryRequirementsKHR.html>
144+ ///
145+ /// Call [`get_video_session_memory_requirements_len()`][Self::get_video_session_memory_requirements_len] to query the number of elements to pass to `out.`
146+ /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
147+ #[ doc( alias = "vkGetVideoSessionMemoryRequirementsKHR" ) ]
148+ #[ inline]
119149 pub unsafe fn get_video_session_memory_requirements (
120150 & self ,
121151 video_session : vk:: VideoSessionKHR ,
122- ) -> VkResult < Vec < vk:: VideoSessionMemoryRequirementsKHR < ' _ > > > {
123- read_into_defaulted_vector ( |count, data| {
124- ( self . fp . get_video_session_memory_requirements_khr ) (
125- self . handle ,
126- video_session,
127- count,
128- data,
129- )
130- } )
152+ out : & mut [ vk:: VideoSessionMemoryRequirementsKHR < ' _ > ] ,
153+ ) -> VkResult < ( ) > {
154+ let mut req_count = out. len ( ) as u32 ;
155+ ( self . fp . get_video_session_memory_requirements_khr ) (
156+ self . handle ,
157+ video_session,
158+ & mut req_count,
159+ out. as_mut_ptr ( ) ,
160+ )
161+ . result ( ) ?;
162+
163+ assert_eq ! ( req_count as usize , out. len( ) ) ;
164+ Ok ( ( ) )
131165 }
132166
133- #[ inline]
134167 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkUpdateVideoSessionParametersKHR.html>
168+ #[ doc( alias = "vkUpdateVideoSessionParametersKHR" ) ]
169+ #[ inline]
135170 pub unsafe fn update_video_session_parameters (
136171 & self ,
137172 video_session_parameters : vk:: VideoSessionParametersKHR ,
@@ -147,8 +182,9 @@ impl crate::khr::video_queue::Device {
147182}
148183
149184impl crate :: khr:: video_queue:: Instance {
150- #[ inline]
151185 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceVideoCapabilitiesKHR.html>
186+ #[ doc( alias = "vkGetPhysicalDeviceVideoCapabilitiesKHR" ) ]
187+ #[ inline]
152188 pub unsafe fn get_physical_device_video_capabilities (
153189 & self ,
154190 physical_device : vk:: PhysicalDevice ,
@@ -163,20 +199,46 @@ impl crate::khr::video_queue::Instance {
163199 . result ( )
164200 }
165201
202+ /// Retrieve the number of elements to pass to [`get_physical_device_video_format_properties()`][Self::get_physical_device_video_format_properties],
166203 #[ inline]
204+ pub unsafe fn get_physical_device_video_format_properties_len (
205+ & self ,
206+ physical_device : vk:: PhysicalDevice ,
207+ video_format_info : & vk:: PhysicalDeviceVideoFormatInfoKHR < ' _ > ,
208+ ) -> VkResult < usize > {
209+ let mut format_count = mem:: MaybeUninit :: uninit ( ) ;
210+ ( self . fp . get_physical_device_video_format_properties_khr ) (
211+ physical_device,
212+ video_format_info,
213+ format_count. as_mut_ptr ( ) ,
214+ ptr:: null_mut ( ) ,
215+ )
216+ . assume_init_on_success ( format_count)
217+ . map ( |c| c as usize )
218+ }
219+
167220 /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceVideoFormatPropertiesKHR.html>
221+ ///
222+ /// Call [`get_physical_device_video_format_properties_len()`][Self::get_physical_device_video_format_properties_len] to query the number of elements to pass to `out.`
223+ /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
224+ #[ doc( alias = "vkGetPhysicalDeviceVideoFormatPropertiesKHR" ) ]
225+ #[ inline]
168226 pub unsafe fn get_physical_device_video_format_properties (
169227 & self ,
170228 physical_device : vk:: PhysicalDevice ,
171229 video_format_info : & vk:: PhysicalDeviceVideoFormatInfoKHR < ' _ > ,
172- ) -> VkResult < Vec < vk:: VideoFormatPropertiesKHR < ' _ > > > {
173- read_into_defaulted_vector ( |count, data| {
174- ( self . fp . get_physical_device_video_format_properties_khr ) (
175- physical_device,
176- video_format_info,
177- count,
178- data,
179- )
180- } )
230+ out : & mut [ vk:: VideoFormatPropertiesKHR < ' _ > ] ,
231+ ) -> VkResult < ( ) > {
232+ let mut format_count = out. len ( ) as u32 ;
233+ ( self . fp . get_physical_device_video_format_properties_khr ) (
234+ physical_device,
235+ video_format_info,
236+ & mut format_count,
237+ out. as_mut_ptr ( ) ,
238+ )
239+ . result ( ) ?;
240+
241+ assert_eq ! ( format_count as usize , out. len( ) ) ;
242+ Ok ( ( ) )
181243 }
182244}
0 commit comments