1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 // Copyright 2018 Jacob Lifshay
4 // allow unneeded_field_pattern to ensure fields aren't accidently missed
5 #![cfg_attr(feature = "cargo-clippy", allow(clippy::unneeded_field_pattern))]
8 use buffer::{Buffer, BufferMemory};
11 Descriptor, DescriptorLayout, DescriptorPool, DescriptorSet, DescriptorSetLayout,
15 DeviceMemory, DeviceMemoryAllocation, DeviceMemoryHeap, DeviceMemoryHeaps, DeviceMemoryLayout,
16 DeviceMemoryType, DeviceMemoryTypes,
18 use enum_map::EnumMap;
19 use handle::{Handle, MutHandle, OwnedHandle, SharedHandle};
21 ComponentMapping, Image, ImageMemory, ImageMultisampleCount, ImageProperties, ImageView,
22 ImageViewType, SupportedTilings,
24 use render_pass::RenderPass;
27 use shader_module::ShaderModule;
30 use std::iter::FromIterator;
33 use std::os::raw::{c_char, c_void};
35 use std::ptr::null_mut;
36 #[cfg(target_os = "linux")]
37 use std::ptr::NonNull;
39 use std::str::FromStr;
40 use swapchain::SurfacePlatform;
43 #[cfg(target_os = "linux")]
46 /// structure types the driver should know about
47 fn is_supported_structure_type(v: api::VkStructureType) -> bool {
48 #[cfg(target_os = "linux")]
50 #[cfg_attr(feature = "cargo-clippy", allow(clippy::single_match))]
52 api::VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR => return true,
57 api::VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR
58 | api::VK_STRUCTURE_TYPE_APPLICATION_INFO
59 | api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO
60 | api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO
61 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO
62 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO
63 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR
64 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO
65 | api::VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
66 | api::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
67 | api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
68 | api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2
69 | api::VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
70 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
71 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
72 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO
73 | api::VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
74 | api::VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
75 | api::VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
76 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
77 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
78 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
79 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT
80 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO
81 | api::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
82 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO
83 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO
84 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO
85 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR
86 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR
87 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO
88 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO
89 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR
90 | api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
91 | api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2
92 | api::VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
93 | api::VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO
94 | api::VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO
95 | api::VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO
96 | api::VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES
97 | api::VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES
98 | api::VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES
99 | api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO
100 | api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO
101 | api::VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES
102 | api::VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
103 | api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2
104 | api::VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
105 | api::VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
106 | api::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
107 | api::VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2
108 | api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
109 | api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2
110 | api::VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO
111 | api::VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2
112 | api::VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR
113 | api::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
114 | api::VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO
115 | api::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
116 | api::VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
117 | api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO
118 | api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
119 | api::VK_STRUCTURE_TYPE_MEMORY_BARRIER
120 | api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO
121 | api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS
122 | api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2
123 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES
124 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO
125 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO
126 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO
127 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO
128 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2
129 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES
130 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES
131 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2
132 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES
133 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2
134 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES
135 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES
136 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES
137 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2
138 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES
139 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES
140 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES
141 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES
142 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2
143 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES
144 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR
145 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES
146 | api::VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
147 | api::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
148 | api::VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
149 | api::VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
150 | api::VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
151 | api::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
152 | api::VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
153 | api::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
154 | api::VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
155 | api::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO
156 | api::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
157 | api::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
158 | api::VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
159 | api::VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
160 | api::VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO
161 | api::VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
162 | api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2
163 | api::VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
164 | api::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
165 | api::VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO
166 | api::VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO
167 | api::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
168 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO
169 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES
170 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO
171 | api::VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
172 | api::VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
173 | api::VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2
174 | api::VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2
175 | api::VK_STRUCTURE_TYPE_SUBMIT_INFO
176 | api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR
177 | api::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
178 | api::VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET => true,
183 fn verify_structure_type_is_supported(v: api::VkStructureType) {
185 is_supported_structure_type(v),
186 "missing structure type in is_supported_structure_type: {:?}",
191 unsafe fn parse_next_chain_const(
192 root: *const api::VkBaseInStructure,
193 expected_root_struct_type: api::VkStructureType,
194 expected_child_structs: &[(api::VkStructureType, *mut *const api::VkBaseInStructure)],
196 verify_structure_type_is_supported(expected_root_struct_type);
198 assert_eq!(root.sType, expected_root_struct_type);
199 for &(child_struct_type, child_struct) in expected_child_structs.iter() {
200 verify_structure_type_is_supported(child_struct_type);
201 *child_struct = null();
203 let mut child = root.pNext as *const api::VkBaseInStructure;
204 while !child.is_null() {
205 let child_ref = &*child;
206 let search_for_type = child_ref.sType;
207 let mut found = false;
208 for &(child_struct_type, child_struct) in expected_child_structs.iter() {
209 if child_struct_type == search_for_type {
211 (*child_struct).is_null(),
212 "duplicate struct type in pNext chain: {:?}",
215 *child_struct = child;
221 found || !is_supported_structure_type(search_for_type),
222 "unexpected struct type in pNext chain: {:?}",
225 child = child_ref.pNext as *const _;
229 unsafe fn parse_next_chain_mut(
230 root: *mut api::VkBaseOutStructure,
231 expected_root_struct_type: api::VkStructureType,
232 expected_child_structs: &[(api::VkStructureType, *mut *mut api::VkBaseOutStructure)],
234 parse_next_chain_const(
235 root as *const api::VkBaseInStructure,
236 expected_root_struct_type,
237 &*(expected_child_structs as *const [(u32, *mut *mut api::VkBaseOutStructure)]
238 as *const [(u32, *mut *const api::VkBaseInStructure)]),
242 macro_rules! parse_next_chain_const {
245 root = $root_type:expr,
246 $($name:ident: $var_type:ty = $struct_type:expr,)*
248 $(let mut $name: *const $var_type = null();)*
249 parse_next_chain_const(
250 $root as *const _ as *const api::VkBaseInStructure,
252 &[$(($struct_type, &mut $name as *mut *const $var_type as *mut *const api::VkBaseInStructure)),*]
257 macro_rules! parse_next_chain_mut {
260 root = $root_type:expr,
261 $($name:ident: $var_type:ty = $struct_type:expr,)*
263 $(let mut $name: *mut $var_type = null_mut();)*
264 parse_next_chain_mut(
265 $root as *mut _ as *mut api::VkBaseOutStructure,
267 &[$(($struct_type, &mut $name as *mut *mut $var_type as *mut *mut api::VkBaseOutStructure)),*]
272 fn copy_str_to_char_array(dest: &mut [c_char], src: &str) {
273 #![cfg_attr(feature = "cargo-clippy", allow(clippy::int_plus_one))]
274 assert!(dest.len() >= src.len() + 1);
275 let src = src.as_bytes();
276 for i in 0..src.len() {
277 dest[i] = src[i] as c_char;
279 for v in dest.iter_mut().skip(src.len()) {
284 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Enum)]
286 #[allow(non_camel_case_types)]
290 VK_KHR_device_group_creation,
292 VK_KHR_descriptor_update_template,
294 VK_KHR_get_memory_requirements2,
295 VK_KHR_get_physical_device_properties2,
296 VK_KHR_sampler_ycbcr_conversion,
299 VK_KHR_external_memory_capabilities,
300 VK_KHR_external_fence_capabilities,
301 VK_KHR_external_semaphore_capabilities,
302 VK_KHR_16bit_storage,
303 VK_KHR_storage_buffer_storage_class,
304 VK_KHR_dedicated_allocation,
305 VK_KHR_external_fence,
306 VK_KHR_external_memory,
307 VK_KHR_external_semaphore,
309 VK_KHR_relaxed_block_layout,
310 VK_KHR_shader_draw_parameters,
311 VK_KHR_variable_pointers,
313 #[cfg(target_os = "linux")]
317 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
318 pub enum ExtensionScope {
323 macro_rules! extensions {
324 [$($extension:expr),*] => {
326 let extensions: Extensions = [$($extension),*].iter().map(|v|*v).collect();
333 pub fn get_required_extensions(self) -> Extensions {
335 Extension::VK_KHR_surface
336 | Extension::VK_KHR_bind_memory2
337 | Extension::VK_KHR_device_group_creation
338 | Extension::VK_KHR_descriptor_update_template
339 | Extension::VK_KHR_maintenance1
340 | Extension::VK_KHR_get_memory_requirements2
341 | Extension::VK_KHR_get_physical_device_properties2
342 | Extension::VK_KHR_maintenance2
343 | Extension::VK_KHR_storage_buffer_storage_class
344 | Extension::VK_KHR_relaxed_block_layout
345 | Extension::VK_KHR_shader_draw_parameters => extensions![],
346 Extension::VK_KHR_device_group => extensions![Extension::VK_KHR_device_group_creation],
347 Extension::VK_KHR_sampler_ycbcr_conversion => extensions![
348 Extension::VK_KHR_maintenance1,
349 Extension::VK_KHR_bind_memory2,
350 Extension::VK_KHR_get_memory_requirements2,
351 Extension::VK_KHR_get_physical_device_properties2
353 Extension::VK_KHR_maintenance3
354 | Extension::VK_KHR_external_memory_capabilities
355 | Extension::VK_KHR_external_fence_capabilities
356 | Extension::VK_KHR_external_semaphore_capabilities
357 | Extension::VK_KHR_multiview => {
358 extensions![Extension::VK_KHR_get_physical_device_properties2]
360 Extension::VK_KHR_16bit_storage | Extension::VK_KHR_variable_pointers => extensions![
361 Extension::VK_KHR_get_physical_device_properties2,
362 Extension::VK_KHR_storage_buffer_storage_class
364 Extension::VK_KHR_dedicated_allocation => {
365 extensions![Extension::VK_KHR_get_memory_requirements2]
367 Extension::VK_KHR_external_fence => {
368 extensions![Extension::VK_KHR_external_fence_capabilities]
370 Extension::VK_KHR_external_memory => {
371 extensions![Extension::VK_KHR_external_memory_capabilities]
373 Extension::VK_KHR_external_semaphore => {
374 extensions![Extension::VK_KHR_external_semaphore_capabilities]
376 Extension::VK_KHR_swapchain => extensions![Extension::VK_KHR_surface],
377 #[cfg(target_os = "linux")]
378 Extension::VK_KHR_xcb_surface => extensions![Extension::VK_KHR_surface],
381 pub fn get_recursively_required_extensions(self) -> Extensions {
382 let mut retval = self.get_required_extensions();
383 let mut worklist: EnumMap<Extension, Extension> = enum_map!{_ => self};
384 let worklist = worklist.as_mut_slice();
385 let mut worklist_size = 1;
386 while worklist_size > 0 {
388 let extension = worklist[worklist_size];
389 retval[extension] = true;
390 for (extension, &v) in extension.get_required_extensions().iter() {
391 if v && !retval[extension] {
392 worklist[worklist_size] = extension;
399 pub fn get_name(self) -> &'static str {
401 ($($(#[$attributes:meta])* $name:ident,)*) => {
403 $($(#[$attributes])* Extension::$name => stringify!($name),)*
411 VK_KHR_device_group_creation,
412 VK_KHR_descriptor_update_template,
414 VK_KHR_get_memory_requirements2,
415 VK_KHR_get_physical_device_properties2,
416 VK_KHR_sampler_ycbcr_conversion,
419 VK_KHR_external_memory_capabilities,
420 VK_KHR_external_fence_capabilities,
421 VK_KHR_external_semaphore_capabilities,
422 VK_KHR_16bit_storage,
423 VK_KHR_storage_buffer_storage_class,
424 VK_KHR_dedicated_allocation,
425 VK_KHR_external_fence,
426 VK_KHR_external_memory,
427 VK_KHR_external_semaphore,
429 VK_KHR_relaxed_block_layout,
430 VK_KHR_shader_draw_parameters,
431 VK_KHR_variable_pointers,
433 #[cfg(target_os = "linux")]
437 pub fn get_spec_version(self) -> u32 {
439 Extension::VK_KHR_surface => api::VK_KHR_SURFACE_SPEC_VERSION,
440 Extension::VK_KHR_bind_memory2 => api::VK_KHR_BIND_MEMORY_2_SPEC_VERSION,
441 Extension::VK_KHR_device_group => api::VK_KHR_DEVICE_GROUP_SPEC_VERSION,
442 Extension::VK_KHR_device_group_creation => {
443 api::VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION
445 Extension::VK_KHR_descriptor_update_template => {
446 api::VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION
448 Extension::VK_KHR_maintenance1 => api::VK_KHR_MAINTENANCE1_SPEC_VERSION,
449 Extension::VK_KHR_get_memory_requirements2 => {
450 api::VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION
452 Extension::VK_KHR_get_physical_device_properties2 => {
453 api::VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION
455 Extension::VK_KHR_sampler_ycbcr_conversion => {
456 api::VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION
458 Extension::VK_KHR_maintenance2 => api::VK_KHR_MAINTENANCE2_SPEC_VERSION,
459 Extension::VK_KHR_maintenance3 => api::VK_KHR_MAINTENANCE3_SPEC_VERSION,
460 Extension::VK_KHR_external_memory_capabilities => {
461 api::VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION
463 Extension::VK_KHR_external_fence_capabilities => {
464 api::VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION
466 Extension::VK_KHR_external_semaphore_capabilities => {
467 api::VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION
469 Extension::VK_KHR_16bit_storage => api::VK_KHR_16BIT_STORAGE_SPEC_VERSION,
470 Extension::VK_KHR_storage_buffer_storage_class => {
471 api::VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION
473 Extension::VK_KHR_dedicated_allocation => api::VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION,
474 Extension::VK_KHR_external_fence => api::VK_KHR_EXTERNAL_FENCE_SPEC_VERSION,
475 Extension::VK_KHR_external_memory => api::VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION,
476 Extension::VK_KHR_external_semaphore => api::VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION,
477 Extension::VK_KHR_multiview => api::VK_KHR_MULTIVIEW_SPEC_VERSION,
478 Extension::VK_KHR_relaxed_block_layout => api::VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION,
479 Extension::VK_KHR_shader_draw_parameters => {
480 api::VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION
482 Extension::VK_KHR_variable_pointers => api::VK_KHR_VARIABLE_POINTERS_SPEC_VERSION,
483 Extension::VK_KHR_swapchain => api::VK_KHR_SWAPCHAIN_SPEC_VERSION,
484 #[cfg(target_os = "linux")]
485 Extension::VK_KHR_xcb_surface => api::VK_KHR_XCB_SURFACE_SPEC_VERSION,
488 pub fn get_properties(self) -> api::VkExtensionProperties {
489 let mut retval = api::VkExtensionProperties {
490 extensionName: [0; api::VK_MAX_EXTENSION_NAME_SIZE as usize],
491 specVersion: self.get_spec_version(),
493 copy_str_to_char_array(&mut retval.extensionName, self.get_name());
496 pub fn get_scope(self) -> ExtensionScope {
498 Extension::VK_KHR_surface
499 | Extension::VK_KHR_device_group_creation
500 | Extension::VK_KHR_get_physical_device_properties2
501 | Extension::VK_KHR_external_memory_capabilities
502 | Extension::VK_KHR_external_fence_capabilities
503 | Extension::VK_KHR_external_semaphore_capabilities => ExtensionScope::Instance,
504 Extension::VK_KHR_bind_memory2
505 | Extension::VK_KHR_device_group
506 | Extension::VK_KHR_descriptor_update_template
507 | Extension::VK_KHR_maintenance1
508 | Extension::VK_KHR_get_memory_requirements2
509 | Extension::VK_KHR_sampler_ycbcr_conversion
510 | Extension::VK_KHR_maintenance2
511 | Extension::VK_KHR_maintenance3
512 | Extension::VK_KHR_16bit_storage
513 | Extension::VK_KHR_storage_buffer_storage_class
514 | Extension::VK_KHR_dedicated_allocation
515 | Extension::VK_KHR_external_fence
516 | Extension::VK_KHR_external_memory
517 | Extension::VK_KHR_external_semaphore
518 | Extension::VK_KHR_multiview
519 | Extension::VK_KHR_relaxed_block_layout
520 | Extension::VK_KHR_shader_draw_parameters
521 | Extension::VK_KHR_variable_pointers
522 | Extension::VK_KHR_swapchain => ExtensionScope::Device,
523 #[cfg(target_os = "linux")]
524 Extension::VK_KHR_xcb_surface => ExtensionScope::Instance,
529 impl FromStr for Extension {
531 fn from_str(s: &str) -> Result<Self, Self::Err> {
532 for (i, _) in Extensions::default().iter() {
533 if s == i.get_name() {
541 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
542 pub struct Extensions(EnumMap<Extension, bool>);
545 pub fn create_empty() -> Self {
546 Extensions(enum_map!{_ => false})
548 pub fn is_empty(&self) -> bool {
549 self.iter().all(|(_, &v)| !v)
552 pub fn is_full(&self) -> bool {
553 self.iter().all(|(_, &v)| v)
555 pub fn get_allowed_extensions_from_instance_scope(&self) -> Self {
556 let mut retval = Extensions::default();
557 let instance_extensions = Self::instance_extensions();
558 for (extension, value) in retval.iter_mut() {
559 if extension.get_scope() == ExtensionScope::Instance {
560 *value = self[extension];
563 let required_extensions =
564 instance_extensions & extension.get_recursively_required_extensions();
565 *value = (!*self & required_extensions).is_empty();
569 pub fn instance_extensions() -> Self {
571 (|extension: Extension| extension.get_scope() == ExtensionScope::Instance).into(),
575 pub fn device_extensions() -> Self {
576 !Self::instance_extensions()
580 impl FromIterator<Extension> for Extensions {
581 fn from_iter<T: IntoIterator<Item = Extension>>(v: T) -> Extensions {
582 let mut retval = Extensions::create_empty();
584 retval[extension] = true;
590 impl Default for Extensions {
591 fn default() -> Self {
596 impl Deref for Extensions {
597 type Target = EnumMap<Extension, bool>;
598 fn deref(&self) -> &Self::Target {
603 impl DerefMut for Extensions {
604 fn deref_mut(&mut self) -> &mut Self::Target {
609 impl BitAnd for Extensions {
611 fn bitand(self, rhs: Self) -> Self {
612 let mut retval = Self::default();
613 for (index, retval) in retval.iter_mut() {
614 *retval = self[index] & rhs[index];
620 impl BitOr for Extensions {
622 fn bitor(self, rhs: Self) -> Self {
623 let mut retval = Self::default();
624 for (index, retval) in retval.iter_mut() {
625 *retval = self[index] | rhs[index];
631 impl BitXor for Extensions {
633 fn bitxor(self, rhs: Self) -> Self {
634 let mut retval = Self::default();
635 for (index, retval) in retval.iter_mut() {
636 *retval = self[index] ^ rhs[index];
642 impl Not for Extensions {
644 fn not(mut self) -> Self {
645 for v in self.values_mut() {
652 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
653 enum GetProcAddressScope {
659 #[cfg_attr(feature = "cargo-clippy", allow(clippy::cyclomatic_complexity))]
662 scope: GetProcAddressScope,
663 extensions: &Extensions,
664 ) -> api::PFN_vkVoidFunction {
665 let mut name = unsafe { CStr::from_ptr(name) }.to_str().ok()?;
667 use std::mem::transmute;
674 global: scope != GetProcAddressScope::Device,
675 instance: scope == GetProcAddressScope::Instance,
676 device: scope != GetProcAddressScope::Global,
678 macro_rules! proc_alias_khr {
679 ($base_name:ident, $required_extension:expr) => {
680 if name == concat!(stringify!($base_name), "KHR") {
681 if scope.instance && $required_extension {
682 name = stringify!($base_name);
691 extensions[Extension::VK_KHR_bind_memory2]
695 extensions[Extension::VK_KHR_bind_memory2]
699 extensions[Extension::VK_KHR_device_group]
703 extensions[Extension::VK_KHR_device_group]
706 vkCreateDescriptorUpdateTemplate,
707 extensions[Extension::VK_KHR_descriptor_update_template]
710 vkCreateSamplerYcbcrConversion,
711 extensions[Extension::VK_KHR_sampler_ycbcr_conversion]
714 vkDestroyDescriptorUpdateTemplate,
715 extensions[Extension::VK_KHR_descriptor_update_template]
718 vkDestroySamplerYcbcrConversion,
719 extensions[Extension::VK_KHR_sampler_ycbcr_conversion]
722 vkEnumeratePhysicalDeviceGroups,
723 extensions[Extension::VK_KHR_device_group_creation]
726 vkGetBufferMemoryRequirements2,
727 extensions[Extension::VK_KHR_get_memory_requirements2]
730 vkGetDescriptorSetLayoutSupport,
731 extensions[Extension::VK_KHR_maintenance3]
734 vkGetDeviceGroupPeerMemoryFeatures,
735 extensions[Extension::VK_KHR_device_group]
738 vkGetImageMemoryRequirements2,
739 extensions[Extension::VK_KHR_get_memory_requirements2]
742 vkGetImageSparseMemoryRequirements2,
743 extensions[Extension::VK_KHR_get_memory_requirements2]
746 vkGetPhysicalDeviceExternalBufferProperties,
747 extensions[Extension::VK_KHR_external_memory_capabilities]
750 vkGetPhysicalDeviceExternalFenceProperties,
751 extensions[Extension::VK_KHR_external_fence_capabilities]
754 vkGetPhysicalDeviceExternalSemaphoreProperties,
755 extensions[Extension::VK_KHR_external_semaphore_capabilities]
758 vkGetPhysicalDeviceFeatures2,
759 extensions[Extension::VK_KHR_get_physical_device_properties2]
762 vkGetPhysicalDeviceFormatProperties2,
763 extensions[Extension::VK_KHR_get_physical_device_properties2]
766 vkGetPhysicalDeviceImageFormatProperties2,
767 extensions[Extension::VK_KHR_get_physical_device_properties2]
770 vkGetPhysicalDeviceMemoryProperties2,
771 extensions[Extension::VK_KHR_get_physical_device_properties2]
774 vkGetPhysicalDeviceProperties2,
775 extensions[Extension::VK_KHR_get_physical_device_properties2]
778 vkGetPhysicalDeviceQueueFamilyProperties2,
779 extensions[Extension::VK_KHR_get_physical_device_properties2]
782 vkGetPhysicalDeviceSparseImageFormatProperties2,
783 extensions[Extension::VK_KHR_get_physical_device_properties2]
787 extensions[Extension::VK_KHR_maintenance1]
790 vkUpdateDescriptorSetWithTemplate,
791 extensions[Extension::VK_KHR_descriptor_update_template]
793 macro_rules! proc_address {
794 ($name:ident, $pfn_name:ident, $required_scope:ident, $required_extension:expr) => {
795 if stringify!($name) == name {
796 if scope.$required_scope && $required_extension {
797 let f: $pfn_name = Some($name);
798 return unsafe { transmute(f) };
805 #[cfg_attr(rustfmt, rustfmt_skip)]
807 proc_address!(vkCreateInstance, PFN_vkCreateInstance, global, true);
808 proc_address!(vkEnumerateInstanceExtensionProperties, PFN_vkEnumerateInstanceExtensionProperties, global, true);
809 proc_address!(vkEnumerateInstanceLayerProperties, PFN_vkEnumerateInstanceLayerProperties, global, true);
810 proc_address!(vkEnumerateInstanceVersion, PFN_vkEnumerateInstanceVersion, global, true);
812 proc_address!(vkAllocateCommandBuffers, PFN_vkAllocateCommandBuffers, device, true);
813 proc_address!(vkAllocateDescriptorSets, PFN_vkAllocateDescriptorSets, device, true);
814 proc_address!(vkAllocateMemory, PFN_vkAllocateMemory, device, true);
815 proc_address!(vkBeginCommandBuffer, PFN_vkBeginCommandBuffer, device, true);
816 proc_address!(vkBindBufferMemory, PFN_vkBindBufferMemory, device, true);
817 proc_address!(vkBindBufferMemory2, PFN_vkBindBufferMemory2, device, true);
818 proc_address!(vkBindImageMemory, PFN_vkBindImageMemory, device, true);
819 proc_address!(vkBindImageMemory2, PFN_vkBindImageMemory2, device, true);
820 proc_address!(vkCmdBeginQuery, PFN_vkCmdBeginQuery, device, true);
821 proc_address!(vkCmdBeginRenderPass, PFN_vkCmdBeginRenderPass, device, true);
822 proc_address!(vkCmdBindDescriptorSets, PFN_vkCmdBindDescriptorSets, device, true);
823 proc_address!(vkCmdBindIndexBuffer, PFN_vkCmdBindIndexBuffer, device, true);
824 proc_address!(vkCmdBindPipeline, PFN_vkCmdBindPipeline, device, true);
825 proc_address!(vkCmdBindVertexBuffers, PFN_vkCmdBindVertexBuffers, device, true);
826 proc_address!(vkCmdBlitImage, PFN_vkCmdBlitImage, device, true);
827 proc_address!(vkCmdClearAttachments, PFN_vkCmdClearAttachments, device, true);
828 proc_address!(vkCmdClearColorImage, PFN_vkCmdClearColorImage, device, true);
829 proc_address!(vkCmdClearDepthStencilImage, PFN_vkCmdClearDepthStencilImage, device, true);
830 proc_address!(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, device, true);
831 proc_address!(vkCmdCopyBufferToImage, PFN_vkCmdCopyBufferToImage, device, true);
832 proc_address!(vkCmdCopyImage, PFN_vkCmdCopyImage, device, true);
833 proc_address!(vkCmdCopyImageToBuffer, PFN_vkCmdCopyImageToBuffer, device, true);
834 proc_address!(vkCmdCopyQueryPoolResults, PFN_vkCmdCopyQueryPoolResults, device, true);
835 proc_address!(vkCmdDispatch, PFN_vkCmdDispatch, device, true);
836 proc_address!(vkCmdDispatchBase, PFN_vkCmdDispatchBase, device, true);
837 proc_address!(vkCmdDispatchIndirect, PFN_vkCmdDispatchIndirect, device, true);
838 proc_address!(vkCmdDraw, PFN_vkCmdDraw, device, true);
839 proc_address!(vkCmdDrawIndexed, PFN_vkCmdDrawIndexed, device, true);
840 proc_address!(vkCmdDrawIndexedIndirect, PFN_vkCmdDrawIndexedIndirect, device, true);
841 proc_address!(vkCmdDrawIndirect, PFN_vkCmdDrawIndirect, device, true);
842 proc_address!(vkCmdEndQuery, PFN_vkCmdEndQuery, device, true);
843 proc_address!(vkCmdEndRenderPass, PFN_vkCmdEndRenderPass, device, true);
844 proc_address!(vkCmdExecuteCommands, PFN_vkCmdExecuteCommands, device, true);
845 proc_address!(vkCmdFillBuffer, PFN_vkCmdFillBuffer, device, true);
846 proc_address!(vkCmdNextSubpass, PFN_vkCmdNextSubpass, device, true);
847 proc_address!(vkCmdPipelineBarrier, PFN_vkCmdPipelineBarrier, device, true);
848 proc_address!(vkCmdPushConstants, PFN_vkCmdPushConstants, device, true);
849 proc_address!(vkCmdResetEvent, PFN_vkCmdResetEvent, device, true);
850 proc_address!(vkCmdResetQueryPool, PFN_vkCmdResetQueryPool, device, true);
851 proc_address!(vkCmdResolveImage, PFN_vkCmdResolveImage, device, true);
852 proc_address!(vkCmdSetBlendConstants, PFN_vkCmdSetBlendConstants, device, true);
853 proc_address!(vkCmdSetDepthBias, PFN_vkCmdSetDepthBias, device, true);
854 proc_address!(vkCmdSetDepthBounds, PFN_vkCmdSetDepthBounds, device, true);
855 proc_address!(vkCmdSetDeviceMask, PFN_vkCmdSetDeviceMask, device, true);
856 proc_address!(vkCmdSetEvent, PFN_vkCmdSetEvent, device, true);
857 proc_address!(vkCmdSetLineWidth, PFN_vkCmdSetLineWidth, device, true);
858 proc_address!(vkCmdSetScissor, PFN_vkCmdSetScissor, device, true);
859 proc_address!(vkCmdSetStencilCompareMask, PFN_vkCmdSetStencilCompareMask, device, true);
860 proc_address!(vkCmdSetStencilReference, PFN_vkCmdSetStencilReference, device, true);
861 proc_address!(vkCmdSetStencilWriteMask, PFN_vkCmdSetStencilWriteMask, device, true);
862 proc_address!(vkCmdSetViewport, PFN_vkCmdSetViewport, device, true);
863 proc_address!(vkCmdUpdateBuffer, PFN_vkCmdUpdateBuffer, device, true);
864 proc_address!(vkCmdWaitEvents, PFN_vkCmdWaitEvents, device, true);
865 proc_address!(vkCmdWriteTimestamp, PFN_vkCmdWriteTimestamp, device, true);
866 proc_address!(vkCreateBuffer, PFN_vkCreateBuffer, device, true);
867 proc_address!(vkCreateBufferView, PFN_vkCreateBufferView, device, true);
868 proc_address!(vkCreateCommandPool, PFN_vkCreateCommandPool, device, true);
869 proc_address!(vkCreateComputePipelines, PFN_vkCreateComputePipelines, device, true);
870 proc_address!(vkCreateDescriptorPool, PFN_vkCreateDescriptorPool, device, true);
871 proc_address!(vkCreateDescriptorSetLayout, PFN_vkCreateDescriptorSetLayout, device, true);
872 proc_address!(vkCreateDescriptorUpdateTemplate, PFN_vkCreateDescriptorUpdateTemplate, device, true);
873 proc_address!(vkCreateDevice, PFN_vkCreateDevice, instance, true);
874 proc_address!(vkCreateEvent, PFN_vkCreateEvent, device, true);
875 proc_address!(vkCreateFence, PFN_vkCreateFence, device, true);
876 proc_address!(vkCreateFramebuffer, PFN_vkCreateFramebuffer, device, true);
877 proc_address!(vkCreateGraphicsPipelines, PFN_vkCreateGraphicsPipelines, device, true);
878 proc_address!(vkCreateImage, PFN_vkCreateImage, device, true);
879 proc_address!(vkCreateImageView, PFN_vkCreateImageView, device, true);
880 proc_address!(vkCreatePipelineCache, PFN_vkCreatePipelineCache, device, true);
881 proc_address!(vkCreatePipelineLayout, PFN_vkCreatePipelineLayout, device, true);
882 proc_address!(vkCreateQueryPool, PFN_vkCreateQueryPool, device, true);
883 proc_address!(vkCreateRenderPass, PFN_vkCreateRenderPass, device, true);
884 proc_address!(vkCreateSampler, PFN_vkCreateSampler, device, true);
885 proc_address!(vkCreateSamplerYcbcrConversion, PFN_vkCreateSamplerYcbcrConversion, device, true);
886 proc_address!(vkCreateSemaphore, PFN_vkCreateSemaphore, device, true);
887 proc_address!(vkCreateShaderModule, PFN_vkCreateShaderModule, device, true);
888 proc_address!(vkDestroyBuffer, PFN_vkDestroyBuffer, device, true);
889 proc_address!(vkDestroyBufferView, PFN_vkDestroyBufferView, device, true);
890 proc_address!(vkDestroyCommandPool, PFN_vkDestroyCommandPool, device, true);
891 proc_address!(vkDestroyDescriptorPool, PFN_vkDestroyDescriptorPool, device, true);
892 proc_address!(vkDestroyDescriptorSetLayout, PFN_vkDestroyDescriptorSetLayout, device, true);
893 proc_address!(vkDestroyDescriptorUpdateTemplate, PFN_vkDestroyDescriptorUpdateTemplate, device, true);
894 proc_address!(vkDestroyDevice, PFN_vkDestroyDevice, device, true);
895 proc_address!(vkDestroyEvent, PFN_vkDestroyEvent, device, true);
896 proc_address!(vkDestroyFence, PFN_vkDestroyFence, device, true);
897 proc_address!(vkDestroyFramebuffer, PFN_vkDestroyFramebuffer, device, true);
898 proc_address!(vkDestroyImage, PFN_vkDestroyImage, device, true);
899 proc_address!(vkDestroyImageView, PFN_vkDestroyImageView, device, true);
900 proc_address!(vkDestroyInstance, PFN_vkDestroyInstance, instance, true);
901 proc_address!(vkDestroyPipeline, PFN_vkDestroyPipeline, device, true);
902 proc_address!(vkDestroyPipelineCache, PFN_vkDestroyPipelineCache, device, true);
903 proc_address!(vkDestroyPipelineLayout, PFN_vkDestroyPipelineLayout, device, true);
904 proc_address!(vkDestroyQueryPool, PFN_vkDestroyQueryPool, device, true);
905 proc_address!(vkDestroyRenderPass, PFN_vkDestroyRenderPass, device, true);
906 proc_address!(vkDestroySampler, PFN_vkDestroySampler, device, true);
907 proc_address!(vkDestroySamplerYcbcrConversion, PFN_vkDestroySamplerYcbcrConversion, device, true);
908 proc_address!(vkDestroySemaphore, PFN_vkDestroySemaphore, device, true);
909 proc_address!(vkDestroyShaderModule, PFN_vkDestroyShaderModule, device, true);
910 proc_address!(vkDeviceWaitIdle, PFN_vkDeviceWaitIdle, device, true);
911 proc_address!(vkEndCommandBuffer, PFN_vkEndCommandBuffer, device, true);
912 proc_address!(vkEnumerateDeviceExtensionProperties, PFN_vkEnumerateDeviceExtensionProperties, instance, true);
913 proc_address!(vkEnumerateDeviceLayerProperties, PFN_vkEnumerateDeviceLayerProperties, instance, true);
914 proc_address!(vkEnumeratePhysicalDeviceGroups, PFN_vkEnumeratePhysicalDeviceGroups, instance, true);
915 proc_address!(vkEnumeratePhysicalDevices, PFN_vkEnumeratePhysicalDevices, instance, true);
916 proc_address!(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, device, true);
917 proc_address!(vkFreeCommandBuffers, PFN_vkFreeCommandBuffers, device, true);
918 proc_address!(vkFreeDescriptorSets, PFN_vkFreeDescriptorSets, device, true);
919 proc_address!(vkFreeMemory, PFN_vkFreeMemory, device, true);
920 proc_address!(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, device, true);
921 proc_address!(vkGetBufferMemoryRequirements2, PFN_vkGetBufferMemoryRequirements2, device, true);
922 proc_address!(vkGetDescriptorSetLayoutSupport, PFN_vkGetDescriptorSetLayoutSupport, device, true);
923 proc_address!(vkGetDeviceGroupPeerMemoryFeatures, PFN_vkGetDeviceGroupPeerMemoryFeatures, device, true);
924 proc_address!(vkGetDeviceMemoryCommitment, PFN_vkGetDeviceMemoryCommitment, device, true);
925 proc_address!(vkGetDeviceProcAddr, PFN_vkGetDeviceProcAddr, device, true);
926 proc_address!(vkGetDeviceQueue, PFN_vkGetDeviceQueue, device, true);
927 proc_address!(vkGetDeviceQueue2, PFN_vkGetDeviceQueue2, device, true);
928 proc_address!(vkGetEventStatus, PFN_vkGetEventStatus, device, true);
929 proc_address!(vkGetFenceStatus, PFN_vkGetFenceStatus, device, true);
930 proc_address!(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, device, true);
931 proc_address!(vkGetImageMemoryRequirements2, PFN_vkGetImageMemoryRequirements2, device, true);
932 proc_address!(vkGetImageSparseMemoryRequirements, PFN_vkGetImageSparseMemoryRequirements, device, true);
933 proc_address!(vkGetImageSparseMemoryRequirements2, PFN_vkGetImageSparseMemoryRequirements2, device, true);
934 proc_address!(vkGetImageSubresourceLayout, PFN_vkGetImageSubresourceLayout, device, true);
935 proc_address!(vkGetInstanceProcAddr, PFN_vkGetInstanceProcAddr, device, true);
936 proc_address!(vkGetPhysicalDeviceExternalBufferProperties, PFN_vkGetPhysicalDeviceExternalBufferProperties, instance, true);
937 proc_address!(vkGetPhysicalDeviceExternalFenceProperties, PFN_vkGetPhysicalDeviceExternalFenceProperties, instance, true);
938 proc_address!(vkGetPhysicalDeviceExternalSemaphoreProperties, PFN_vkGetPhysicalDeviceExternalSemaphoreProperties, instance, true);
939 proc_address!(vkGetPhysicalDeviceFeatures, PFN_vkGetPhysicalDeviceFeatures, instance, true);
940 proc_address!(vkGetPhysicalDeviceFeatures2, PFN_vkGetPhysicalDeviceFeatures2, instance, true);
941 proc_address!(vkGetPhysicalDeviceFormatProperties, PFN_vkGetPhysicalDeviceFormatProperties, instance, true);
942 proc_address!(vkGetPhysicalDeviceFormatProperties2, PFN_vkGetPhysicalDeviceFormatProperties2, instance, true);
943 proc_address!(vkGetPhysicalDeviceImageFormatProperties, PFN_vkGetPhysicalDeviceImageFormatProperties, instance, true);
944 proc_address!(vkGetPhysicalDeviceImageFormatProperties2, PFN_vkGetPhysicalDeviceImageFormatProperties2, instance, true);
945 proc_address!(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, instance, true);
946 proc_address!(vkGetPhysicalDeviceMemoryProperties2, PFN_vkGetPhysicalDeviceMemoryProperties2, instance, true);
947 proc_address!(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, instance, true);
948 proc_address!(vkGetPhysicalDeviceProperties2, PFN_vkGetPhysicalDeviceProperties2, instance, true);
949 proc_address!(vkGetPhysicalDeviceQueueFamilyProperties, PFN_vkGetPhysicalDeviceQueueFamilyProperties, instance, true);
950 proc_address!(vkGetPhysicalDeviceQueueFamilyProperties2, PFN_vkGetPhysicalDeviceQueueFamilyProperties2, instance, true);
951 proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties, PFN_vkGetPhysicalDeviceSparseImageFormatProperties, instance, true);
952 proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties2, PFN_vkGetPhysicalDeviceSparseImageFormatProperties2, instance, true);
953 proc_address!(vkGetPipelineCacheData, PFN_vkGetPipelineCacheData, device, true);
954 proc_address!(vkGetQueryPoolResults, PFN_vkGetQueryPoolResults, device, true);
955 proc_address!(vkGetRenderAreaGranularity, PFN_vkGetRenderAreaGranularity, device, true);
956 proc_address!(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, device, true);
957 proc_address!(vkMapMemory, PFN_vkMapMemory, device, true);
958 proc_address!(vkMergePipelineCaches, PFN_vkMergePipelineCaches, device, true);
959 proc_address!(vkQueueBindSparse, PFN_vkQueueBindSparse, device, true);
960 proc_address!(vkQueueSubmit, PFN_vkQueueSubmit, device, true);
961 proc_address!(vkQueueWaitIdle, PFN_vkQueueWaitIdle, device, true);
962 proc_address!(vkResetCommandBuffer, PFN_vkResetCommandBuffer, device, true);
963 proc_address!(vkResetCommandPool, PFN_vkResetCommandPool, device, true);
964 proc_address!(vkResetDescriptorPool, PFN_vkResetDescriptorPool, device, true);
965 proc_address!(vkResetEvent, PFN_vkResetEvent, device, true);
966 proc_address!(vkResetFences, PFN_vkResetFences, device, true);
967 proc_address!(vkSetEvent, PFN_vkSetEvent, device, true);
968 proc_address!(vkTrimCommandPool, PFN_vkTrimCommandPool, device, true);
969 proc_address!(vkUnmapMemory, PFN_vkUnmapMemory, device, true);
970 proc_address!(vkUpdateDescriptorSets, PFN_vkUpdateDescriptorSets, device, true);
971 proc_address!(vkUpdateDescriptorSetWithTemplate, PFN_vkUpdateDescriptorSetWithTemplate, device, true);
972 proc_address!(vkWaitForFences, PFN_vkWaitForFences, device, true);
974 proc_address!(vkDestroySurfaceKHR, PFN_vkDestroySurfaceKHR, device, extensions[Extension::VK_KHR_surface]);
975 proc_address!(vkGetPhysicalDeviceSurfaceSupportKHR, PFN_vkGetPhysicalDeviceSurfaceSupportKHR, device, extensions[Extension::VK_KHR_surface]);
976 proc_address!(vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, device, extensions[Extension::VK_KHR_surface]);
977 proc_address!(vkGetPhysicalDeviceSurfaceFormatsKHR, PFN_vkGetPhysicalDeviceSurfaceFormatsKHR, device, extensions[Extension::VK_KHR_surface]);
978 proc_address!(vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR, device, extensions[Extension::VK_KHR_surface]);
980 proc_address!(vkCreateSwapchainKHR, PFN_vkCreateSwapchainKHR, device, extensions[Extension::VK_KHR_swapchain]);
981 proc_address!(vkDestroySwapchainKHR, PFN_vkDestroySwapchainKHR, device, extensions[Extension::VK_KHR_swapchain]);
982 proc_address!(vkGetSwapchainImagesKHR, PFN_vkGetSwapchainImagesKHR, device, extensions[Extension::VK_KHR_swapchain]);
983 proc_address!(vkAcquireNextImageKHR, PFN_vkAcquireNextImageKHR, device, extensions[Extension::VK_KHR_swapchain]);
984 proc_address!(vkQueuePresentKHR, PFN_vkQueuePresentKHR, device, extensions[Extension::VK_KHR_swapchain]);
985 proc_address!(vkGetDeviceGroupPresentCapabilitiesKHR, PFN_vkGetDeviceGroupPresentCapabilitiesKHR, device, extensions[Extension::VK_KHR_swapchain]);
986 proc_address!(vkGetDeviceGroupSurfacePresentModesKHR, PFN_vkGetDeviceGroupSurfacePresentModesKHR, device, extensions[Extension::VK_KHR_swapchain]);
987 proc_address!(vkGetPhysicalDevicePresentRectanglesKHR, PFN_vkGetPhysicalDevicePresentRectanglesKHR, device, extensions[Extension::VK_KHR_swapchain]);
988 proc_address!(vkAcquireNextImage2KHR, PFN_vkAcquireNextImage2KHR, device, extensions[Extension::VK_KHR_swapchain]);
990 #[cfg(target_os = "linux")]
991 proc_address!(vkCreateXcbSurfaceKHR, PFN_vkCreateXcbSurfaceKHR, device, extensions[Extension::VK_KHR_xcb_surface]);
992 #[cfg(target_os = "linux")]
993 proc_address!(vkGetPhysicalDeviceXcbPresentationSupportKHR, PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR, device, extensions[Extension::VK_KHR_xcb_surface]);
995 proc_address!(vkCmdBeginConditionalRenderingEXT, PFN_vkCmdBeginConditionalRenderingEXT, device, unknown);
996 proc_address!(vkCmdBeginDebugUtilsLabelEXT, PFN_vkCmdBeginDebugUtilsLabelEXT, device, unknown);
997 proc_address!(vkCmdBeginRenderPass2KHR, PFN_vkCmdBeginRenderPass2KHR, device, unknown);
998 proc_address!(vkCmdBindShadingRateImageNV, PFN_vkCmdBindShadingRateImageNV, device, unknown);
999 proc_address!(vkCmdDebugMarkerBeginEXT, PFN_vkCmdDebugMarkerBeginEXT, device, unknown);
1000 proc_address!(vkCmdDebugMarkerEndEXT, PFN_vkCmdDebugMarkerEndEXT, device, unknown);
1001 proc_address!(vkCmdDebugMarkerInsertEXT, PFN_vkCmdDebugMarkerInsertEXT, device, unknown);
1002 proc_address!(vkCmdDrawIndexedIndirectCountAMD, PFN_vkCmdDrawIndexedIndirectCountAMD, device, unknown);
1003 proc_address!(vkCmdDrawIndexedIndirectCountKHR, PFN_vkCmdDrawIndexedIndirectCountKHR, device, unknown);
1004 proc_address!(vkCmdDrawIndirectCountAMD, PFN_vkCmdDrawIndirectCountAMD, device, unknown);
1005 proc_address!(vkCmdDrawIndirectCountKHR, PFN_vkCmdDrawIndirectCountKHR, device, unknown);
1006 proc_address!(vkCmdDrawMeshTasksIndirectCountNV, PFN_vkCmdDrawMeshTasksIndirectCountNV, device, unknown);
1007 proc_address!(vkCmdDrawMeshTasksIndirectNV, PFN_vkCmdDrawMeshTasksIndirectNV, device, unknown);
1008 proc_address!(vkCmdDrawMeshTasksNV, PFN_vkCmdDrawMeshTasksNV, device, unknown);
1009 proc_address!(vkCmdEndConditionalRenderingEXT, PFN_vkCmdEndConditionalRenderingEXT, device, unknown);
1010 proc_address!(vkCmdEndDebugUtilsLabelEXT, PFN_vkCmdEndDebugUtilsLabelEXT, device, unknown);
1011 proc_address!(vkCmdEndRenderPass2KHR, PFN_vkCmdEndRenderPass2KHR, device, unknown);
1012 proc_address!(vkCmdInsertDebugUtilsLabelEXT, PFN_vkCmdInsertDebugUtilsLabelEXT, device, unknown);
1013 proc_address!(vkCmdNextSubpass2KHR, PFN_vkCmdNextSubpass2KHR, device, unknown);
1014 proc_address!(vkCmdPushDescriptorSetKHR, PFN_vkCmdPushDescriptorSetKHR, device, unknown);
1015 proc_address!(vkCmdPushDescriptorSetWithTemplateKHR, PFN_vkCmdPushDescriptorSetWithTemplateKHR, device, unknown);
1016 proc_address!(vkCmdSetCheckpointNV, PFN_vkCmdSetCheckpointNV, device, unknown);
1017 proc_address!(vkCmdSetCoarseSampleOrderNV, PFN_vkCmdSetCoarseSampleOrderNV, device, unknown);
1018 proc_address!(vkCmdSetDiscardRectangleEXT, PFN_vkCmdSetDiscardRectangleEXT, device, unknown);
1019 proc_address!(vkCmdSetExclusiveScissorNV, PFN_vkCmdSetExclusiveScissorNV, device, unknown);
1020 proc_address!(vkCmdSetSampleLocationsEXT, PFN_vkCmdSetSampleLocationsEXT, device, unknown);
1021 proc_address!(vkCmdSetViewportShadingRatePaletteNV, PFN_vkCmdSetViewportShadingRatePaletteNV, device, unknown);
1022 proc_address!(vkCmdSetViewportWScalingNV, PFN_vkCmdSetViewportWScalingNV, device, unknown);
1023 proc_address!(vkCmdWriteBufferMarkerAMD, PFN_vkCmdWriteBufferMarkerAMD, device, unknown);
1024 proc_address!(vkCreateDebugReportCallbackEXT, PFN_vkCreateDebugReportCallbackEXT, device, unknown);
1025 proc_address!(vkCreateDebugUtilsMessengerEXT, PFN_vkCreateDebugUtilsMessengerEXT, device, unknown);
1026 proc_address!(vkCreateDisplayModeKHR, PFN_vkCreateDisplayModeKHR, device, unknown);
1027 proc_address!(vkCreateDisplayPlaneSurfaceKHR, PFN_vkCreateDisplayPlaneSurfaceKHR, device, unknown);
1028 proc_address!(vkCreateRenderPass2KHR, PFN_vkCreateRenderPass2KHR, device, unknown);
1029 proc_address!(vkCreateSharedSwapchainsKHR, PFN_vkCreateSharedSwapchainsKHR, device, unknown);
1030 proc_address!(vkCreateValidationCacheEXT, PFN_vkCreateValidationCacheEXT, device, unknown);
1031 proc_address!(vkDebugMarkerSetObjectNameEXT, PFN_vkDebugMarkerSetObjectNameEXT, device, unknown);
1032 proc_address!(vkDebugMarkerSetObjectTagEXT, PFN_vkDebugMarkerSetObjectTagEXT, device, unknown);
1033 proc_address!(vkDebugReportCallbackEXT, PFN_vkDebugReportCallbackEXT, device, unknown);
1034 proc_address!(vkDebugReportMessageEXT, PFN_vkDebugReportMessageEXT, device, unknown);
1035 proc_address!(vkDebugUtilsMessengerCallbackEXT, PFN_vkDebugUtilsMessengerCallbackEXT, device, unknown);
1036 proc_address!(vkDestroyDebugReportCallbackEXT, PFN_vkDestroyDebugReportCallbackEXT, device, unknown);
1037 proc_address!(vkDestroyDebugUtilsMessengerEXT, PFN_vkDestroyDebugUtilsMessengerEXT, device, unknown);
1038 proc_address!(vkDestroyValidationCacheEXT, PFN_vkDestroyValidationCacheEXT, device, unknown);
1039 proc_address!(vkDisplayPowerControlEXT, PFN_vkDisplayPowerControlEXT, device, unknown);
1040 proc_address!(vkGetDisplayModeProperties2KHR, PFN_vkGetDisplayModeProperties2KHR, device, unknown);
1041 proc_address!(vkGetDisplayModePropertiesKHR, PFN_vkGetDisplayModePropertiesKHR, device, unknown);
1042 proc_address!(vkGetDisplayPlaneCapabilities2KHR, PFN_vkGetDisplayPlaneCapabilities2KHR, device, unknown);
1043 proc_address!(vkGetDisplayPlaneCapabilitiesKHR, PFN_vkGetDisplayPlaneCapabilitiesKHR, device, unknown);
1044 proc_address!(vkGetDisplayPlaneSupportedDisplaysKHR, PFN_vkGetDisplayPlaneSupportedDisplaysKHR, device, unknown);
1045 proc_address!(vkGetFenceFdKHR, PFN_vkGetFenceFdKHR, device, unknown);
1046 proc_address!(vkGetMemoryFdKHR, PFN_vkGetMemoryFdKHR, device, unknown);
1047 proc_address!(vkGetMemoryFdPropertiesKHR, PFN_vkGetMemoryFdPropertiesKHR, device, unknown);
1048 proc_address!(vkGetMemoryHostPointerPropertiesEXT, PFN_vkGetMemoryHostPointerPropertiesEXT, device, unknown);
1049 proc_address!(vkGetPastPresentationTimingGOOGLE, PFN_vkGetPastPresentationTimingGOOGLE, device, unknown);
1050 proc_address!(vkGetPhysicalDeviceDisplayPlaneProperties2KHR, PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR, device, unknown);
1051 proc_address!(vkGetPhysicalDeviceDisplayPlanePropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR, device, unknown);
1052 proc_address!(vkGetPhysicalDeviceDisplayProperties2KHR, PFN_vkGetPhysicalDeviceDisplayProperties2KHR, device, unknown);
1053 proc_address!(vkGetPhysicalDeviceDisplayPropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPropertiesKHR, device, unknown);
1054 proc_address!(vkGetPhysicalDeviceExternalImageFormatPropertiesNV, PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV, device, unknown);
1055 proc_address!(vkGetPhysicalDeviceMultisamplePropertiesEXT, PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT, device, unknown);
1056 proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2EXT, PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT, device, unknown);
1057 proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2KHR, PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR, device, unknown);
1058 proc_address!(vkGetPhysicalDeviceSurfaceFormats2KHR, PFN_vkGetPhysicalDeviceSurfaceFormats2KHR, device, unknown);
1059 proc_address!(vkGetQueueCheckpointDataNV, PFN_vkGetQueueCheckpointDataNV, device, unknown);
1060 proc_address!(vkGetRefreshCycleDurationGOOGLE, PFN_vkGetRefreshCycleDurationGOOGLE, device, unknown);
1061 proc_address!(vkGetSemaphoreFdKHR, PFN_vkGetSemaphoreFdKHR, device, unknown);
1062 proc_address!(vkGetShaderInfoAMD, PFN_vkGetShaderInfoAMD, device, unknown);
1063 proc_address!(vkGetSwapchainCounterEXT, PFN_vkGetSwapchainCounterEXT, device, unknown);
1064 proc_address!(vkGetSwapchainStatusKHR, PFN_vkGetSwapchainStatusKHR, device, unknown);
1065 proc_address!(vkGetValidationCacheDataEXT, PFN_vkGetValidationCacheDataEXT, device, unknown);
1066 proc_address!(vkImportFenceFdKHR, PFN_vkImportFenceFdKHR, device, unknown);
1067 proc_address!(vkImportSemaphoreFdKHR, PFN_vkImportSemaphoreFdKHR, device, unknown);
1068 proc_address!(vkMergeValidationCachesEXT, PFN_vkMergeValidationCachesEXT, device, unknown);
1069 proc_address!(vkQueueBeginDebugUtilsLabelEXT, PFN_vkQueueBeginDebugUtilsLabelEXT, device, unknown);
1070 proc_address!(vkQueueEndDebugUtilsLabelEXT, PFN_vkQueueEndDebugUtilsLabelEXT, device, unknown);
1071 proc_address!(vkQueueInsertDebugUtilsLabelEXT, PFN_vkQueueInsertDebugUtilsLabelEXT, device, unknown);
1072 proc_address!(vkRegisterDeviceEventEXT, PFN_vkRegisterDeviceEventEXT, device, unknown);
1073 proc_address!(vkRegisterDisplayEventEXT, PFN_vkRegisterDisplayEventEXT, device, unknown);
1074 proc_address!(vkReleaseDisplayEXT, PFN_vkReleaseDisplayEXT, device, unknown);
1075 proc_address!(vkSetDebugUtilsObjectNameEXT, PFN_vkSetDebugUtilsObjectNameEXT, device, unknown);
1076 proc_address!(vkSetDebugUtilsObjectTagEXT, PFN_vkSetDebugUtilsObjectTagEXT, device, unknown);
1077 proc_address!(vkSetHdrMetadataEXT, PFN_vkSetHdrMetadataEXT, device, unknown);
1078 proc_address!(vkSubmitDebugUtilsMessageEXT, PFN_vkSubmitDebugUtilsMessageEXT, device, unknown);
1081 //eprintln!("unknown function: {:?}", name);
1085 #[derive(Debug, Copy, Clone)]
1086 pub struct Features {
1087 features: api::VkPhysicalDeviceFeatures,
1088 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures,
1089 sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures,
1090 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures,
1091 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures,
1092 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures,
1093 multiview_features: api::VkPhysicalDeviceMultiviewFeatures,
1099 features: api::VkPhysicalDeviceFeatures {
1100 robustBufferAccess: api::VK_TRUE,
1101 fullDrawIndexUint32: api::VK_TRUE,
1102 imageCubeArray: api::VK_TRUE,
1103 independentBlend: api::VK_FALSE,
1104 geometryShader: api::VK_FALSE,
1105 tessellationShader: api::VK_FALSE,
1106 sampleRateShading: api::VK_FALSE,
1107 dualSrcBlend: api::VK_FALSE,
1108 logicOp: api::VK_TRUE,
1109 multiDrawIndirect: api::VK_TRUE,
1110 drawIndirectFirstInstance: api::VK_TRUE,
1111 depthClamp: api::VK_FALSE,
1112 depthBiasClamp: api::VK_FALSE,
1113 fillModeNonSolid: api::VK_TRUE,
1114 depthBounds: api::VK_FALSE,
1115 wideLines: api::VK_FALSE,
1116 largePoints: api::VK_FALSE,
1117 alphaToOne: api::VK_TRUE,
1118 multiViewport: api::VK_TRUE,
1119 samplerAnisotropy: api::VK_FALSE,
1120 textureCompressionETC2: api::VK_FALSE, // FIXME: enable texture compression
1121 textureCompressionASTC_LDR: api::VK_FALSE, // FIXME: enable texture compression
1122 textureCompressionBC: api::VK_FALSE, // FIXME: enable texture compression
1123 occlusionQueryPrecise: api::VK_FALSE,
1124 pipelineStatisticsQuery: api::VK_FALSE,
1125 vertexPipelineStoresAndAtomics: api::VK_TRUE,
1126 fragmentStoresAndAtomics: api::VK_TRUE,
1127 shaderTessellationAndGeometryPointSize: api::VK_FALSE,
1128 shaderImageGatherExtended: api::VK_FALSE,
1129 shaderStorageImageExtendedFormats: api::VK_FALSE,
1130 shaderStorageImageMultisample: api::VK_FALSE,
1131 shaderStorageImageReadWithoutFormat: api::VK_FALSE,
1132 shaderStorageImageWriteWithoutFormat: api::VK_FALSE,
1133 shaderUniformBufferArrayDynamicIndexing: api::VK_TRUE,
1134 shaderSampledImageArrayDynamicIndexing: api::VK_TRUE,
1135 shaderStorageBufferArrayDynamicIndexing: api::VK_TRUE,
1136 shaderStorageImageArrayDynamicIndexing: api::VK_TRUE,
1137 shaderClipDistance: api::VK_FALSE,
1138 shaderCullDistance: api::VK_FALSE,
1139 shaderFloat64: api::VK_TRUE,
1140 shaderInt64: api::VK_TRUE,
1141 shaderInt16: api::VK_TRUE,
1142 shaderResourceResidency: api::VK_FALSE,
1143 shaderResourceMinLod: api::VK_FALSE,
1144 sparseBinding: api::VK_FALSE,
1145 sparseResidencyBuffer: api::VK_FALSE,
1146 sparseResidencyImage2D: api::VK_FALSE,
1147 sparseResidencyImage3D: api::VK_FALSE,
1148 sparseResidency2Samples: api::VK_FALSE,
1149 sparseResidency4Samples: api::VK_FALSE,
1150 sparseResidency8Samples: api::VK_FALSE,
1151 sparseResidency16Samples: api::VK_FALSE,
1152 sparseResidencyAliased: api::VK_FALSE,
1153 variableMultisampleRate: api::VK_FALSE,
1154 inheritedQueries: api::VK_FALSE,
1156 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures {
1157 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1159 storageBuffer16BitAccess: api::VK_TRUE,
1160 uniformAndStorageBuffer16BitAccess: api::VK_TRUE,
1161 storagePushConstant16: api::VK_TRUE,
1162 storageInputOutput16: api::VK_TRUE,
1164 sampler_ycbcr_conversion_features:
1165 api::VkPhysicalDeviceSamplerYcbcrConversionFeatures {
1166 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1168 samplerYcbcrConversion: api::VK_FALSE,
1170 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures {
1171 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1173 variablePointersStorageBuffer: api::VK_TRUE,
1174 variablePointers: api::VK_TRUE,
1176 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures {
1177 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1179 shaderDrawParameters: api::VK_TRUE,
1181 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures {
1182 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1184 protectedMemory: api::VK_FALSE,
1186 multiview_features: api::VkPhysicalDeviceMultiviewFeatures {
1187 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1189 multiview: api::VK_FALSE,
1190 multiviewGeometryShader: api::VK_FALSE,
1191 multiviewTessellationShader: api::VK_FALSE,
1195 fn splat(value: bool) -> Self {
1196 let value32 = if value { api::VK_TRUE } else { api::VK_FALSE };
1198 features: api::VkPhysicalDeviceFeatures {
1199 robustBufferAccess: value32,
1200 fullDrawIndexUint32: value32,
1201 imageCubeArray: value32,
1202 independentBlend: value32,
1203 geometryShader: value32,
1204 tessellationShader: value32,
1205 sampleRateShading: value32,
1206 dualSrcBlend: value32,
1208 multiDrawIndirect: value32,
1209 drawIndirectFirstInstance: value32,
1210 depthClamp: value32,
1211 depthBiasClamp: value32,
1212 fillModeNonSolid: value32,
1213 depthBounds: value32,
1215 largePoints: value32,
1216 alphaToOne: value32,
1217 multiViewport: value32,
1218 samplerAnisotropy: value32,
1219 textureCompressionETC2: value32,
1220 textureCompressionASTC_LDR: value32,
1221 textureCompressionBC: value32,
1222 occlusionQueryPrecise: value32,
1223 pipelineStatisticsQuery: value32,
1224 vertexPipelineStoresAndAtomics: value32,
1225 fragmentStoresAndAtomics: value32,
1226 shaderTessellationAndGeometryPointSize: value32,
1227 shaderImageGatherExtended: value32,
1228 shaderStorageImageExtendedFormats: value32,
1229 shaderStorageImageMultisample: value32,
1230 shaderStorageImageReadWithoutFormat: value32,
1231 shaderStorageImageWriteWithoutFormat: value32,
1232 shaderUniformBufferArrayDynamicIndexing: value32,
1233 shaderSampledImageArrayDynamicIndexing: value32,
1234 shaderStorageBufferArrayDynamicIndexing: value32,
1235 shaderStorageImageArrayDynamicIndexing: value32,
1236 shaderClipDistance: value32,
1237 shaderCullDistance: value32,
1238 shaderFloat64: value32,
1239 shaderInt64: value32,
1240 shaderInt16: value32,
1241 shaderResourceResidency: value32,
1242 shaderResourceMinLod: value32,
1243 sparseBinding: value32,
1244 sparseResidencyBuffer: value32,
1245 sparseResidencyImage2D: value32,
1246 sparseResidencyImage3D: value32,
1247 sparseResidency2Samples: value32,
1248 sparseResidency4Samples: value32,
1249 sparseResidency8Samples: value32,
1250 sparseResidency16Samples: value32,
1251 sparseResidencyAliased: value32,
1252 variableMultisampleRate: value32,
1253 inheritedQueries: value32,
1255 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures {
1256 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1258 storageBuffer16BitAccess: value32,
1259 uniformAndStorageBuffer16BitAccess: value32,
1260 storagePushConstant16: value32,
1261 storageInputOutput16: value32,
1263 sampler_ycbcr_conversion_features:
1264 api::VkPhysicalDeviceSamplerYcbcrConversionFeatures {
1265 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1267 samplerYcbcrConversion: value32,
1269 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures {
1270 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1272 variablePointersStorageBuffer: value32,
1273 variablePointers: value32,
1275 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures {
1276 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1278 shaderDrawParameters: value32,
1280 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures {
1281 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1283 protectedMemory: value32,
1285 multiview_features: api::VkPhysicalDeviceMultiviewFeatures {
1286 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1289 multiviewGeometryShader: value32,
1290 multiviewTessellationShader: value32,
1294 fn visit2_mut<F: FnMut(&mut bool, &mut bool)>(&mut self, rhs: &mut Self, f: F) {
1295 struct VisitorStruct<F: FnMut(&mut bool, &mut bool)>(F);
1297 fn visit(&mut self, v1: &mut T, v2: &mut T);
1299 impl<F: FnMut(&mut bool, &mut bool)> Visitor<bool> for VisitorStruct<F> {
1300 fn visit(&mut self, v1: &mut bool, v2: &mut bool) {
1304 impl<F: FnMut(&mut bool, &mut bool)> Visitor<api::VkBool32> for VisitorStruct<F> {
1305 fn visit(&mut self, value1: &mut api::VkBool32, value2: &mut api::VkBool32) {
1306 let mut temp1 = *value1 != api::VK_FALSE;
1307 let mut temp2 = *value2 != api::VK_FALSE;
1308 (self.0)(&mut temp1, &mut temp2);
1309 *value1 = if temp1 { api::VK_TRUE } else { api::VK_FALSE };
1310 *value2 = if temp2 { api::VK_TRUE } else { api::VK_FALSE };
1313 let mut visitor = VisitorStruct(f);
1314 macro_rules! visit {
1315 ($member1:ident.$member2:ident) => {
1316 visitor.visit(&mut self.$member1.$member2, &mut rhs.$member1.$member2)
1318 ($member:ident) => {
1319 visitor.visit(&mut self.$member1, &mut rhs.$member1)
1322 visit!(features.robustBufferAccess);
1323 visit!(features.fullDrawIndexUint32);
1324 visit!(features.imageCubeArray);
1325 visit!(features.independentBlend);
1326 visit!(features.geometryShader);
1327 visit!(features.tessellationShader);
1328 visit!(features.sampleRateShading);
1329 visit!(features.dualSrcBlend);
1330 visit!(features.logicOp);
1331 visit!(features.multiDrawIndirect);
1332 visit!(features.drawIndirectFirstInstance);
1333 visit!(features.depthClamp);
1334 visit!(features.depthBiasClamp);
1335 visit!(features.fillModeNonSolid);
1336 visit!(features.depthBounds);
1337 visit!(features.wideLines);
1338 visit!(features.largePoints);
1339 visit!(features.alphaToOne);
1340 visit!(features.multiViewport);
1341 visit!(features.samplerAnisotropy);
1342 visit!(features.textureCompressionETC2);
1343 visit!(features.textureCompressionASTC_LDR);
1344 visit!(features.textureCompressionBC);
1345 visit!(features.occlusionQueryPrecise);
1346 visit!(features.pipelineStatisticsQuery);
1347 visit!(features.vertexPipelineStoresAndAtomics);
1348 visit!(features.fragmentStoresAndAtomics);
1349 visit!(features.shaderTessellationAndGeometryPointSize);
1350 visit!(features.shaderImageGatherExtended);
1351 visit!(features.shaderStorageImageExtendedFormats);
1352 visit!(features.shaderStorageImageMultisample);
1353 visit!(features.shaderStorageImageReadWithoutFormat);
1354 visit!(features.shaderStorageImageWriteWithoutFormat);
1355 visit!(features.shaderUniformBufferArrayDynamicIndexing);
1356 visit!(features.shaderSampledImageArrayDynamicIndexing);
1357 visit!(features.shaderStorageBufferArrayDynamicIndexing);
1358 visit!(features.shaderStorageImageArrayDynamicIndexing);
1359 visit!(features.shaderClipDistance);
1360 visit!(features.shaderCullDistance);
1361 visit!(features.shaderFloat64);
1362 visit!(features.shaderInt64);
1363 visit!(features.shaderInt16);
1364 visit!(features.shaderResourceResidency);
1365 visit!(features.shaderResourceMinLod);
1366 visit!(features.sparseBinding);
1367 visit!(features.sparseResidencyBuffer);
1368 visit!(features.sparseResidencyImage2D);
1369 visit!(features.sparseResidencyImage3D);
1370 visit!(features.sparseResidency2Samples);
1371 visit!(features.sparseResidency4Samples);
1372 visit!(features.sparseResidency8Samples);
1373 visit!(features.sparseResidency16Samples);
1374 visit!(features.sparseResidencyAliased);
1375 visit!(features.variableMultisampleRate);
1376 visit!(features.inheritedQueries);
1377 visit!(physical_device_16bit_storage_features.storageBuffer16BitAccess);
1378 visit!(physical_device_16bit_storage_features.uniformAndStorageBuffer16BitAccess);
1379 visit!(physical_device_16bit_storage_features.storagePushConstant16);
1380 visit!(physical_device_16bit_storage_features.storageInputOutput16);
1381 visit!(sampler_ycbcr_conversion_features.samplerYcbcrConversion);
1382 visit!(variable_pointer_features.variablePointersStorageBuffer);
1383 visit!(variable_pointer_features.variablePointers);
1384 visit!(shader_draw_parameter_features.shaderDrawParameters);
1385 visit!(protected_memory_features.protectedMemory);
1386 visit!(multiview_features.multiview);
1387 visit!(multiview_features.multiviewGeometryShader);
1388 visit!(multiview_features.multiviewTessellationShader);
1390 fn visit2<F: FnMut(bool, bool)>(mut self, mut rhs: Self, mut f: F) {
1391 self.visit2_mut(&mut rhs, |v1, v2| f(*v1, *v2));
1393 fn visit_mut<F: FnMut(&mut bool)>(&mut self, mut f: F) {
1394 let mut rhs = *self;
1395 self.visit2_mut(&mut rhs, |v, _| f(v));
1398 fn visit<F: FnMut(bool)>(mut self, mut f: F) {
1399 self.visit_mut(|v| f(*v));
1403 trait ImportExportFeatureSet<T> {
1404 fn import_feature_set(&mut self, features: &T);
1405 fn export_feature_set(&self, features: &mut T);
1408 impl ImportExportFeatureSet<api::VkPhysicalDeviceFeatures> for Features {
1409 fn import_feature_set(&mut self, features: &api::VkPhysicalDeviceFeatures) {
1410 self.features = *features;
1412 fn export_feature_set(&self, features: &mut api::VkPhysicalDeviceFeatures) {
1413 *features = self.features;
1417 impl ImportExportFeatureSet<api::VkPhysicalDeviceFeatures2> for Features {
1418 fn import_feature_set(&mut self, features: &api::VkPhysicalDeviceFeatures2) {
1419 self.features = features.features;
1421 fn export_feature_set(&self, features: &mut api::VkPhysicalDeviceFeatures2) {
1422 features.features = self.features;
1426 macro_rules! impl_import_export_feature_set {
1427 ($type:ident, $member:ident) => {
1428 impl ImportExportFeatureSet<api::$type> for Features {
1429 fn import_feature_set(&mut self, features: &api::$type) {
1430 self.$member = api::$type {
1431 sType: self.$member.sType,
1432 pNext: self.$member.pNext,
1436 fn export_feature_set(&self, features: &mut api::$type) {
1437 *features = api::$type {
1438 sType: features.sType,
1439 pNext: features.pNext,
1447 impl_import_export_feature_set!(
1448 VkPhysicalDevice16BitStorageFeatures,
1449 physical_device_16bit_storage_features
1452 impl_import_export_feature_set!(
1453 VkPhysicalDeviceSamplerYcbcrConversionFeatures,
1454 sampler_ycbcr_conversion_features
1457 impl_import_export_feature_set!(
1458 VkPhysicalDeviceVariablePointerFeatures,
1459 variable_pointer_features
1462 impl_import_export_feature_set!(
1463 VkPhysicalDeviceShaderDrawParameterFeatures,
1464 shader_draw_parameter_features
1467 impl_import_export_feature_set!(
1468 VkPhysicalDeviceProtectedMemoryFeatures,
1469 protected_memory_features
1472 impl_import_export_feature_set!(VkPhysicalDeviceMultiviewFeatures, multiview_features);
1474 impl Eq for Features {}
1476 impl PartialEq for Features {
1477 fn eq(&self, rhs: &Self) -> bool {
1478 let mut equal = true;
1479 self.visit2(*rhs, |a, b| equal &= a == b);
1484 impl BitAndAssign for Features {
1485 fn bitand_assign(&mut self, mut rhs: Self) {
1486 self.visit2_mut(&mut rhs, |l, r| *l &= *r);
1490 impl BitOrAssign for Features {
1491 fn bitor_assign(&mut self, mut rhs: Self) {
1492 self.visit2_mut(&mut rhs, |l, r| *l |= *r);
1496 impl BitXorAssign for Features {
1497 fn bitxor_assign(&mut self, mut rhs: Self) {
1498 self.visit2_mut(&mut rhs, |l, r| *l ^= *r);
1502 impl BitAnd for Features {
1504 fn bitand(mut self, rhs: Self) -> Self {
1510 impl BitOr for Features {
1512 fn bitor(mut self, rhs: Self) -> Self {
1518 impl BitXor for Features {
1520 fn bitxor(mut self, rhs: Self) -> Self {
1526 impl Not for Features {
1528 fn not(mut self) -> Self {
1529 self.visit_mut(|v| *v = !*v);
1538 physical_device: SharedHandle<api::VkPhysicalDevice>,
1539 extensions: Extensions,
1542 queues: Vec<Vec<OwnedHandle<api::VkQueue>>>,
1547 physical_device: SharedHandle<api::VkPhysicalDevice>,
1548 create_info: *const api::VkDeviceCreateInfo,
1549 ) -> Result<OwnedHandle<api::VkDevice>, api::VkResult> {
1550 parse_next_chain_const!{
1552 root = api::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
1553 device_group_device_create_info: api::VkDeviceGroupDeviceCreateInfo = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO,
1554 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1555 physical_device_features_2: api::VkPhysicalDeviceFeatures2 = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
1556 physical_device_multiview_features: api::VkPhysicalDeviceMultiviewFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1557 physical_device_protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1558 physical_device_sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1559 physical_device_shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1560 physical_device_variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1562 let create_info = &*create_info;
1563 if create_info.enabledLayerCount != 0 {
1564 return Err(api::VK_ERROR_LAYER_NOT_PRESENT);
1566 let mut enabled_extensions = physical_device.enabled_extensions;
1567 if create_info.enabledExtensionCount != 0 {
1568 for &extension_name in slice::from_raw_parts(
1569 create_info.ppEnabledExtensionNames,
1570 create_info.enabledExtensionCount as usize,
1572 let extension: Extension = CStr::from_ptr(extension_name)
1574 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?
1576 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?;
1577 assert_eq!(extension.get_scope(), ExtensionScope::Device);
1578 enabled_extensions[extension] = true;
1581 for extension in enabled_extensions
1583 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
1585 let missing_extensions = extension.get_required_extensions() & !enabled_extensions;
1586 for missing_extension in missing_extensions
1588 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
1591 "extension {} enabled but required extension {} is not enabled",
1592 extension.get_name(),
1593 missing_extension.get_name()
1597 let mut selected_features = Features::splat(false);
1598 if !device_group_device_create_info.is_null() {
1599 let api::VkDeviceGroupDeviceCreateInfo {
1602 physicalDeviceCount: physical_device_count,
1603 pPhysicalDevices: physical_devices,
1604 } = *device_group_device_create_info;
1606 physical_device_count, 1,
1607 "multiple devices in a group are not implemented"
1611 physical_device.get_handle(),
1612 "unknown physical_device"
1615 if !physical_device_16bit_storage_features.is_null() {
1616 selected_features.import_feature_set(&*physical_device_16bit_storage_features);
1618 if !physical_device_features_2.is_null() {
1619 selected_features.import_feature_set(&*physical_device_features_2);
1620 } else if !create_info.pEnabledFeatures.is_null() {
1621 selected_features.import_feature_set(&*create_info.pEnabledFeatures);
1623 if !physical_device_multiview_features.is_null() {
1624 selected_features.import_feature_set(&*physical_device_multiview_features);
1626 if !physical_device_protected_memory_features.is_null() {
1627 selected_features.import_feature_set(&*physical_device_protected_memory_features);
1629 if !physical_device_sampler_ycbcr_conversion_features.is_null() {
1631 .import_feature_set(&*physical_device_sampler_ycbcr_conversion_features);
1633 if !physical_device_shader_draw_parameter_features.is_null() {
1634 selected_features.import_feature_set(&*physical_device_shader_draw_parameter_features);
1635 } else if enabled_extensions[Extension::VK_KHR_shader_draw_parameters] {
1637 .shader_draw_parameter_features
1638 .shaderDrawParameters = api::VK_TRUE;
1640 if !physical_device_variable_pointer_features.is_null() {
1641 selected_features.import_feature_set(&*physical_device_variable_pointer_features);
1643 if (selected_features & !physical_device.features) != Features::splat(false) {
1644 return Err(api::VK_ERROR_FEATURE_NOT_PRESENT);
1646 assert_ne!(create_info.queueCreateInfoCount, 0);
1647 let queue_create_infos = slice::from_raw_parts(
1648 create_info.pQueueCreateInfos,
1649 create_info.queueCreateInfoCount as usize,
1651 assert!(queue_create_infos.len() <= QUEUE_FAMILY_COUNT as usize);
1652 let mut total_queue_count = 0;
1653 let mut queue_counts: Vec<_> = Vec::new();
1654 for queue_create_info in queue_create_infos {
1655 parse_next_chain_const!{
1657 root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
1659 let api::VkDeviceQueueCreateInfo {
1663 queueFamilyIndex: queue_family_index,
1664 queueCount: queue_count,
1665 pQueuePriorities: queue_priorities,
1666 } = *queue_create_info;
1667 assert_eq!(flags & api::VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT, 0);
1668 assert!(queue_family_index < QUEUE_FAMILY_COUNT);
1669 assert!(queue_count <= QUEUE_COUNTS[queue_family_index as usize]);
1670 let queue_priorities = slice::from_raw_parts(queue_priorities, queue_count as usize);
1671 for &queue_priority in queue_priorities {
1672 assert!(queue_priority >= 0.0 && queue_priority <= 1.0);
1674 assert_eq!(QUEUE_FAMILY_COUNT, 1, "multiple queues are not implemented");
1676 QUEUE_COUNTS, [1; QUEUE_FAMILY_COUNT as usize],
1677 "multiple queues are not implemented"
1679 queue_counts.push(queue_count as usize);
1680 total_queue_count += queue_count as usize;
1682 assert!(total_queue_count <= TOTAL_QUEUE_COUNT);
1683 let mut queues = Vec::new();
1684 for queue_count in queue_counts {
1685 let mut queue_family_queues = Vec::new();
1686 for _queue_index in 0..queue_count {
1687 queue_family_queues.push(OwnedHandle::<api::VkQueue>::new(Queue {}));
1689 queues.push(queue_family_queues);
1691 Ok(OwnedHandle::<api::VkDevice>::new(Device {
1693 extensions: enabled_extensions,
1694 features: selected_features,
1700 pub struct PhysicalDevice {
1701 enabled_extensions: Extensions,
1702 allowed_extensions: Extensions,
1703 properties: api::VkPhysicalDeviceProperties,
1705 system_memory_size: u64,
1706 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties,
1707 multiview_properties: api::VkPhysicalDeviceMultiviewProperties,
1708 id_properties: api::VkPhysicalDeviceIDProperties,
1709 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties,
1710 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties,
1711 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties,
1714 impl PhysicalDevice {
1715 pub fn get_pipeline_cache_uuid() -> uuid::Uuid {
1716 // FIXME: return real uuid
1719 pub fn get_device_uuid() -> uuid::Uuid {
1720 // FIXME: return real uuid
1723 pub fn get_driver_uuid() -> uuid::Uuid {
1724 // FIXME: return real uuid
1727 pub fn get_limits() -> api::VkPhysicalDeviceLimits {
1728 #![cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))]
1729 api::VkPhysicalDeviceLimits {
1730 maxImageDimension1D: !0,
1731 maxImageDimension2D: !0,
1732 maxImageDimension3D: !0,
1733 maxImageDimensionCube: !0,
1734 maxImageArrayLayers: !0,
1735 maxTexelBufferElements: !0,
1736 maxUniformBufferRange: !0,
1737 maxStorageBufferRange: !0,
1738 maxPushConstantsSize: !0,
1739 maxMemoryAllocationCount: !0,
1740 maxSamplerAllocationCount: !0,
1741 bufferImageGranularity: 1,
1742 sparseAddressSpaceSize: 0,
1743 maxBoundDescriptorSets: !0,
1744 maxPerStageDescriptorSamplers: !0,
1745 maxPerStageDescriptorUniformBuffers: !0,
1746 maxPerStageDescriptorStorageBuffers: !0,
1747 maxPerStageDescriptorSampledImages: !0,
1748 maxPerStageDescriptorStorageImages: !0,
1749 maxPerStageDescriptorInputAttachments: !0,
1750 maxPerStageResources: !0,
1751 maxDescriptorSetSamplers: !0,
1752 maxDescriptorSetUniformBuffers: !0,
1753 maxDescriptorSetUniformBuffersDynamic: !0,
1754 maxDescriptorSetStorageBuffers: !0,
1755 maxDescriptorSetStorageBuffersDynamic: !0,
1756 maxDescriptorSetSampledImages: !0,
1757 maxDescriptorSetStorageImages: !0,
1758 maxDescriptorSetInputAttachments: !0,
1759 maxVertexInputAttributes: !0,
1760 maxVertexInputBindings: !0,
1761 maxVertexInputAttributeOffset: !0,
1762 maxVertexInputBindingStride: !0,
1763 maxVertexOutputComponents: !0,
1764 maxTessellationGenerationLevel: 0,
1765 maxTessellationPatchSize: 0,
1766 maxTessellationControlPerVertexInputComponents: 0,
1767 maxTessellationControlPerVertexOutputComponents: 0,
1768 maxTessellationControlPerPatchOutputComponents: 0,
1769 maxTessellationControlTotalOutputComponents: 0,
1770 maxTessellationEvaluationInputComponents: 0,
1771 maxTessellationEvaluationOutputComponents: 0,
1772 maxGeometryShaderInvocations: 0,
1773 maxGeometryInputComponents: 0,
1774 maxGeometryOutputComponents: 0,
1775 maxGeometryOutputVertices: 0,
1776 maxGeometryTotalOutputComponents: 0,
1777 maxFragmentInputComponents: !0,
1778 maxFragmentOutputAttachments: !0,
1779 maxFragmentDualSrcAttachments: 0,
1780 maxFragmentCombinedOutputResources: !0,
1781 maxComputeSharedMemorySize: !0,
1782 maxComputeWorkGroupCount: [!0; 3],
1783 maxComputeWorkGroupInvocations: !0,
1784 maxComputeWorkGroupSize: [!0; 3],
1785 subPixelPrecisionBits: 4, // FIXME: update to correct value
1786 subTexelPrecisionBits: 4, // FIXME: update to correct value
1787 mipmapPrecisionBits: 4, // FIXME: update to correct value
1788 maxDrawIndexedIndexValue: !0,
1789 maxDrawIndirectCount: !0,
1790 maxSamplerLodBias: 2.0, // FIXME: update to correct value
1791 maxSamplerAnisotropy: 1.0,
1793 maxViewportDimensions: [4096; 2], // FIXME: update to correct value
1794 viewportBoundsRange: [-8192.0, 8191.0], // FIXME: update to correct value
1795 viewportSubPixelBits: 0,
1796 minMemoryMapAlignment: MIN_MEMORY_MAP_ALIGNMENT,
1797 minTexelBufferOffsetAlignment: 64, // FIXME: update to correct value
1798 minUniformBufferOffsetAlignment: 64, // FIXME: update to correct value
1799 minStorageBufferOffsetAlignment: 64, // FIXME: update to correct value
1800 minTexelOffset: -8, // FIXME: update to correct value
1801 maxTexelOffset: 7, // FIXME: update to correct value
1802 minTexelGatherOffset: 0,
1803 maxTexelGatherOffset: 0,
1804 minInterpolationOffset: 0.0,
1805 maxInterpolationOffset: 0.0,
1806 subPixelInterpolationOffsetBits: 0,
1807 maxFramebufferWidth: 4096, // FIXME: update to correct value
1808 maxFramebufferHeight: 4096, // FIXME: update to correct value
1809 maxFramebufferLayers: 256, // FIXME: update to correct value
1810 framebufferColorSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1811 framebufferDepthSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1812 framebufferStencilSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1813 framebufferNoAttachmentsSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1814 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1815 maxColorAttachments: 4,
1816 sampledImageColorSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1817 sampledImageIntegerSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1818 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1819 sampledImageDepthSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1820 sampledImageStencilSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1821 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1822 storageImageSampleCounts: api::VK_SAMPLE_COUNT_1_BIT, // FIXME: update to correct value
1823 maxSampleMaskWords: 1,
1824 timestampComputeAndGraphics: api::VK_FALSE,
1825 timestampPeriod: 0.0,
1826 maxClipDistances: 0,
1827 maxCullDistances: 0,
1828 maxCombinedClipAndCullDistances: 0,
1829 discreteQueuePriorities: 2,
1830 pointSizeRange: [1.0; 2],
1831 lineWidthRange: [1.0; 2],
1832 pointSizeGranularity: 0.0,
1833 lineWidthGranularity: 0.0,
1834 strictLines: api::VK_FALSE,
1835 standardSampleLocations: api::VK_TRUE,
1836 optimalBufferCopyOffsetAlignment: 16,
1837 optimalBufferCopyRowPitchAlignment: 16,
1838 nonCoherentAtomSize: 1, //TODO: check if this is correct
1839 ..unsafe { mem::zeroed() } // for padding fields
1842 pub fn get_format_properties(format: api::VkFormat) -> api::VkFormatProperties {
1844 api::VK_FORMAT_UNDEFINED => api::VkFormatProperties {
1845 linearTilingFeatures: 0,
1846 optimalTilingFeatures: 0,
1849 api::VK_FORMAT_R4G4_UNORM_PACK8 => api::VkFormatProperties {
1851 linearTilingFeatures: 0,
1852 optimalTilingFeatures: 0,
1855 api::VK_FORMAT_R4G4B4A4_UNORM_PACK16 => api::VkFormatProperties {
1857 linearTilingFeatures: 0,
1858 optimalTilingFeatures: 0,
1861 api::VK_FORMAT_B4G4R4A4_UNORM_PACK16 => api::VkFormatProperties {
1863 linearTilingFeatures: 0,
1864 optimalTilingFeatures: 0,
1867 api::VK_FORMAT_R5G6B5_UNORM_PACK16 => api::VkFormatProperties {
1869 linearTilingFeatures: 0,
1870 optimalTilingFeatures: 0,
1873 api::VK_FORMAT_B5G6R5_UNORM_PACK16 => api::VkFormatProperties {
1875 linearTilingFeatures: 0,
1876 optimalTilingFeatures: 0,
1879 api::VK_FORMAT_R5G5B5A1_UNORM_PACK16 => api::VkFormatProperties {
1881 linearTilingFeatures: 0,
1882 optimalTilingFeatures: 0,
1885 api::VK_FORMAT_B5G5R5A1_UNORM_PACK16 => api::VkFormatProperties {
1887 linearTilingFeatures: 0,
1888 optimalTilingFeatures: 0,
1891 api::VK_FORMAT_A1R5G5B5_UNORM_PACK16 => api::VkFormatProperties {
1893 linearTilingFeatures: 0,
1894 optimalTilingFeatures: 0,
1897 api::VK_FORMAT_R8_UNORM => api::VkFormatProperties {
1899 linearTilingFeatures: 0,
1900 optimalTilingFeatures: 0,
1903 api::VK_FORMAT_R8_SNORM => api::VkFormatProperties {
1905 linearTilingFeatures: 0,
1906 optimalTilingFeatures: 0,
1909 api::VK_FORMAT_R8_USCALED => api::VkFormatProperties {
1911 linearTilingFeatures: 0,
1912 optimalTilingFeatures: 0,
1915 api::VK_FORMAT_R8_SSCALED => api::VkFormatProperties {
1917 linearTilingFeatures: 0,
1918 optimalTilingFeatures: 0,
1921 api::VK_FORMAT_R8_UINT => api::VkFormatProperties {
1923 linearTilingFeatures: 0,
1924 optimalTilingFeatures: 0,
1927 api::VK_FORMAT_R8_SINT => api::VkFormatProperties {
1929 linearTilingFeatures: 0,
1930 optimalTilingFeatures: 0,
1933 api::VK_FORMAT_R8_SRGB => api::VkFormatProperties {
1935 linearTilingFeatures: 0,
1936 optimalTilingFeatures: 0,
1939 api::VK_FORMAT_R8G8_UNORM => api::VkFormatProperties {
1941 linearTilingFeatures: 0,
1942 optimalTilingFeatures: 0,
1945 api::VK_FORMAT_R8G8_SNORM => api::VkFormatProperties {
1947 linearTilingFeatures: 0,
1948 optimalTilingFeatures: 0,
1951 api::VK_FORMAT_R8G8_USCALED => api::VkFormatProperties {
1953 linearTilingFeatures: 0,
1954 optimalTilingFeatures: 0,
1957 api::VK_FORMAT_R8G8_SSCALED => api::VkFormatProperties {
1959 linearTilingFeatures: 0,
1960 optimalTilingFeatures: 0,
1963 api::VK_FORMAT_R8G8_UINT => api::VkFormatProperties {
1965 linearTilingFeatures: 0,
1966 optimalTilingFeatures: 0,
1969 api::VK_FORMAT_R8G8_SINT => api::VkFormatProperties {
1971 linearTilingFeatures: 0,
1972 optimalTilingFeatures: 0,
1975 api::VK_FORMAT_R8G8_SRGB => api::VkFormatProperties {
1977 linearTilingFeatures: 0,
1978 optimalTilingFeatures: 0,
1981 api::VK_FORMAT_R8G8B8_UNORM => api::VkFormatProperties {
1983 linearTilingFeatures: 0,
1984 optimalTilingFeatures: 0,
1987 api::VK_FORMAT_R8G8B8_SNORM => api::VkFormatProperties {
1989 linearTilingFeatures: 0,
1990 optimalTilingFeatures: 0,
1993 api::VK_FORMAT_R8G8B8_USCALED => api::VkFormatProperties {
1995 linearTilingFeatures: 0,
1996 optimalTilingFeatures: 0,
1999 api::VK_FORMAT_R8G8B8_SSCALED => api::VkFormatProperties {
2001 linearTilingFeatures: 0,
2002 optimalTilingFeatures: 0,
2005 api::VK_FORMAT_R8G8B8_UINT => api::VkFormatProperties {
2007 linearTilingFeatures: 0,
2008 optimalTilingFeatures: 0,
2011 api::VK_FORMAT_R8G8B8_SINT => api::VkFormatProperties {
2013 linearTilingFeatures: 0,
2014 optimalTilingFeatures: 0,
2017 api::VK_FORMAT_R8G8B8_SRGB => api::VkFormatProperties {
2019 linearTilingFeatures: 0,
2020 optimalTilingFeatures: 0,
2023 api::VK_FORMAT_B8G8R8_UNORM => api::VkFormatProperties {
2025 linearTilingFeatures: 0,
2026 optimalTilingFeatures: 0,
2029 api::VK_FORMAT_B8G8R8_SNORM => api::VkFormatProperties {
2031 linearTilingFeatures: 0,
2032 optimalTilingFeatures: 0,
2035 api::VK_FORMAT_B8G8R8_USCALED => api::VkFormatProperties {
2037 linearTilingFeatures: 0,
2038 optimalTilingFeatures: 0,
2041 api::VK_FORMAT_B8G8R8_SSCALED => api::VkFormatProperties {
2043 linearTilingFeatures: 0,
2044 optimalTilingFeatures: 0,
2047 api::VK_FORMAT_B8G8R8_UINT => api::VkFormatProperties {
2049 linearTilingFeatures: 0,
2050 optimalTilingFeatures: 0,
2053 api::VK_FORMAT_B8G8R8_SINT => api::VkFormatProperties {
2055 linearTilingFeatures: 0,
2056 optimalTilingFeatures: 0,
2059 api::VK_FORMAT_B8G8R8_SRGB => api::VkFormatProperties {
2061 linearTilingFeatures: 0,
2062 optimalTilingFeatures: 0,
2065 api::VK_FORMAT_R8G8B8A8_UNORM => api::VkFormatProperties {
2067 linearTilingFeatures: 0,
2068 optimalTilingFeatures: 0,
2071 api::VK_FORMAT_R8G8B8A8_SNORM => api::VkFormatProperties {
2073 linearTilingFeatures: 0,
2074 optimalTilingFeatures: 0,
2077 api::VK_FORMAT_R8G8B8A8_USCALED => api::VkFormatProperties {
2079 linearTilingFeatures: 0,
2080 optimalTilingFeatures: 0,
2083 api::VK_FORMAT_R8G8B8A8_SSCALED => api::VkFormatProperties {
2085 linearTilingFeatures: 0,
2086 optimalTilingFeatures: 0,
2089 api::VK_FORMAT_R8G8B8A8_UINT => api::VkFormatProperties {
2091 linearTilingFeatures: 0,
2092 optimalTilingFeatures: 0,
2095 api::VK_FORMAT_R8G8B8A8_SINT => api::VkFormatProperties {
2097 linearTilingFeatures: 0,
2098 optimalTilingFeatures: 0,
2101 api::VK_FORMAT_R8G8B8A8_SRGB => api::VkFormatProperties {
2103 linearTilingFeatures: 0,
2104 optimalTilingFeatures: 0,
2107 api::VK_FORMAT_B8G8R8A8_UNORM => api::VkFormatProperties {
2109 linearTilingFeatures: 0,
2110 optimalTilingFeatures: 0,
2113 api::VK_FORMAT_B8G8R8A8_SNORM => api::VkFormatProperties {
2115 linearTilingFeatures: 0,
2116 optimalTilingFeatures: 0,
2119 api::VK_FORMAT_B8G8R8A8_USCALED => api::VkFormatProperties {
2121 linearTilingFeatures: 0,
2122 optimalTilingFeatures: 0,
2125 api::VK_FORMAT_B8G8R8A8_SSCALED => api::VkFormatProperties {
2127 linearTilingFeatures: 0,
2128 optimalTilingFeatures: 0,
2131 api::VK_FORMAT_B8G8R8A8_UINT => api::VkFormatProperties {
2133 linearTilingFeatures: 0,
2134 optimalTilingFeatures: 0,
2137 api::VK_FORMAT_B8G8R8A8_SINT => api::VkFormatProperties {
2139 linearTilingFeatures: 0,
2140 optimalTilingFeatures: 0,
2143 api::VK_FORMAT_B8G8R8A8_SRGB => api::VkFormatProperties {
2145 linearTilingFeatures: 0,
2146 optimalTilingFeatures: 0,
2149 api::VK_FORMAT_A8B8G8R8_UNORM_PACK32 => api::VkFormatProperties {
2151 linearTilingFeatures: 0,
2152 optimalTilingFeatures: 0,
2155 api::VK_FORMAT_A8B8G8R8_SNORM_PACK32 => api::VkFormatProperties {
2157 linearTilingFeatures: 0,
2158 optimalTilingFeatures: 0,
2161 api::VK_FORMAT_A8B8G8R8_USCALED_PACK32 => api::VkFormatProperties {
2163 linearTilingFeatures: 0,
2164 optimalTilingFeatures: 0,
2167 api::VK_FORMAT_A8B8G8R8_SSCALED_PACK32 => api::VkFormatProperties {
2169 linearTilingFeatures: 0,
2170 optimalTilingFeatures: 0,
2173 api::VK_FORMAT_A8B8G8R8_UINT_PACK32 => api::VkFormatProperties {
2175 linearTilingFeatures: 0,
2176 optimalTilingFeatures: 0,
2179 api::VK_FORMAT_A8B8G8R8_SINT_PACK32 => api::VkFormatProperties {
2181 linearTilingFeatures: 0,
2182 optimalTilingFeatures: 0,
2185 api::VK_FORMAT_A8B8G8R8_SRGB_PACK32 => api::VkFormatProperties {
2187 linearTilingFeatures: 0,
2188 optimalTilingFeatures: 0,
2191 api::VK_FORMAT_A2R10G10B10_UNORM_PACK32 => api::VkFormatProperties {
2193 linearTilingFeatures: 0,
2194 optimalTilingFeatures: 0,
2197 api::VK_FORMAT_A2R10G10B10_SNORM_PACK32 => api::VkFormatProperties {
2199 linearTilingFeatures: 0,
2200 optimalTilingFeatures: 0,
2203 api::VK_FORMAT_A2R10G10B10_USCALED_PACK32 => api::VkFormatProperties {
2205 linearTilingFeatures: 0,
2206 optimalTilingFeatures: 0,
2209 api::VK_FORMAT_A2R10G10B10_SSCALED_PACK32 => api::VkFormatProperties {
2211 linearTilingFeatures: 0,
2212 optimalTilingFeatures: 0,
2215 api::VK_FORMAT_A2R10G10B10_UINT_PACK32 => api::VkFormatProperties {
2217 linearTilingFeatures: 0,
2218 optimalTilingFeatures: 0,
2221 api::VK_FORMAT_A2R10G10B10_SINT_PACK32 => api::VkFormatProperties {
2223 linearTilingFeatures: 0,
2224 optimalTilingFeatures: 0,
2227 api::VK_FORMAT_A2B10G10R10_UNORM_PACK32 => api::VkFormatProperties {
2229 linearTilingFeatures: 0,
2230 optimalTilingFeatures: 0,
2233 api::VK_FORMAT_A2B10G10R10_SNORM_PACK32 => api::VkFormatProperties {
2235 linearTilingFeatures: 0,
2236 optimalTilingFeatures: 0,
2239 api::VK_FORMAT_A2B10G10R10_USCALED_PACK32 => api::VkFormatProperties {
2241 linearTilingFeatures: 0,
2242 optimalTilingFeatures: 0,
2245 api::VK_FORMAT_A2B10G10R10_SSCALED_PACK32 => api::VkFormatProperties {
2247 linearTilingFeatures: 0,
2248 optimalTilingFeatures: 0,
2251 api::VK_FORMAT_A2B10G10R10_UINT_PACK32 => api::VkFormatProperties {
2253 linearTilingFeatures: 0,
2254 optimalTilingFeatures: 0,
2257 api::VK_FORMAT_A2B10G10R10_SINT_PACK32 => api::VkFormatProperties {
2259 linearTilingFeatures: 0,
2260 optimalTilingFeatures: 0,
2263 api::VK_FORMAT_R16_UNORM => api::VkFormatProperties {
2265 linearTilingFeatures: 0,
2266 optimalTilingFeatures: 0,
2269 api::VK_FORMAT_R16_SNORM => api::VkFormatProperties {
2271 linearTilingFeatures: 0,
2272 optimalTilingFeatures: 0,
2275 api::VK_FORMAT_R16_USCALED => api::VkFormatProperties {
2277 linearTilingFeatures: 0,
2278 optimalTilingFeatures: 0,
2281 api::VK_FORMAT_R16_SSCALED => api::VkFormatProperties {
2283 linearTilingFeatures: 0,
2284 optimalTilingFeatures: 0,
2287 api::VK_FORMAT_R16_UINT => api::VkFormatProperties {
2289 linearTilingFeatures: 0,
2290 optimalTilingFeatures: 0,
2293 api::VK_FORMAT_R16_SINT => api::VkFormatProperties {
2295 linearTilingFeatures: 0,
2296 optimalTilingFeatures: 0,
2299 api::VK_FORMAT_R16_SFLOAT => api::VkFormatProperties {
2301 linearTilingFeatures: 0,
2302 optimalTilingFeatures: 0,
2305 api::VK_FORMAT_R16G16_UNORM => api::VkFormatProperties {
2307 linearTilingFeatures: 0,
2308 optimalTilingFeatures: 0,
2311 api::VK_FORMAT_R16G16_SNORM => api::VkFormatProperties {
2313 linearTilingFeatures: 0,
2314 optimalTilingFeatures: 0,
2317 api::VK_FORMAT_R16G16_USCALED => api::VkFormatProperties {
2319 linearTilingFeatures: 0,
2320 optimalTilingFeatures: 0,
2323 api::VK_FORMAT_R16G16_SSCALED => api::VkFormatProperties {
2325 linearTilingFeatures: 0,
2326 optimalTilingFeatures: 0,
2329 api::VK_FORMAT_R16G16_UINT => api::VkFormatProperties {
2331 linearTilingFeatures: 0,
2332 optimalTilingFeatures: 0,
2335 api::VK_FORMAT_R16G16_SINT => api::VkFormatProperties {
2337 linearTilingFeatures: 0,
2338 optimalTilingFeatures: 0,
2341 api::VK_FORMAT_R16G16_SFLOAT => api::VkFormatProperties {
2343 linearTilingFeatures: 0,
2344 optimalTilingFeatures: 0,
2347 api::VK_FORMAT_R16G16B16_UNORM => api::VkFormatProperties {
2349 linearTilingFeatures: 0,
2350 optimalTilingFeatures: 0,
2353 api::VK_FORMAT_R16G16B16_SNORM => api::VkFormatProperties {
2355 linearTilingFeatures: 0,
2356 optimalTilingFeatures: 0,
2359 api::VK_FORMAT_R16G16B16_USCALED => api::VkFormatProperties {
2361 linearTilingFeatures: 0,
2362 optimalTilingFeatures: 0,
2365 api::VK_FORMAT_R16G16B16_SSCALED => api::VkFormatProperties {
2367 linearTilingFeatures: 0,
2368 optimalTilingFeatures: 0,
2371 api::VK_FORMAT_R16G16B16_UINT => api::VkFormatProperties {
2373 linearTilingFeatures: 0,
2374 optimalTilingFeatures: 0,
2377 api::VK_FORMAT_R16G16B16_SINT => api::VkFormatProperties {
2379 linearTilingFeatures: 0,
2380 optimalTilingFeatures: 0,
2383 api::VK_FORMAT_R16G16B16_SFLOAT => api::VkFormatProperties {
2385 linearTilingFeatures: 0,
2386 optimalTilingFeatures: 0,
2389 api::VK_FORMAT_R16G16B16A16_UNORM => api::VkFormatProperties {
2391 linearTilingFeatures: 0,
2392 optimalTilingFeatures: 0,
2395 api::VK_FORMAT_R16G16B16A16_SNORM => api::VkFormatProperties {
2397 linearTilingFeatures: 0,
2398 optimalTilingFeatures: 0,
2401 api::VK_FORMAT_R16G16B16A16_USCALED => api::VkFormatProperties {
2403 linearTilingFeatures: 0,
2404 optimalTilingFeatures: 0,
2407 api::VK_FORMAT_R16G16B16A16_SSCALED => api::VkFormatProperties {
2409 linearTilingFeatures: 0,
2410 optimalTilingFeatures: 0,
2413 api::VK_FORMAT_R16G16B16A16_UINT => api::VkFormatProperties {
2415 linearTilingFeatures: 0,
2416 optimalTilingFeatures: 0,
2419 api::VK_FORMAT_R16G16B16A16_SINT => api::VkFormatProperties {
2421 linearTilingFeatures: 0,
2422 optimalTilingFeatures: 0,
2425 api::VK_FORMAT_R16G16B16A16_SFLOAT => api::VkFormatProperties {
2427 linearTilingFeatures: 0,
2428 optimalTilingFeatures: 0,
2431 api::VK_FORMAT_R32_UINT => api::VkFormatProperties {
2433 linearTilingFeatures: 0,
2434 optimalTilingFeatures: 0,
2437 api::VK_FORMAT_R32_SINT => api::VkFormatProperties {
2439 linearTilingFeatures: 0,
2440 optimalTilingFeatures: 0,
2443 api::VK_FORMAT_R32_SFLOAT => api::VkFormatProperties {
2445 linearTilingFeatures: 0,
2446 optimalTilingFeatures: 0,
2449 api::VK_FORMAT_R32G32_UINT => api::VkFormatProperties {
2451 linearTilingFeatures: 0,
2452 optimalTilingFeatures: 0,
2455 api::VK_FORMAT_R32G32_SINT => api::VkFormatProperties {
2457 linearTilingFeatures: 0,
2458 optimalTilingFeatures: 0,
2461 api::VK_FORMAT_R32G32_SFLOAT => api::VkFormatProperties {
2463 linearTilingFeatures: 0,
2464 optimalTilingFeatures: 0,
2467 api::VK_FORMAT_R32G32B32_UINT => api::VkFormatProperties {
2469 linearTilingFeatures: 0,
2470 optimalTilingFeatures: 0,
2473 api::VK_FORMAT_R32G32B32_SINT => api::VkFormatProperties {
2475 linearTilingFeatures: 0,
2476 optimalTilingFeatures: 0,
2479 api::VK_FORMAT_R32G32B32_SFLOAT => api::VkFormatProperties {
2481 linearTilingFeatures: 0,
2482 optimalTilingFeatures: 0,
2485 api::VK_FORMAT_R32G32B32A32_UINT => api::VkFormatProperties {
2487 linearTilingFeatures: 0,
2488 optimalTilingFeatures: 0,
2491 api::VK_FORMAT_R32G32B32A32_SINT => api::VkFormatProperties {
2493 linearTilingFeatures: 0,
2494 optimalTilingFeatures: 0,
2497 api::VK_FORMAT_R32G32B32A32_SFLOAT => api::VkFormatProperties {
2499 linearTilingFeatures: 0,
2500 optimalTilingFeatures: 0,
2503 api::VK_FORMAT_R64_UINT => api::VkFormatProperties {
2505 linearTilingFeatures: 0,
2506 optimalTilingFeatures: 0,
2509 api::VK_FORMAT_R64_SINT => api::VkFormatProperties {
2511 linearTilingFeatures: 0,
2512 optimalTilingFeatures: 0,
2515 api::VK_FORMAT_R64_SFLOAT => api::VkFormatProperties {
2517 linearTilingFeatures: 0,
2518 optimalTilingFeatures: 0,
2521 api::VK_FORMAT_R64G64_UINT => api::VkFormatProperties {
2523 linearTilingFeatures: 0,
2524 optimalTilingFeatures: 0,
2527 api::VK_FORMAT_R64G64_SINT => api::VkFormatProperties {
2529 linearTilingFeatures: 0,
2530 optimalTilingFeatures: 0,
2533 api::VK_FORMAT_R64G64_SFLOAT => api::VkFormatProperties {
2535 linearTilingFeatures: 0,
2536 optimalTilingFeatures: 0,
2539 api::VK_FORMAT_R64G64B64_UINT => api::VkFormatProperties {
2541 linearTilingFeatures: 0,
2542 optimalTilingFeatures: 0,
2545 api::VK_FORMAT_R64G64B64_SINT => api::VkFormatProperties {
2547 linearTilingFeatures: 0,
2548 optimalTilingFeatures: 0,
2551 api::VK_FORMAT_R64G64B64_SFLOAT => api::VkFormatProperties {
2553 linearTilingFeatures: 0,
2554 optimalTilingFeatures: 0,
2557 api::VK_FORMAT_R64G64B64A64_UINT => api::VkFormatProperties {
2559 linearTilingFeatures: 0,
2560 optimalTilingFeatures: 0,
2563 api::VK_FORMAT_R64G64B64A64_SINT => api::VkFormatProperties {
2565 linearTilingFeatures: 0,
2566 optimalTilingFeatures: 0,
2569 api::VK_FORMAT_R64G64B64A64_SFLOAT => api::VkFormatProperties {
2571 linearTilingFeatures: 0,
2572 optimalTilingFeatures: 0,
2575 api::VK_FORMAT_B10G11R11_UFLOAT_PACK32 => api::VkFormatProperties {
2577 linearTilingFeatures: 0,
2578 optimalTilingFeatures: 0,
2581 api::VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 => api::VkFormatProperties {
2583 linearTilingFeatures: 0,
2584 optimalTilingFeatures: 0,
2587 api::VK_FORMAT_D16_UNORM => api::VkFormatProperties {
2589 linearTilingFeatures: 0,
2590 optimalTilingFeatures: 0,
2593 api::VK_FORMAT_X8_D24_UNORM_PACK32 => api::VkFormatProperties {
2595 linearTilingFeatures: 0,
2596 optimalTilingFeatures: 0,
2599 api::VK_FORMAT_D32_SFLOAT => api::VkFormatProperties {
2601 linearTilingFeatures: 0,
2602 optimalTilingFeatures: 0,
2605 api::VK_FORMAT_S8_UINT => api::VkFormatProperties {
2607 linearTilingFeatures: 0,
2608 optimalTilingFeatures: 0,
2611 api::VK_FORMAT_D16_UNORM_S8_UINT => api::VkFormatProperties {
2613 linearTilingFeatures: 0,
2614 optimalTilingFeatures: 0,
2617 api::VK_FORMAT_D24_UNORM_S8_UINT => api::VkFormatProperties {
2619 linearTilingFeatures: 0,
2620 optimalTilingFeatures: 0,
2623 api::VK_FORMAT_D32_SFLOAT_S8_UINT => api::VkFormatProperties {
2625 linearTilingFeatures: 0,
2626 optimalTilingFeatures: 0,
2629 api::VK_FORMAT_BC1_RGB_UNORM_BLOCK => api::VkFormatProperties {
2631 linearTilingFeatures: 0,
2632 optimalTilingFeatures: 0,
2635 api::VK_FORMAT_BC1_RGB_SRGB_BLOCK => api::VkFormatProperties {
2637 linearTilingFeatures: 0,
2638 optimalTilingFeatures: 0,
2641 api::VK_FORMAT_BC1_RGBA_UNORM_BLOCK => api::VkFormatProperties {
2643 linearTilingFeatures: 0,
2644 optimalTilingFeatures: 0,
2647 api::VK_FORMAT_BC1_RGBA_SRGB_BLOCK => api::VkFormatProperties {
2649 linearTilingFeatures: 0,
2650 optimalTilingFeatures: 0,
2653 api::VK_FORMAT_BC2_UNORM_BLOCK => api::VkFormatProperties {
2655 linearTilingFeatures: 0,
2656 optimalTilingFeatures: 0,
2659 api::VK_FORMAT_BC2_SRGB_BLOCK => api::VkFormatProperties {
2661 linearTilingFeatures: 0,
2662 optimalTilingFeatures: 0,
2665 api::VK_FORMAT_BC3_UNORM_BLOCK => api::VkFormatProperties {
2667 linearTilingFeatures: 0,
2668 optimalTilingFeatures: 0,
2671 api::VK_FORMAT_BC3_SRGB_BLOCK => api::VkFormatProperties {
2673 linearTilingFeatures: 0,
2674 optimalTilingFeatures: 0,
2677 api::VK_FORMAT_BC4_UNORM_BLOCK => api::VkFormatProperties {
2679 linearTilingFeatures: 0,
2680 optimalTilingFeatures: 0,
2683 api::VK_FORMAT_BC4_SNORM_BLOCK => api::VkFormatProperties {
2685 linearTilingFeatures: 0,
2686 optimalTilingFeatures: 0,
2689 api::VK_FORMAT_BC5_UNORM_BLOCK => api::VkFormatProperties {
2691 linearTilingFeatures: 0,
2692 optimalTilingFeatures: 0,
2695 api::VK_FORMAT_BC5_SNORM_BLOCK => api::VkFormatProperties {
2697 linearTilingFeatures: 0,
2698 optimalTilingFeatures: 0,
2701 api::VK_FORMAT_BC6H_UFLOAT_BLOCK => api::VkFormatProperties {
2703 linearTilingFeatures: 0,
2704 optimalTilingFeatures: 0,
2707 api::VK_FORMAT_BC6H_SFLOAT_BLOCK => api::VkFormatProperties {
2709 linearTilingFeatures: 0,
2710 optimalTilingFeatures: 0,
2713 api::VK_FORMAT_BC7_UNORM_BLOCK => api::VkFormatProperties {
2715 linearTilingFeatures: 0,
2716 optimalTilingFeatures: 0,
2719 api::VK_FORMAT_BC7_SRGB_BLOCK => api::VkFormatProperties {
2721 linearTilingFeatures: 0,
2722 optimalTilingFeatures: 0,
2725 api::VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK => api::VkFormatProperties {
2727 linearTilingFeatures: 0,
2728 optimalTilingFeatures: 0,
2731 api::VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK => api::VkFormatProperties {
2733 linearTilingFeatures: 0,
2734 optimalTilingFeatures: 0,
2737 api::VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK => api::VkFormatProperties {
2739 linearTilingFeatures: 0,
2740 optimalTilingFeatures: 0,
2743 api::VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK => api::VkFormatProperties {
2745 linearTilingFeatures: 0,
2746 optimalTilingFeatures: 0,
2749 api::VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK => api::VkFormatProperties {
2751 linearTilingFeatures: 0,
2752 optimalTilingFeatures: 0,
2755 api::VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK => api::VkFormatProperties {
2757 linearTilingFeatures: 0,
2758 optimalTilingFeatures: 0,
2761 api::VK_FORMAT_EAC_R11_UNORM_BLOCK => api::VkFormatProperties {
2763 linearTilingFeatures: 0,
2764 optimalTilingFeatures: 0,
2767 api::VK_FORMAT_EAC_R11_SNORM_BLOCK => api::VkFormatProperties {
2769 linearTilingFeatures: 0,
2770 optimalTilingFeatures: 0,
2773 api::VK_FORMAT_EAC_R11G11_UNORM_BLOCK => api::VkFormatProperties {
2775 linearTilingFeatures: 0,
2776 optimalTilingFeatures: 0,
2779 api::VK_FORMAT_EAC_R11G11_SNORM_BLOCK => api::VkFormatProperties {
2781 linearTilingFeatures: 0,
2782 optimalTilingFeatures: 0,
2785 api::VK_FORMAT_ASTC_4x4_UNORM_BLOCK => api::VkFormatProperties {
2787 linearTilingFeatures: 0,
2788 optimalTilingFeatures: 0,
2791 api::VK_FORMAT_ASTC_4x4_SRGB_BLOCK => api::VkFormatProperties {
2793 linearTilingFeatures: 0,
2794 optimalTilingFeatures: 0,
2797 api::VK_FORMAT_ASTC_5x4_UNORM_BLOCK => api::VkFormatProperties {
2799 linearTilingFeatures: 0,
2800 optimalTilingFeatures: 0,
2803 api::VK_FORMAT_ASTC_5x4_SRGB_BLOCK => api::VkFormatProperties {
2805 linearTilingFeatures: 0,
2806 optimalTilingFeatures: 0,
2809 api::VK_FORMAT_ASTC_5x5_UNORM_BLOCK => api::VkFormatProperties {
2811 linearTilingFeatures: 0,
2812 optimalTilingFeatures: 0,
2815 api::VK_FORMAT_ASTC_5x5_SRGB_BLOCK => api::VkFormatProperties {
2817 linearTilingFeatures: 0,
2818 optimalTilingFeatures: 0,
2821 api::VK_FORMAT_ASTC_6x5_UNORM_BLOCK => api::VkFormatProperties {
2823 linearTilingFeatures: 0,
2824 optimalTilingFeatures: 0,
2827 api::VK_FORMAT_ASTC_6x5_SRGB_BLOCK => api::VkFormatProperties {
2829 linearTilingFeatures: 0,
2830 optimalTilingFeatures: 0,
2833 api::VK_FORMAT_ASTC_6x6_UNORM_BLOCK => api::VkFormatProperties {
2835 linearTilingFeatures: 0,
2836 optimalTilingFeatures: 0,
2839 api::VK_FORMAT_ASTC_6x6_SRGB_BLOCK => api::VkFormatProperties {
2841 linearTilingFeatures: 0,
2842 optimalTilingFeatures: 0,
2845 api::VK_FORMAT_ASTC_8x5_UNORM_BLOCK => api::VkFormatProperties {
2847 linearTilingFeatures: 0,
2848 optimalTilingFeatures: 0,
2851 api::VK_FORMAT_ASTC_8x5_SRGB_BLOCK => api::VkFormatProperties {
2853 linearTilingFeatures: 0,
2854 optimalTilingFeatures: 0,
2857 api::VK_FORMAT_ASTC_8x6_UNORM_BLOCK => api::VkFormatProperties {
2859 linearTilingFeatures: 0,
2860 optimalTilingFeatures: 0,
2863 api::VK_FORMAT_ASTC_8x6_SRGB_BLOCK => api::VkFormatProperties {
2865 linearTilingFeatures: 0,
2866 optimalTilingFeatures: 0,
2869 api::VK_FORMAT_ASTC_8x8_UNORM_BLOCK => api::VkFormatProperties {
2871 linearTilingFeatures: 0,
2872 optimalTilingFeatures: 0,
2875 api::VK_FORMAT_ASTC_8x8_SRGB_BLOCK => api::VkFormatProperties {
2877 linearTilingFeatures: 0,
2878 optimalTilingFeatures: 0,
2881 api::VK_FORMAT_ASTC_10x5_UNORM_BLOCK => api::VkFormatProperties {
2883 linearTilingFeatures: 0,
2884 optimalTilingFeatures: 0,
2887 api::VK_FORMAT_ASTC_10x5_SRGB_BLOCK => api::VkFormatProperties {
2889 linearTilingFeatures: 0,
2890 optimalTilingFeatures: 0,
2893 api::VK_FORMAT_ASTC_10x6_UNORM_BLOCK => api::VkFormatProperties {
2895 linearTilingFeatures: 0,
2896 optimalTilingFeatures: 0,
2899 api::VK_FORMAT_ASTC_10x6_SRGB_BLOCK => api::VkFormatProperties {
2901 linearTilingFeatures: 0,
2902 optimalTilingFeatures: 0,
2905 api::VK_FORMAT_ASTC_10x8_UNORM_BLOCK => api::VkFormatProperties {
2907 linearTilingFeatures: 0,
2908 optimalTilingFeatures: 0,
2911 api::VK_FORMAT_ASTC_10x8_SRGB_BLOCK => api::VkFormatProperties {
2913 linearTilingFeatures: 0,
2914 optimalTilingFeatures: 0,
2917 api::VK_FORMAT_ASTC_10x10_UNORM_BLOCK => api::VkFormatProperties {
2919 linearTilingFeatures: 0,
2920 optimalTilingFeatures: 0,
2923 api::VK_FORMAT_ASTC_10x10_SRGB_BLOCK => api::VkFormatProperties {
2925 linearTilingFeatures: 0,
2926 optimalTilingFeatures: 0,
2929 api::VK_FORMAT_ASTC_12x10_UNORM_BLOCK => api::VkFormatProperties {
2931 linearTilingFeatures: 0,
2932 optimalTilingFeatures: 0,
2935 api::VK_FORMAT_ASTC_12x10_SRGB_BLOCK => api::VkFormatProperties {
2937 linearTilingFeatures: 0,
2938 optimalTilingFeatures: 0,
2941 api::VK_FORMAT_ASTC_12x12_UNORM_BLOCK => api::VkFormatProperties {
2943 linearTilingFeatures: 0,
2944 optimalTilingFeatures: 0,
2947 api::VK_FORMAT_ASTC_12x12_SRGB_BLOCK => api::VkFormatProperties {
2949 linearTilingFeatures: 0,
2950 optimalTilingFeatures: 0,
2953 api::VK_FORMAT_G8B8G8R8_422_UNORM => api::VkFormatProperties {
2955 linearTilingFeatures: 0,
2956 optimalTilingFeatures: 0,
2959 api::VK_FORMAT_B8G8R8G8_422_UNORM => api::VkFormatProperties {
2961 linearTilingFeatures: 0,
2962 optimalTilingFeatures: 0,
2965 api::VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM => api::VkFormatProperties {
2967 linearTilingFeatures: 0,
2968 optimalTilingFeatures: 0,
2971 api::VK_FORMAT_G8_B8R8_2PLANE_420_UNORM => api::VkFormatProperties {
2973 linearTilingFeatures: 0,
2974 optimalTilingFeatures: 0,
2977 api::VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM => api::VkFormatProperties {
2979 linearTilingFeatures: 0,
2980 optimalTilingFeatures: 0,
2983 api::VK_FORMAT_G8_B8R8_2PLANE_422_UNORM => api::VkFormatProperties {
2985 linearTilingFeatures: 0,
2986 optimalTilingFeatures: 0,
2989 api::VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM => api::VkFormatProperties {
2991 linearTilingFeatures: 0,
2992 optimalTilingFeatures: 0,
2995 api::VK_FORMAT_R10X6_UNORM_PACK16 => api::VkFormatProperties {
2997 linearTilingFeatures: 0,
2998 optimalTilingFeatures: 0,
3001 api::VK_FORMAT_R10X6G10X6_UNORM_2PACK16 => api::VkFormatProperties {
3003 linearTilingFeatures: 0,
3004 optimalTilingFeatures: 0,
3007 api::VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 => api::VkFormatProperties {
3009 linearTilingFeatures: 0,
3010 optimalTilingFeatures: 0,
3013 api::VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 => api::VkFormatProperties {
3015 linearTilingFeatures: 0,
3016 optimalTilingFeatures: 0,
3019 api::VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 => api::VkFormatProperties {
3021 linearTilingFeatures: 0,
3022 optimalTilingFeatures: 0,
3025 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3027 linearTilingFeatures: 0,
3028 optimalTilingFeatures: 0,
3031 api::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3033 linearTilingFeatures: 0,
3034 optimalTilingFeatures: 0,
3037 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3039 linearTilingFeatures: 0,
3040 optimalTilingFeatures: 0,
3043 api::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3045 linearTilingFeatures: 0,
3046 optimalTilingFeatures: 0,
3049 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 => api::VkFormatProperties {
3051 linearTilingFeatures: 0,
3052 optimalTilingFeatures: 0,
3055 api::VK_FORMAT_R12X4_UNORM_PACK16 => api::VkFormatProperties {
3057 linearTilingFeatures: 0,
3058 optimalTilingFeatures: 0,
3061 api::VK_FORMAT_R12X4G12X4_UNORM_2PACK16 => api::VkFormatProperties {
3063 linearTilingFeatures: 0,
3064 optimalTilingFeatures: 0,
3067 api::VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 => api::VkFormatProperties {
3069 linearTilingFeatures: 0,
3070 optimalTilingFeatures: 0,
3073 api::VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 => api::VkFormatProperties {
3075 linearTilingFeatures: 0,
3076 optimalTilingFeatures: 0,
3079 api::VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 => api::VkFormatProperties {
3081 linearTilingFeatures: 0,
3082 optimalTilingFeatures: 0,
3085 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3087 linearTilingFeatures: 0,
3088 optimalTilingFeatures: 0,
3091 api::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3093 linearTilingFeatures: 0,
3094 optimalTilingFeatures: 0,
3097 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3099 linearTilingFeatures: 0,
3100 optimalTilingFeatures: 0,
3103 api::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3105 linearTilingFeatures: 0,
3106 optimalTilingFeatures: 0,
3109 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 => api::VkFormatProperties {
3111 linearTilingFeatures: 0,
3112 optimalTilingFeatures: 0,
3115 api::VK_FORMAT_G16B16G16R16_422_UNORM => api::VkFormatProperties {
3117 linearTilingFeatures: 0,
3118 optimalTilingFeatures: 0,
3121 api::VK_FORMAT_B16G16R16G16_422_UNORM => api::VkFormatProperties {
3123 linearTilingFeatures: 0,
3124 optimalTilingFeatures: 0,
3127 api::VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM => api::VkFormatProperties {
3129 linearTilingFeatures: 0,
3130 optimalTilingFeatures: 0,
3133 api::VK_FORMAT_G16_B16R16_2PLANE_420_UNORM => api::VkFormatProperties {
3135 linearTilingFeatures: 0,
3136 optimalTilingFeatures: 0,
3139 api::VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM => api::VkFormatProperties {
3141 linearTilingFeatures: 0,
3142 optimalTilingFeatures: 0,
3145 api::VK_FORMAT_G16_B16R16_2PLANE_422_UNORM => api::VkFormatProperties {
3147 linearTilingFeatures: 0,
3148 optimalTilingFeatures: 0,
3151 api::VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM => api::VkFormatProperties {
3153 linearTilingFeatures: 0,
3154 optimalTilingFeatures: 0,
3157 _ => panic!("unknown format {}", format),
3162 pub struct Instance {
3163 physical_device: OwnedHandle<api::VkPhysicalDevice>,
3168 create_info: *const api::VkInstanceCreateInfo,
3169 ) -> Result<api::VkInstance, api::VkResult> {
3170 parse_next_chain_const!{
3172 root = api::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
3174 let create_info = &*create_info;
3175 if create_info.enabledLayerCount != 0 {
3176 return Err(api::VK_ERROR_LAYER_NOT_PRESENT);
3178 let mut enabled_extensions = Extensions::create_empty();
3179 if create_info.enabledExtensionCount != 0 {
3180 for &extension_name in slice::from_raw_parts(
3181 create_info.ppEnabledExtensionNames,
3182 create_info.enabledExtensionCount as usize,
3184 let extension: Extension = CStr::from_ptr(extension_name)
3186 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?
3188 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?;
3189 assert_eq!(extension.get_scope(), ExtensionScope::Instance);
3190 enabled_extensions[extension] = true;
3193 for extension in enabled_extensions
3195 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
3197 let missing_extensions = extension.get_required_extensions() & !enabled_extensions;
3198 for missing_extension in missing_extensions
3200 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
3203 "extension {} enabled but required extension {} is not enabled",
3204 extension.get_name(),
3205 missing_extension.get_name()
3209 let system_memory_size;
3210 match sys_info::mem_info() {
3212 eprintln!("mem_info error: {}", error);
3213 return Err(api::VK_ERROR_INITIALIZATION_FAILED);
3215 Ok(info) => system_memory_size = info.total * 1024,
3217 let mut device_name = [0; api::VK_MAX_PHYSICAL_DEVICE_NAME_SIZE as usize];
3218 copy_str_to_char_array(&mut device_name, KAZAN_DEVICE_NAME);
3219 #[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))]
3220 let retval = OwnedHandle::<api::VkInstance>::new(Instance {
3221 physical_device: OwnedHandle::new(PhysicalDevice {
3223 allowed_extensions: enabled_extensions.get_allowed_extensions_from_instance_scope(),
3224 properties: api::VkPhysicalDeviceProperties {
3225 apiVersion: make_api_version(1, 1, api::VK_HEADER_VERSION),
3226 driverVersion: make_api_version(
3227 env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
3228 env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
3229 env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
3231 vendorID: api::VK_VENDOR_ID_KAZAN,
3233 deviceType: api::VK_PHYSICAL_DEVICE_TYPE_CPU,
3234 deviceName: device_name,
3235 pipelineCacheUUID: *PhysicalDevice::get_pipeline_cache_uuid().as_bytes(),
3236 limits: PhysicalDevice::get_limits(),
3237 sparseProperties: api::VkPhysicalDeviceSparseProperties {
3238 residencyStandard2DBlockShape: api::VK_FALSE,
3239 residencyStandard2DMultisampleBlockShape: api::VK_FALSE,
3240 residencyStandard3DBlockShape: api::VK_FALSE,
3241 residencyAlignedMipSize: api::VK_FALSE,
3242 residencyNonResidentStrict: api::VK_FALSE,
3244 ..mem::zeroed() // for padding fields
3246 features: Features::new(),
3248 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties {
3249 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES,
3251 pointClippingBehavior: api::VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES,
3253 multiview_properties: api::VkPhysicalDeviceMultiviewProperties {
3254 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES,
3256 maxMultiviewViewCount: 6,
3257 maxMultiviewInstanceIndex: !0,
3259 id_properties: api::VkPhysicalDeviceIDProperties {
3260 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES,
3262 deviceUUID: *PhysicalDevice::get_device_uuid().as_bytes(),
3263 driverUUID: *PhysicalDevice::get_driver_uuid().as_bytes(),
3264 deviceLUID: [0; api::VK_LUID_SIZE as usize],
3266 deviceLUIDValid: api::VK_FALSE,
3268 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties {
3269 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES,
3271 maxPerSetDescriptors: !0,
3272 maxMemoryAllocationSize: isize::max_value() as u64,
3273 ..mem::zeroed() // for padding fields
3275 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties {
3276 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES,
3278 protectedNoFault: api::VK_FALSE,
3280 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties {
3281 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES,
3283 subgroupSize: 1, // FIXME fill in correct value
3284 supportedStages: api::VK_SHADER_STAGE_COMPUTE_BIT,
3285 supportedOperations: api::VK_SUBGROUP_FEATURE_BASIC_BIT,
3286 quadOperationsInAllStages: api::VK_FALSE,
3294 #[allow(non_snake_case)]
3295 pub unsafe extern "system" fn vkGetInstanceProcAddr(
3296 instance: api::VkInstance,
3297 name: *const c_char,
3298 ) -> api::PFN_vkVoidFunction {
3299 match instance.get() {
3300 Some(_) => get_proc_address(
3302 GetProcAddressScope::Instance,
3303 &SharedHandle::from(instance)
3306 .allowed_extensions,
3308 None => get_proc_address(
3310 GetProcAddressScope::Global,
3311 &Extensions::create_empty(),
3316 pub fn make_api_version(major: u32, minor: u32, patch: u32) -> u32 {
3317 assert!(major < (1 << 10));
3318 assert!(minor < (1 << 10));
3319 assert!(patch < (1 << 12));
3320 (major << 22) | (minor << 12) | patch
3323 #[allow(non_snake_case)]
3324 pub unsafe extern "system" fn vkEnumerateInstanceVersion(api_version: *mut u32) -> api::VkResult {
3325 *api_version = make_api_version(1, 1, api::VK_HEADER_VERSION);
3329 pub unsafe fn enumerate_helper<T, Item, I: IntoIterator<Item = Item>, AF: FnMut(&mut T, Item)>(
3330 api_value_count: *mut u32,
3333 mut assign_function: AF,
3334 ) -> api::VkResult {
3335 let mut retval = api::VK_SUCCESS;
3336 let mut api_values = if api_values.is_null() {
3339 Some(slice::from_raw_parts_mut(
3341 *api_value_count as usize,
3344 let mut final_count = 0;
3345 for value in values {
3346 if let Some(api_values) = &mut api_values {
3347 if final_count >= api_values.len() {
3348 retval = api::VK_INCOMPLETE;
3351 assign_function(&mut api_values[final_count], value);
3358 assert_eq!(final_count as u32 as usize, final_count);
3359 *api_value_count = final_count as u32;
3363 #[allow(non_snake_case)]
3364 pub unsafe extern "system" fn vkEnumerateInstanceLayerProperties(
3365 property_count: *mut u32,
3366 properties: *mut api::VkLayerProperties,
3367 ) -> api::VkResult {
3368 enumerate_helper(property_count, properties, &[], |l, r| *l = *r)
3371 #[allow(non_snake_case)]
3372 pub unsafe extern "system" fn vkEnumerateInstanceExtensionProperties(
3373 layer_name: *const c_char,
3374 property_count: *mut u32,
3375 properties: *mut api::VkExtensionProperties,
3376 ) -> api::VkResult {
3377 enumerate_extension_properties(
3381 ExtensionScope::Instance,
3385 #[allow(non_snake_case)]
3386 pub unsafe extern "system" fn vkCreateInstance(
3387 create_info: *const api::VkInstanceCreateInfo,
3388 _allocator: *const api::VkAllocationCallbacks,
3389 instance: *mut api::VkInstance,
3390 ) -> api::VkResult {
3391 *instance = Handle::null();
3392 match Instance::new(create_info) {
3397 Err(error) => error,
3401 #[allow(non_snake_case)]
3402 pub unsafe extern "system" fn vkDestroyInstance(
3403 instance: api::VkInstance,
3404 _allocator: *const api::VkAllocationCallbacks,
3406 OwnedHandle::from(instance);
3409 #[allow(non_snake_case)]
3410 pub unsafe extern "system" fn vkEnumeratePhysicalDevices(
3411 instance: api::VkInstance,
3412 physical_device_count: *mut u32,
3413 physical_devices: *mut api::VkPhysicalDevice,
3414 ) -> api::VkResult {
3415 let instance = SharedHandle::from(instance).unwrap();
3417 physical_device_count,
3419 iter::once(instance.physical_device.get_handle()),
3424 #[allow(non_snake_case)]
3425 pub unsafe extern "system" fn vkGetPhysicalDeviceFeatures(
3426 physical_device: api::VkPhysicalDevice,
3427 features: *mut api::VkPhysicalDeviceFeatures,
3429 let mut v = api::VkPhysicalDeviceFeatures2 {
3430 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
3432 features: mem::zeroed(),
3434 vkGetPhysicalDeviceFeatures2(physical_device, &mut v);
3435 *features = v.features;
3438 #[allow(non_snake_case)]
3439 pub unsafe extern "system" fn vkGetPhysicalDeviceFormatProperties(
3440 physical_device: api::VkPhysicalDevice,
3441 format: api::VkFormat,
3442 format_properties: *mut api::VkFormatProperties,
3444 let mut format_properties2 = api::VkFormatProperties2 {
3445 sType: api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
3447 formatProperties: mem::zeroed(),
3449 vkGetPhysicalDeviceFormatProperties2(physical_device, format, &mut format_properties2);
3450 *format_properties = format_properties2.formatProperties;
3453 #[allow(non_snake_case)]
3454 pub unsafe extern "system" fn vkGetPhysicalDeviceImageFormatProperties(
3455 _physicalDevice: api::VkPhysicalDevice,
3456 _format: api::VkFormat,
3457 _type_: api::VkImageType,
3458 _tiling: api::VkImageTiling,
3459 _usage: api::VkImageUsageFlags,
3460 _flags: api::VkImageCreateFlags,
3461 _pImageFormatProperties: *mut api::VkImageFormatProperties,
3462 ) -> api::VkResult {
3466 #[allow(non_snake_case)]
3467 pub unsafe extern "system" fn vkGetPhysicalDeviceProperties(
3468 physical_device: api::VkPhysicalDevice,
3469 properties: *mut api::VkPhysicalDeviceProperties,
3471 let physical_device = SharedHandle::from(physical_device).unwrap();
3472 *properties = physical_device.properties;
3475 unsafe fn get_physical_device_queue_family_properties(
3476 _physical_device: &SharedHandle<api::VkPhysicalDevice>,
3477 queue_family_properties: &mut api::VkQueueFamilyProperties2,
3480 parse_next_chain_mut!{
3481 queue_family_properties,
3482 root = api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2,
3484 queue_family_properties.queueFamilyProperties = api::VkQueueFamilyProperties {
3485 queueFlags: api::VK_QUEUE_GRAPHICS_BIT
3486 | api::VK_QUEUE_COMPUTE_BIT
3487 | api::VK_QUEUE_TRANSFER_BIT,
3488 queueCount: queue_count,
3489 timestampValidBits: 0,
3490 minImageTransferGranularity: api::VkExtent3D {
3498 #[allow(non_snake_case)]
3499 pub unsafe extern "system" fn vkGetPhysicalDeviceQueueFamilyProperties(
3500 physical_device: api::VkPhysicalDevice,
3501 queue_family_property_count: *mut u32,
3502 queue_family_properties: *mut api::VkQueueFamilyProperties,
3505 queue_family_property_count,
3506 queue_family_properties,
3507 QUEUE_COUNTS.iter(),
3508 |queue_family_properties, &count| {
3509 let mut queue_family_properties2 = api::VkQueueFamilyProperties2 {
3510 sType: api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2,
3512 queueFamilyProperties: mem::zeroed(),
3514 get_physical_device_queue_family_properties(
3515 &SharedHandle::from(physical_device).unwrap(),
3516 &mut queue_family_properties2,
3519 *queue_family_properties = queue_family_properties2.queueFamilyProperties;
3524 #[allow(non_snake_case)]
3525 pub unsafe extern "system" fn vkGetPhysicalDeviceMemoryProperties(
3526 physical_device: api::VkPhysicalDevice,
3527 memory_properties: *mut api::VkPhysicalDeviceMemoryProperties,
3529 let mut memory_properties2 = api::VkPhysicalDeviceMemoryProperties2 {
3530 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2,
3532 memoryProperties: mem::zeroed(),
3534 vkGetPhysicalDeviceMemoryProperties2(physical_device, &mut memory_properties2);
3535 *memory_properties = memory_properties2.memoryProperties;
3538 #[allow(non_snake_case)]
3539 pub unsafe extern "system" fn vkGetDeviceProcAddr(
3540 device: api::VkDevice,
3541 name: *const c_char,
3542 ) -> api::PFN_vkVoidFunction {
3545 GetProcAddressScope::Device,
3546 &SharedHandle::from(device).unwrap().extensions,
3550 #[allow(non_snake_case)]
3551 pub unsafe extern "system" fn vkCreateDevice(
3552 physical_device: api::VkPhysicalDevice,
3553 create_info: *const api::VkDeviceCreateInfo,
3554 _allocator: *const api::VkAllocationCallbacks,
3555 device: *mut api::VkDevice,
3556 ) -> api::VkResult {
3557 *device = Handle::null();
3558 match Device::new(SharedHandle::from(physical_device).unwrap(), create_info) {
3563 Err(error) => error,
3567 #[allow(non_snake_case)]
3568 pub unsafe extern "system" fn vkDestroyDevice(
3569 device: api::VkDevice,
3570 _allocator: *const api::VkAllocationCallbacks,
3572 OwnedHandle::from(device);
3575 unsafe fn enumerate_extension_properties(
3576 layer_name: *const c_char,
3577 property_count: *mut u32,
3578 properties: *mut api::VkExtensionProperties,
3579 extension_scope: ExtensionScope,
3580 ) -> api::VkResult {
3581 if !layer_name.is_null() {
3582 return api::VK_ERROR_LAYER_NOT_PRESENT;
3587 Extensions::default().iter().filter_map(
3588 |(extension, _): (Extension, _)| -> Option<api::VkExtensionProperties> {
3589 if extension.get_scope() == extension_scope {
3590 Some(extension.get_properties())
3600 #[allow(non_snake_case)]
3601 pub unsafe extern "system" fn vkEnumerateDeviceExtensionProperties(
3602 _physical_device: api::VkPhysicalDevice,
3603 layer_name: *const c_char,
3604 property_count: *mut u32,
3605 properties: *mut api::VkExtensionProperties,
3606 ) -> api::VkResult {
3607 enumerate_extension_properties(
3611 ExtensionScope::Device,
3615 #[allow(non_snake_case)]
3616 pub unsafe extern "system" fn vkEnumerateDeviceLayerProperties(
3617 _physicalDevice: api::VkPhysicalDevice,
3618 _pPropertyCount: *mut u32,
3619 _pProperties: *mut api::VkLayerProperties,
3620 ) -> api::VkResult {
3624 #[allow(non_snake_case)]
3625 pub unsafe extern "system" fn vkGetDeviceQueue(
3626 device: api::VkDevice,
3627 queue_family_index: u32,
3629 queue: *mut api::VkQueue,
3633 &api::VkDeviceQueueInfo2 {
3634 sType: api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2,
3637 queueFamilyIndex: queue_family_index,
3638 queueIndex: queue_index,
3644 #[allow(non_snake_case)]
3645 pub unsafe extern "system" fn vkQueueSubmit(
3646 _queue: api::VkQueue,
3648 _pSubmits: *const api::VkSubmitInfo,
3649 _fence: api::VkFence,
3650 ) -> api::VkResult {
3654 #[allow(non_snake_case)]
3655 pub unsafe extern "system" fn vkQueueWaitIdle(_queue: api::VkQueue) -> api::VkResult {
3659 #[allow(non_snake_case)]
3660 pub unsafe extern "system" fn vkDeviceWaitIdle(_device: api::VkDevice) -> api::VkResult {
3664 #[allow(non_snake_case)]
3665 pub unsafe extern "system" fn vkAllocateMemory(
3666 _device: api::VkDevice,
3667 allocate_info: *const api::VkMemoryAllocateInfo,
3668 _allocator: *const api::VkAllocationCallbacks,
3669 memory: *mut api::VkDeviceMemory,
3670 ) -> api::VkResult {
3671 parse_next_chain_const!{
3673 root = api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
3674 export_memory_allocate_info: api::VkExportMemoryAllocateInfo = api::VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO,
3675 memory_allocate_flags_info: api::VkMemoryAllocateFlagsInfo = api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO,
3676 memory_dedicated_allocate_info: api::VkMemoryDedicatedAllocateInfo = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
3678 let allocate_info = &*allocate_info;
3679 if !export_memory_allocate_info.is_null() {
3682 if !memory_allocate_flags_info.is_null() {
3685 if !memory_dedicated_allocate_info.is_null() {
3688 match DeviceMemoryType::from_index(allocate_info.memoryTypeIndex).unwrap() {
3689 DeviceMemoryType::Main => {
3690 if allocate_info.allocationSize > isize::max_value() as u64 {
3691 return api::VK_ERROR_OUT_OF_DEVICE_MEMORY;
3693 match DeviceMemory::allocate_from_default_heap(DeviceMemoryLayout::calculate(
3694 allocate_info.allocationSize as usize,
3695 MIN_MEMORY_MAP_ALIGNMENT,
3698 *memory = OwnedHandle::<api::VkDeviceMemory>::new(new_memory).take();
3701 Err(_) => api::VK_ERROR_OUT_OF_DEVICE_MEMORY,
3707 #[allow(non_snake_case)]
3708 pub unsafe extern "system" fn vkFreeMemory(
3709 _device: api::VkDevice,
3710 memory: api::VkDeviceMemory,
3711 _allocator: *const api::VkAllocationCallbacks,
3713 if !memory.is_null() {
3714 OwnedHandle::from(memory);
3718 #[allow(non_snake_case)]
3719 pub unsafe extern "system" fn vkMapMemory(
3720 _device: api::VkDevice,
3721 memory: api::VkDeviceMemory,
3722 offset: api::VkDeviceSize,
3723 _size: api::VkDeviceSize,
3724 _flags: api::VkMemoryMapFlags,
3725 data: *mut *mut c_void,
3726 ) -> api::VkResult {
3727 let memory = SharedHandle::from(memory).unwrap();
3728 // remember to keep vkUnmapMemory up to date
3729 *data = memory.get().as_ptr().offset(offset as isize) as *mut c_void;
3733 #[allow(non_snake_case)]
3734 pub unsafe extern "system" fn vkUnmapMemory(_device: api::VkDevice, _memory: api::VkDeviceMemory) {}
3736 #[allow(non_snake_case)]
3737 pub unsafe extern "system" fn vkFlushMappedMemoryRanges(
3738 _device: api::VkDevice,
3739 _memoryRangeCount: u32,
3740 _pMemoryRanges: *const api::VkMappedMemoryRange,
3741 ) -> api::VkResult {
3745 #[allow(non_snake_case)]
3746 pub unsafe extern "system" fn vkInvalidateMappedMemoryRanges(
3747 _device: api::VkDevice,
3748 _memoryRangeCount: u32,
3749 _pMemoryRanges: *const api::VkMappedMemoryRange,
3750 ) -> api::VkResult {
3754 #[allow(non_snake_case)]
3755 pub unsafe extern "system" fn vkGetDeviceMemoryCommitment(
3756 _device: api::VkDevice,
3757 _memory: api::VkDeviceMemory,
3758 _pCommittedMemoryInBytes: *mut api::VkDeviceSize,
3763 #[allow(non_snake_case)]
3764 pub unsafe extern "system" fn vkBindBufferMemory(
3765 device: api::VkDevice,
3766 buffer: api::VkBuffer,
3767 memory: api::VkDeviceMemory,
3768 memory_offset: api::VkDeviceSize,
3769 ) -> api::VkResult {
3770 vkBindBufferMemory2(
3773 &api::VkBindBufferMemoryInfo {
3774 sType: api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO,
3778 memoryOffset: memory_offset,
3783 #[allow(non_snake_case)]
3784 pub unsafe extern "system" fn vkBindImageMemory(
3785 device: api::VkDevice,
3786 image: api::VkImage,
3787 memory: api::VkDeviceMemory,
3788 memory_offset: api::VkDeviceSize,
3789 ) -> api::VkResult {
3793 &api::VkBindImageMemoryInfo {
3794 sType: api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
3798 memoryOffset: memory_offset,
3803 #[allow(non_snake_case)]
3804 pub unsafe extern "system" fn vkGetBufferMemoryRequirements(
3805 device: api::VkDevice,
3806 buffer: api::VkBuffer,
3807 memory_requirements: *mut api::VkMemoryRequirements,
3809 let mut memory_requirements_2 = api::VkMemoryRequirements2 {
3810 sType: api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
3812 memoryRequirements: mem::zeroed(),
3814 vkGetBufferMemoryRequirements2(
3816 &api::VkBufferMemoryRequirementsInfo2 {
3817 sType: api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
3821 &mut memory_requirements_2,
3823 *memory_requirements = memory_requirements_2.memoryRequirements;
3826 #[allow(non_snake_case)]
3827 pub unsafe extern "system" fn vkGetImageMemoryRequirements(
3828 device: api::VkDevice,
3829 image: api::VkImage,
3830 memory_requirements: *mut api::VkMemoryRequirements,
3832 let mut memory_requirements_2 = api::VkMemoryRequirements2 {
3833 sType: api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
3835 memoryRequirements: mem::zeroed(),
3837 vkGetImageMemoryRequirements2(
3839 &api::VkImageMemoryRequirementsInfo2 {
3840 sType: api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2,
3844 &mut memory_requirements_2,
3846 *memory_requirements = memory_requirements_2.memoryRequirements;
3849 #[allow(non_snake_case)]
3850 pub unsafe extern "system" fn vkGetImageSparseMemoryRequirements(
3851 _device: api::VkDevice,
3852 _image: api::VkImage,
3853 _pSparseMemoryRequirementCount: *mut u32,
3854 _pSparseMemoryRequirements: *mut api::VkSparseImageMemoryRequirements,
3859 #[allow(non_snake_case)]
3860 pub unsafe extern "system" fn vkGetPhysicalDeviceSparseImageFormatProperties(
3861 _physicalDevice: api::VkPhysicalDevice,
3862 _format: api::VkFormat,
3863 _type_: api::VkImageType,
3864 _samples: api::VkSampleCountFlagBits,
3865 _usage: api::VkImageUsageFlags,
3866 _tiling: api::VkImageTiling,
3867 _pPropertyCount: *mut u32,
3868 _pProperties: *mut api::VkSparseImageFormatProperties,
3873 #[allow(non_snake_case)]
3874 pub unsafe extern "system" fn vkQueueBindSparse(
3875 _queue: api::VkQueue,
3876 _bindInfoCount: u32,
3877 _pBindInfo: *const api::VkBindSparseInfo,
3878 _fence: api::VkFence,
3879 ) -> api::VkResult {
3883 #[allow(non_snake_case)]
3884 pub unsafe extern "system" fn vkCreateFence(
3885 _device: api::VkDevice,
3886 _pCreateInfo: *const api::VkFenceCreateInfo,
3887 _pAllocator: *const api::VkAllocationCallbacks,
3888 _pFence: *mut api::VkFence,
3889 ) -> api::VkResult {
3893 #[allow(non_snake_case)]
3894 pub unsafe extern "system" fn vkDestroyFence(
3895 _device: api::VkDevice,
3896 _fence: api::VkFence,
3897 _pAllocator: *const api::VkAllocationCallbacks,
3902 #[allow(non_snake_case)]
3903 pub unsafe extern "system" fn vkResetFences(
3904 _device: api::VkDevice,
3906 _pFences: *const api::VkFence,
3907 ) -> api::VkResult {
3911 #[allow(non_snake_case)]
3912 pub unsafe extern "system" fn vkGetFenceStatus(
3913 _device: api::VkDevice,
3914 _fence: api::VkFence,
3915 ) -> api::VkResult {
3919 #[allow(non_snake_case)]
3920 pub unsafe extern "system" fn vkWaitForFences(
3921 _device: api::VkDevice,
3923 _pFences: *const api::VkFence,
3924 _waitAll: api::VkBool32,
3926 ) -> api::VkResult {
3930 #[allow(non_snake_case)]
3931 pub unsafe extern "system" fn vkCreateSemaphore(
3932 _device: api::VkDevice,
3933 _pCreateInfo: *const api::VkSemaphoreCreateInfo,
3934 _pAllocator: *const api::VkAllocationCallbacks,
3935 _pSemaphore: *mut api::VkSemaphore,
3936 ) -> api::VkResult {
3940 #[allow(non_snake_case)]
3941 pub unsafe extern "system" fn vkDestroySemaphore(
3942 _device: api::VkDevice,
3943 _semaphore: api::VkSemaphore,
3944 _pAllocator: *const api::VkAllocationCallbacks,
3949 #[allow(non_snake_case)]
3950 pub unsafe extern "system" fn vkCreateEvent(
3951 _device: api::VkDevice,
3952 _pCreateInfo: *const api::VkEventCreateInfo,
3953 _pAllocator: *const api::VkAllocationCallbacks,
3954 _pEvent: *mut api::VkEvent,
3955 ) -> api::VkResult {
3959 #[allow(non_snake_case)]
3960 pub unsafe extern "system" fn vkDestroyEvent(
3961 _device: api::VkDevice,
3962 _event: api::VkEvent,
3963 _pAllocator: *const api::VkAllocationCallbacks,
3968 #[allow(non_snake_case)]
3969 pub unsafe extern "system" fn vkGetEventStatus(
3970 _device: api::VkDevice,
3971 _event: api::VkEvent,
3972 ) -> api::VkResult {
3976 #[allow(non_snake_case)]
3977 pub unsafe extern "system" fn vkSetEvent(
3978 _device: api::VkDevice,
3979 _event: api::VkEvent,
3980 ) -> api::VkResult {
3984 #[allow(non_snake_case)]
3985 pub unsafe extern "system" fn vkResetEvent(
3986 _device: api::VkDevice,
3987 _event: api::VkEvent,
3988 ) -> api::VkResult {
3992 #[allow(non_snake_case)]
3993 pub unsafe extern "system" fn vkCreateQueryPool(
3994 _device: api::VkDevice,
3995 _pCreateInfo: *const api::VkQueryPoolCreateInfo,
3996 _pAllocator: *const api::VkAllocationCallbacks,
3997 _pQueryPool: *mut api::VkQueryPool,
3998 ) -> api::VkResult {
4002 #[allow(non_snake_case)]
4003 pub unsafe extern "system" fn vkDestroyQueryPool(
4004 _device: api::VkDevice,
4005 _queryPool: api::VkQueryPool,
4006 _pAllocator: *const api::VkAllocationCallbacks,
4011 #[allow(non_snake_case)]
4012 pub unsafe extern "system" fn vkGetQueryPoolResults(
4013 _device: api::VkDevice,
4014 _queryPool: api::VkQueryPool,
4018 _pData: *mut c_void,
4019 _stride: api::VkDeviceSize,
4020 _flags: api::VkQueryResultFlags,
4021 ) -> api::VkResult {
4025 #[allow(non_snake_case)]
4026 pub unsafe extern "system" fn vkCreateBuffer(
4027 _device: api::VkDevice,
4028 create_info: *const api::VkBufferCreateInfo,
4029 _allocator: *const api::VkAllocationCallbacks,
4030 buffer: *mut api::VkBuffer,
4031 ) -> api::VkResult {
4032 parse_next_chain_const!{
4034 root = api::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
4035 external_memory_buffer: api::VkExternalMemoryBufferCreateInfo = api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO,
4037 let create_info = &*create_info;
4038 if !external_memory_buffer.is_null() {
4039 let external_memory_buffer = &*external_memory_buffer;
4040 assert_eq!(external_memory_buffer.handleTypes, 0);
4042 if create_info.size > isize::max_value() as u64 {
4043 return api::VK_ERROR_OUT_OF_DEVICE_MEMORY;
4045 *buffer = OwnedHandle::<api::VkBuffer>::new(Buffer {
4046 size: create_info.size as usize,
4053 #[allow(non_snake_case)]
4054 pub unsafe extern "system" fn vkDestroyBuffer(
4055 _device: api::VkDevice,
4056 buffer: api::VkBuffer,
4057 _allocator: *const api::VkAllocationCallbacks,
4059 OwnedHandle::from(buffer);
4062 #[allow(non_snake_case)]
4063 pub unsafe extern "system" fn vkCreateBufferView(
4064 _device: api::VkDevice,
4065 _pCreateInfo: *const api::VkBufferViewCreateInfo,
4066 _pAllocator: *const api::VkAllocationCallbacks,
4067 _pView: *mut api::VkBufferView,
4068 ) -> api::VkResult {
4072 #[allow(non_snake_case)]
4073 pub unsafe extern "system" fn vkDestroyBufferView(
4074 _device: api::VkDevice,
4075 _bufferView: api::VkBufferView,
4076 _pAllocator: *const api::VkAllocationCallbacks,
4081 #[allow(non_snake_case)]
4082 pub unsafe extern "system" fn vkCreateImage(
4083 _device: api::VkDevice,
4084 create_info: *const api::VkImageCreateInfo,
4085 _allocator: *const api::VkAllocationCallbacks,
4086 image: *mut api::VkImage,
4087 ) -> api::VkResult {
4088 parse_next_chain_const!{
4090 root = api::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
4091 external_memory_image_create_info: api::VkExternalMemoryImageCreateInfo = api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,
4092 image_swapchain_create_info: api::VkImageSwapchainCreateInfoKHR = api::VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR,
4094 let create_info = &*create_info;
4095 if !external_memory_image_create_info.is_null() {
4098 if !image_swapchain_create_info.is_null() {
4101 *image = OwnedHandle::<api::VkImage>::new(Image {
4102 properties: ImageProperties {
4103 supported_tilings: match create_info.tiling {
4104 api::VK_IMAGE_TILING_OPTIMAL => SupportedTilings::Any,
4105 api::VK_IMAGE_TILING_LINEAR => SupportedTilings::LinearOnly,
4106 _ => unreachable!("invalid image tiling"),
4108 format: create_info.format,
4109 extents: create_info.extent,
4110 array_layers: create_info.arrayLayers,
4111 mip_levels: create_info.mipLevels,
4112 multisample_count: match create_info.samples {
4113 api::VK_SAMPLE_COUNT_1_BIT => ImageMultisampleCount::Count1,
4114 api::VK_SAMPLE_COUNT_4_BIT => ImageMultisampleCount::Count4,
4115 _ => unreachable!("invalid sample count"),
4117 swapchain_present_tiling: None,
4125 #[allow(non_snake_case)]
4126 pub unsafe extern "system" fn vkDestroyImage(
4127 _device: api::VkDevice,
4128 image: api::VkImage,
4129 _allocator: *const api::VkAllocationCallbacks,
4131 OwnedHandle::from(image);
4134 #[allow(non_snake_case)]
4135 pub unsafe extern "system" fn vkGetImageSubresourceLayout(
4136 _device: api::VkDevice,
4137 _image: api::VkImage,
4138 _pSubresource: *const api::VkImageSubresource,
4139 _pLayout: *mut api::VkSubresourceLayout,
4144 #[allow(non_snake_case)]
4145 pub unsafe extern "system" fn vkCreateImageView(
4146 _device: api::VkDevice,
4147 create_info: *const api::VkImageViewCreateInfo,
4148 _allocator: *const api::VkAllocationCallbacks,
4149 view: *mut api::VkImageView,
4150 ) -> api::VkResult {
4151 parse_next_chain_const!{
4153 root = api::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
4155 let create_info = &*create_info;
4156 let new_view = OwnedHandle::<api::VkImageView>::new(ImageView {
4157 image: SharedHandle::from(create_info.image).unwrap(),
4158 view_type: ImageViewType::from(create_info.viewType),
4159 format: create_info.format,
4160 component_mapping: ComponentMapping::from(create_info.components).unwrap(),
4161 subresource_range: create_info.subresourceRange,
4163 *view = new_view.take();
4167 #[allow(non_snake_case)]
4168 pub unsafe extern "system" fn vkDestroyImageView(
4169 _device: api::VkDevice,
4170 image_view: api::VkImageView,
4171 _allocator: *const api::VkAllocationCallbacks,
4173 OwnedHandle::from(image_view);
4176 #[allow(non_snake_case)]
4177 pub unsafe extern "system" fn vkCreateShaderModule(
4178 _device: api::VkDevice,
4179 create_info: *const api::VkShaderModuleCreateInfo,
4180 _allocator: *const api::VkAllocationCallbacks,
4181 shader_module: *mut api::VkShaderModule,
4182 ) -> api::VkResult {
4183 parse_next_chain_const!{
4185 root = api::VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
4187 let create_info = &*create_info;
4188 const U32_BYTE_COUNT: usize = 4;
4189 assert_eq!(U32_BYTE_COUNT, mem::size_of::<u32>());
4190 assert_eq!(create_info.codeSize % U32_BYTE_COUNT, 0);
4191 assert_ne!(create_info.codeSize, 0);
4192 let code = slice::from_raw_parts(create_info.pCode, create_info.codeSize / U32_BYTE_COUNT);
4193 *shader_module = OwnedHandle::<api::VkShaderModule>::new(ShaderModule {
4194 code: code.to_owned(),
4200 #[allow(non_snake_case)]
4201 pub unsafe extern "system" fn vkDestroyShaderModule(
4202 _device: api::VkDevice,
4203 shader_module: api::VkShaderModule,
4204 _allocator: *const api::VkAllocationCallbacks,
4206 OwnedHandle::from(shader_module);
4209 #[allow(non_snake_case)]
4210 pub unsafe extern "system" fn vkCreatePipelineCache(
4211 _device: api::VkDevice,
4212 _pCreateInfo: *const api::VkPipelineCacheCreateInfo,
4213 _pAllocator: *const api::VkAllocationCallbacks,
4214 _pPipelineCache: *mut api::VkPipelineCache,
4215 ) -> api::VkResult {
4219 #[allow(non_snake_case)]
4220 pub unsafe extern "system" fn vkDestroyPipelineCache(
4221 _device: api::VkDevice,
4222 _pipelineCache: api::VkPipelineCache,
4223 _pAllocator: *const api::VkAllocationCallbacks,
4228 #[allow(non_snake_case)]
4229 pub unsafe extern "system" fn vkGetPipelineCacheData(
4230 _device: api::VkDevice,
4231 _pipelineCache: api::VkPipelineCache,
4232 _pDataSize: *mut usize,
4233 _pData: *mut c_void,
4234 ) -> api::VkResult {
4238 #[allow(non_snake_case)]
4239 pub unsafe extern "system" fn vkMergePipelineCaches(
4240 _device: api::VkDevice,
4241 _dstCache: api::VkPipelineCache,
4242 _srcCacheCount: u32,
4243 _pSrcCaches: *const api::VkPipelineCache,
4244 ) -> api::VkResult {
4248 #[allow(non_snake_case)]
4249 pub unsafe extern "system" fn vkCreateGraphicsPipelines(
4250 _device: api::VkDevice,
4251 _pipelineCache: api::VkPipelineCache,
4252 _createInfoCount: u32,
4253 _pCreateInfos: *const api::VkGraphicsPipelineCreateInfo,
4254 _pAllocator: *const api::VkAllocationCallbacks,
4255 _pPipelines: *mut api::VkPipeline,
4256 ) -> api::VkResult {
4260 #[allow(non_snake_case)]
4261 pub unsafe extern "system" fn vkCreateComputePipelines(
4262 _device: api::VkDevice,
4263 _pipelineCache: api::VkPipelineCache,
4264 _createInfoCount: u32,
4265 _pCreateInfos: *const api::VkComputePipelineCreateInfo,
4266 _pAllocator: *const api::VkAllocationCallbacks,
4267 _pPipelines: *mut api::VkPipeline,
4268 ) -> api::VkResult {
4272 #[allow(non_snake_case)]
4273 pub unsafe extern "system" fn vkDestroyPipeline(
4274 _device: api::VkDevice,
4275 _pipeline: api::VkPipeline,
4276 _pAllocator: *const api::VkAllocationCallbacks,
4281 #[allow(non_snake_case)]
4282 pub unsafe extern "system" fn vkCreatePipelineLayout(
4283 _device: api::VkDevice,
4284 _pCreateInfo: *const api::VkPipelineLayoutCreateInfo,
4285 _pAllocator: *const api::VkAllocationCallbacks,
4286 _pPipelineLayout: *mut api::VkPipelineLayout,
4287 ) -> api::VkResult {
4291 #[allow(non_snake_case)]
4292 pub unsafe extern "system" fn vkDestroyPipelineLayout(
4293 _device: api::VkDevice,
4294 _pipelineLayout: api::VkPipelineLayout,
4295 _pAllocator: *const api::VkAllocationCallbacks,
4300 #[allow(non_snake_case)]
4301 pub unsafe extern "system" fn vkCreateSampler(
4302 _device: api::VkDevice,
4303 create_info: *const api::VkSamplerCreateInfo,
4304 _allocator: *const api::VkAllocationCallbacks,
4305 sampler: *mut api::VkSampler,
4306 ) -> api::VkResult {
4307 parse_next_chain_const!{
4309 root = api::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
4311 let create_info = &*create_info;
4312 *sampler = OwnedHandle::<api::VkSampler>::new(Sampler {
4313 mag_filter: create_info.magFilter,
4314 min_filter: create_info.minFilter,
4315 mipmap_mode: create_info.mipmapMode,
4317 create_info.addressModeU,
4318 create_info.addressModeV,
4319 create_info.addressModeW,
4321 mip_lod_bias: create_info.mipLodBias,
4322 anisotropy: if create_info.anisotropyEnable != api::VK_FALSE {
4323 Some(sampler::AnisotropySettings {
4324 max: create_info.maxAnisotropy,
4329 compare_op: if create_info.compareEnable != api::VK_FALSE {
4330 Some(create_info.compareOp)
4334 min_lod: create_info.minLod,
4335 max_lod: create_info.maxLod,
4336 border_color: create_info.borderColor,
4337 unnormalized_coordinates: create_info.unnormalizedCoordinates != api::VK_FALSE,
4338 sampler_ycbcr_conversion: None,
4344 #[allow(non_snake_case)]
4345 pub unsafe extern "system" fn vkDestroySampler(
4346 _device: api::VkDevice,
4347 sampler: api::VkSampler,
4348 _allocator: *const api::VkAllocationCallbacks,
4350 OwnedHandle::from(sampler);
4353 #[allow(non_snake_case)]
4354 pub unsafe extern "system" fn vkCreateDescriptorSetLayout(
4355 _device: api::VkDevice,
4356 create_info: *const api::VkDescriptorSetLayoutCreateInfo,
4357 _allocator: *const api::VkAllocationCallbacks,
4358 set_layout: *mut api::VkDescriptorSetLayout,
4359 ) -> api::VkResult {
4360 parse_next_chain_const!{
4362 root = api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
4364 let create_info = &*create_info;
4365 let bindings = match create_info.bindingCount {
4367 binding_count => slice::from_raw_parts(create_info.pBindings, binding_count as usize),
4369 let max_binding = bindings.iter().map(|v| v.binding).max().unwrap_or(0) as usize;
4370 let mut bindings_map: Vec<Option<DescriptorLayout>> = (0..=max_binding).map(|_| None).collect();
4371 for binding in bindings {
4372 let bindings_map_entry = &mut bindings_map[binding.binding as usize];
4374 bindings_map_entry.is_none(),
4375 "duplicate binding: {}",
4378 *bindings_map_entry = Some(DescriptorLayout::from(binding));
4380 *set_layout = OwnedHandle::<api::VkDescriptorSetLayout>::new(DescriptorSetLayout {
4381 bindings: bindings_map,
4387 #[allow(non_snake_case)]
4388 pub unsafe extern "system" fn vkDestroyDescriptorSetLayout(
4389 _device: api::VkDevice,
4390 descriptor_set_layout: api::VkDescriptorSetLayout,
4391 _allocator: *const api::VkAllocationCallbacks,
4393 OwnedHandle::from(descriptor_set_layout);
4396 #[allow(non_snake_case)]
4397 pub unsafe extern "system" fn vkCreateDescriptorPool(
4398 _device: api::VkDevice,
4399 create_info: *const api::VkDescriptorPoolCreateInfo,
4400 _allocator: *const api::VkAllocationCallbacks,
4401 descriptor_pool: *mut api::VkDescriptorPool,
4402 ) -> api::VkResult {
4403 parse_next_chain_const!{
4405 root = api::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
4407 *descriptor_pool = OwnedHandle::<api::VkDescriptorPool>::new(DescriptorPool::new()).take();
4411 #[allow(non_snake_case)]
4412 pub unsafe extern "system" fn vkDestroyDescriptorPool(
4413 _device: api::VkDevice,
4414 descriptor_pool: api::VkDescriptorPool,
4415 _allocator: *const api::VkAllocationCallbacks,
4417 OwnedHandle::from(descriptor_pool);
4420 #[allow(non_snake_case)]
4421 pub unsafe extern "system" fn vkResetDescriptorPool(
4422 _device: api::VkDevice,
4423 descriptor_pool: api::VkDescriptorPool,
4424 _flags: api::VkDescriptorPoolResetFlags,
4425 ) -> api::VkResult {
4426 MutHandle::from(descriptor_pool).unwrap().reset();
4430 #[allow(non_snake_case)]
4431 pub unsafe extern "system" fn vkAllocateDescriptorSets(
4432 _device: api::VkDevice,
4433 allocate_info: *const api::VkDescriptorSetAllocateInfo,
4434 descriptor_sets: *mut api::VkDescriptorSet,
4435 ) -> api::VkResult {
4436 parse_next_chain_const!{
4438 root = api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
4440 let allocate_info = &*allocate_info;
4441 let mut descriptor_pool = MutHandle::from(allocate_info.descriptorPool).unwrap();
4442 let descriptor_sets =
4443 slice::from_raw_parts_mut(descriptor_sets, allocate_info.descriptorSetCount as usize);
4444 let descriptor_set_layouts = slice::from_raw_parts(
4445 allocate_info.pSetLayouts,
4446 allocate_info.descriptorSetCount as usize,
4448 descriptor_pool.allocate(
4449 descriptor_set_layouts
4451 .map(|descriptor_set_layout| DescriptorSet {
4452 bindings: SharedHandle::from(*descriptor_set_layout)
4456 .map(|layout| layout.as_ref().map(Descriptor::from))
4464 #[allow(non_snake_case)]
4465 pub unsafe extern "system" fn vkFreeDescriptorSets(
4466 _device: api::VkDevice,
4467 descriptor_pool: api::VkDescriptorPool,
4468 descriptor_set_count: u32,
4469 descriptor_sets: *const api::VkDescriptorSet,
4470 ) -> api::VkResult {
4471 let mut descriptor_pool = MutHandle::from(descriptor_pool).unwrap();
4472 let descriptor_sets = slice::from_raw_parts(descriptor_sets, descriptor_set_count as usize);
4473 descriptor_pool.free(descriptor_sets);
4477 #[allow(non_snake_case)]
4478 pub unsafe extern "system" fn vkUpdateDescriptorSets(
4479 _device: api::VkDevice,
4480 descriptor_write_count: u32,
4481 descriptor_writes: *const api::VkWriteDescriptorSet,
4482 descriptor_copy_count: u32,
4483 descriptor_copies: *const api::VkCopyDescriptorSet,
4485 let descriptor_writes =
4486 slice::from_raw_parts(descriptor_writes, descriptor_write_count as usize);
4487 let descriptor_copies =
4488 slice::from_raw_parts(descriptor_copies, descriptor_copy_count as usize);
4489 for descriptor_write in descriptor_writes {
4490 parse_next_chain_const!{
4492 root = api::VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
4494 let mut descriptor_set = MutHandle::from(descriptor_write.dstSet).unwrap();
4495 let mut binding_index = descriptor_write.dstBinding as usize;
4496 let mut elements = DescriptorWriteArg::from(descriptor_write);
4497 let mut start_element = Some(descriptor_write.dstArrayElement as usize);
4498 while elements.len() != 0 {
4499 let binding = descriptor_set.bindings[binding_index].as_mut().unwrap();
4501 assert_eq!(binding.descriptor_type(), descriptor_write.descriptorType);
4502 if binding.element_count() == 0 {
4503 assert_eq!(start_element, None);
4506 let start_element = start_element.take().unwrap_or(0);
4507 let used_elements = elements
4509 .min(binding.element_count().checked_sub(start_element).unwrap());
4510 binding.write(start_element, elements.slice_to(..used_elements));
4511 elements = elements.slice_from(used_elements..);
4514 for descriptor_copy in descriptor_copies {
4515 parse_next_chain_const!{
4517 root = api::VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET,
4523 #[allow(non_snake_case)]
4524 pub unsafe extern "system" fn vkCreateFramebuffer(
4525 _device: api::VkDevice,
4526 _pCreateInfo: *const api::VkFramebufferCreateInfo,
4527 _pAllocator: *const api::VkAllocationCallbacks,
4528 _pFramebuffer: *mut api::VkFramebuffer,
4529 ) -> api::VkResult {
4533 #[allow(non_snake_case)]
4534 pub unsafe extern "system" fn vkDestroyFramebuffer(
4535 _device: api::VkDevice,
4536 _framebuffer: api::VkFramebuffer,
4537 _pAllocator: *const api::VkAllocationCallbacks,
4542 #[allow(non_snake_case)]
4543 pub unsafe extern "system" fn vkCreateRenderPass(
4544 _device: api::VkDevice,
4545 create_info: *const api::VkRenderPassCreateInfo,
4546 _allocator: *const api::VkAllocationCallbacks,
4547 render_pass: *mut api::VkRenderPass,
4548 ) -> api::VkResult {
4549 parse_next_chain_const!{
4551 root = api::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
4553 // FIXME: finish implementing
4554 *render_pass = OwnedHandle::<api::VkRenderPass>::new(RenderPass {}).take();
4558 #[allow(non_snake_case)]
4559 pub unsafe extern "system" fn vkDestroyRenderPass(
4560 _device: api::VkDevice,
4561 render_pass: api::VkRenderPass,
4562 _allocator: *const api::VkAllocationCallbacks,
4564 OwnedHandle::from(render_pass);
4567 #[allow(non_snake_case)]
4568 pub unsafe extern "system" fn vkGetRenderAreaGranularity(
4569 _device: api::VkDevice,
4570 _renderPass: api::VkRenderPass,
4571 _pGranularity: *mut api::VkExtent2D,
4576 #[allow(non_snake_case)]
4577 pub unsafe extern "system" fn vkCreateCommandPool(
4578 _device: api::VkDevice,
4579 _pCreateInfo: *const api::VkCommandPoolCreateInfo,
4580 _pAllocator: *const api::VkAllocationCallbacks,
4581 _pCommandPool: *mut api::VkCommandPool,
4582 ) -> api::VkResult {
4586 #[allow(non_snake_case)]
4587 pub unsafe extern "system" fn vkDestroyCommandPool(
4588 _device: api::VkDevice,
4589 _commandPool: api::VkCommandPool,
4590 _pAllocator: *const api::VkAllocationCallbacks,
4595 #[allow(non_snake_case)]
4596 pub unsafe extern "system" fn vkResetCommandPool(
4597 _device: api::VkDevice,
4598 _commandPool: api::VkCommandPool,
4599 _flags: api::VkCommandPoolResetFlags,
4600 ) -> api::VkResult {
4604 #[allow(non_snake_case)]
4605 pub unsafe extern "system" fn vkAllocateCommandBuffers(
4606 _device: api::VkDevice,
4607 _pAllocateInfo: *const api::VkCommandBufferAllocateInfo,
4608 _pCommandBuffers: *mut api::VkCommandBuffer,
4609 ) -> api::VkResult {
4613 #[allow(non_snake_case)]
4614 pub unsafe extern "system" fn vkFreeCommandBuffers(
4615 _device: api::VkDevice,
4616 _commandPool: api::VkCommandPool,
4617 _commandBufferCount: u32,
4618 _pCommandBuffers: *const api::VkCommandBuffer,
4623 #[allow(non_snake_case)]
4624 pub unsafe extern "system" fn vkBeginCommandBuffer(
4625 _commandBuffer: api::VkCommandBuffer,
4626 _pBeginInfo: *const api::VkCommandBufferBeginInfo,
4627 ) -> api::VkResult {
4631 #[allow(non_snake_case)]
4632 pub unsafe extern "system" fn vkEndCommandBuffer(
4633 _commandBuffer: api::VkCommandBuffer,
4634 ) -> api::VkResult {
4638 #[allow(non_snake_case)]
4639 pub unsafe extern "system" fn vkResetCommandBuffer(
4640 _commandBuffer: api::VkCommandBuffer,
4641 _flags: api::VkCommandBufferResetFlags,
4642 ) -> api::VkResult {
4646 #[allow(non_snake_case)]
4647 pub unsafe extern "system" fn vkCmdBindPipeline(
4648 _commandBuffer: api::VkCommandBuffer,
4649 _pipelineBindPoint: api::VkPipelineBindPoint,
4650 _pipeline: api::VkPipeline,
4655 #[allow(non_snake_case)]
4656 pub unsafe extern "system" fn vkCmdSetViewport(
4657 _commandBuffer: api::VkCommandBuffer,
4658 _firstViewport: u32,
4659 _viewportCount: u32,
4660 _pViewports: *const api::VkViewport,
4665 #[allow(non_snake_case)]
4666 pub unsafe extern "system" fn vkCmdSetScissor(
4667 _commandBuffer: api::VkCommandBuffer,
4670 _pScissors: *const api::VkRect2D,
4675 #[allow(non_snake_case)]
4676 pub unsafe extern "system" fn vkCmdSetLineWidth(
4677 _commandBuffer: api::VkCommandBuffer,
4683 #[allow(non_snake_case)]
4684 pub unsafe extern "system" fn vkCmdSetDepthBias(
4685 _commandBuffer: api::VkCommandBuffer,
4686 _depthBiasConstantFactor: f32,
4687 _depthBiasClamp: f32,
4688 _depthBiasSlopeFactor: f32,
4693 #[allow(non_snake_case)]
4694 pub unsafe extern "system" fn vkCmdSetBlendConstants(
4695 _commandBuffer: api::VkCommandBuffer,
4696 _blendConstants: *const f32,
4701 #[allow(non_snake_case)]
4702 pub unsafe extern "system" fn vkCmdSetDepthBounds(
4703 _commandBuffer: api::VkCommandBuffer,
4704 _minDepthBounds: f32,
4705 _maxDepthBounds: f32,
4710 #[allow(non_snake_case)]
4711 pub unsafe extern "system" fn vkCmdSetStencilCompareMask(
4712 _commandBuffer: api::VkCommandBuffer,
4713 _faceMask: api::VkStencilFaceFlags,
4719 #[allow(non_snake_case)]
4720 pub unsafe extern "system" fn vkCmdSetStencilWriteMask(
4721 _commandBuffer: api::VkCommandBuffer,
4722 _faceMask: api::VkStencilFaceFlags,
4728 #[allow(non_snake_case)]
4729 pub unsafe extern "system" fn vkCmdSetStencilReference(
4730 _commandBuffer: api::VkCommandBuffer,
4731 _faceMask: api::VkStencilFaceFlags,
4737 #[allow(non_snake_case)]
4738 pub unsafe extern "system" fn vkCmdBindDescriptorSets(
4739 _commandBuffer: api::VkCommandBuffer,
4740 _pipelineBindPoint: api::VkPipelineBindPoint,
4741 _layout: api::VkPipelineLayout,
4743 _descriptorSetCount: u32,
4744 _pDescriptorSets: *const api::VkDescriptorSet,
4745 _dynamicOffsetCount: u32,
4746 _pDynamicOffsets: *const u32,
4751 #[allow(non_snake_case)]
4752 pub unsafe extern "system" fn vkCmdBindIndexBuffer(
4753 _commandBuffer: api::VkCommandBuffer,
4754 _buffer: api::VkBuffer,
4755 _offset: api::VkDeviceSize,
4756 _indexType: api::VkIndexType,
4761 #[allow(non_snake_case)]
4762 pub unsafe extern "system" fn vkCmdBindVertexBuffers(
4763 _commandBuffer: api::VkCommandBuffer,
4766 _pBuffers: *const api::VkBuffer,
4767 _pOffsets: *const api::VkDeviceSize,
4772 #[allow(non_snake_case)]
4773 pub unsafe extern "system" fn vkCmdDraw(
4774 _commandBuffer: api::VkCommandBuffer,
4776 _instanceCount: u32,
4778 _firstInstance: u32,
4783 #[allow(non_snake_case)]
4784 pub unsafe extern "system" fn vkCmdDrawIndexed(
4785 _commandBuffer: api::VkCommandBuffer,
4787 _instanceCount: u32,
4790 _firstInstance: u32,
4795 #[allow(non_snake_case)]
4796 pub unsafe extern "system" fn vkCmdDrawIndirect(
4797 _commandBuffer: api::VkCommandBuffer,
4798 _buffer: api::VkBuffer,
4799 _offset: api::VkDeviceSize,
4806 #[allow(non_snake_case)]
4807 pub unsafe extern "system" fn vkCmdDrawIndexedIndirect(
4808 _commandBuffer: api::VkCommandBuffer,
4809 _buffer: api::VkBuffer,
4810 _offset: api::VkDeviceSize,
4817 #[allow(non_snake_case)]
4818 pub unsafe extern "system" fn vkCmdDispatch(
4819 _commandBuffer: api::VkCommandBuffer,
4827 #[allow(non_snake_case)]
4828 pub unsafe extern "system" fn vkCmdDispatchIndirect(
4829 _commandBuffer: api::VkCommandBuffer,
4830 _buffer: api::VkBuffer,
4831 _offset: api::VkDeviceSize,
4836 #[allow(non_snake_case)]
4837 pub unsafe extern "system" fn vkCmdCopyBuffer(
4838 _commandBuffer: api::VkCommandBuffer,
4839 _srcBuffer: api::VkBuffer,
4840 _dstBuffer: api::VkBuffer,
4842 _pRegions: *const api::VkBufferCopy,
4847 #[allow(non_snake_case)]
4848 pub unsafe extern "system" fn vkCmdCopyImage(
4849 _commandBuffer: api::VkCommandBuffer,
4850 _srcImage: api::VkImage,
4851 _srcImageLayout: api::VkImageLayout,
4852 _dstImage: api::VkImage,
4853 _dstImageLayout: api::VkImageLayout,
4855 _pRegions: *const api::VkImageCopy,
4860 #[allow(non_snake_case)]
4861 pub unsafe extern "system" fn vkCmdBlitImage(
4862 _commandBuffer: api::VkCommandBuffer,
4863 _srcImage: api::VkImage,
4864 _srcImageLayout: api::VkImageLayout,
4865 _dstImage: api::VkImage,
4866 _dstImageLayout: api::VkImageLayout,
4868 _pRegions: *const api::VkImageBlit,
4869 _filter: api::VkFilter,
4874 #[allow(non_snake_case)]
4875 pub unsafe extern "system" fn vkCmdCopyBufferToImage(
4876 _commandBuffer: api::VkCommandBuffer,
4877 _srcBuffer: api::VkBuffer,
4878 _dstImage: api::VkImage,
4879 _dstImageLayout: api::VkImageLayout,
4881 _pRegions: *const api::VkBufferImageCopy,
4886 #[allow(non_snake_case)]
4887 pub unsafe extern "system" fn vkCmdCopyImageToBuffer(
4888 _commandBuffer: api::VkCommandBuffer,
4889 _srcImage: api::VkImage,
4890 _srcImageLayout: api::VkImageLayout,
4891 _dstBuffer: api::VkBuffer,
4893 _pRegions: *const api::VkBufferImageCopy,
4898 #[allow(non_snake_case)]
4899 pub unsafe extern "system" fn vkCmdUpdateBuffer(
4900 _commandBuffer: api::VkCommandBuffer,
4901 _dstBuffer: api::VkBuffer,
4902 _dstOffset: api::VkDeviceSize,
4903 _dataSize: api::VkDeviceSize,
4904 _pData: *const c_void,
4909 #[allow(non_snake_case)]
4910 pub unsafe extern "system" fn vkCmdFillBuffer(
4911 _commandBuffer: api::VkCommandBuffer,
4912 _dstBuffer: api::VkBuffer,
4913 _dstOffset: api::VkDeviceSize,
4914 _size: api::VkDeviceSize,
4920 #[allow(non_snake_case)]
4921 pub unsafe extern "system" fn vkCmdClearColorImage(
4922 _commandBuffer: api::VkCommandBuffer,
4923 _image: api::VkImage,
4924 _imageLayout: api::VkImageLayout,
4925 _pColor: *const api::VkClearColorValue,
4927 _pRanges: *const api::VkImageSubresourceRange,
4932 #[allow(non_snake_case)]
4933 pub unsafe extern "system" fn vkCmdClearDepthStencilImage(
4934 _commandBuffer: api::VkCommandBuffer,
4935 _image: api::VkImage,
4936 _imageLayout: api::VkImageLayout,
4937 _pDepthStencil: *const api::VkClearDepthStencilValue,
4939 _pRanges: *const api::VkImageSubresourceRange,
4944 #[allow(non_snake_case)]
4945 pub unsafe extern "system" fn vkCmdClearAttachments(
4946 _commandBuffer: api::VkCommandBuffer,
4947 _attachmentCount: u32,
4948 _pAttachments: *const api::VkClearAttachment,
4950 _pRects: *const api::VkClearRect,
4955 #[allow(non_snake_case)]
4956 pub unsafe extern "system" fn vkCmdResolveImage(
4957 _commandBuffer: api::VkCommandBuffer,
4958 _srcImage: api::VkImage,
4959 _srcImageLayout: api::VkImageLayout,
4960 _dstImage: api::VkImage,
4961 _dstImageLayout: api::VkImageLayout,
4963 _pRegions: *const api::VkImageResolve,
4968 #[allow(non_snake_case)]
4969 pub unsafe extern "system" fn vkCmdSetEvent(
4970 _commandBuffer: api::VkCommandBuffer,
4971 _event: api::VkEvent,
4972 _stageMask: api::VkPipelineStageFlags,
4977 #[allow(non_snake_case)]
4978 pub unsafe extern "system" fn vkCmdResetEvent(
4979 _commandBuffer: api::VkCommandBuffer,
4980 _event: api::VkEvent,
4981 _stageMask: api::VkPipelineStageFlags,
4986 #[allow(non_snake_case)]
4987 pub unsafe extern "system" fn vkCmdWaitEvents(
4988 _commandBuffer: api::VkCommandBuffer,
4990 _pEvents: *const api::VkEvent,
4991 _srcStageMask: api::VkPipelineStageFlags,
4992 _dstStageMask: api::VkPipelineStageFlags,
4993 _memoryBarrierCount: u32,
4994 _pMemoryBarriers: *const api::VkMemoryBarrier,
4995 _bufferMemoryBarrierCount: u32,
4996 _pBufferMemoryBarriers: *const api::VkBufferMemoryBarrier,
4997 _imageMemoryBarrierCount: u32,
4998 _pImageMemoryBarriers: *const api::VkImageMemoryBarrier,
5003 #[allow(non_snake_case)]
5004 pub unsafe extern "system" fn vkCmdPipelineBarrier(
5005 _commandBuffer: api::VkCommandBuffer,
5006 _srcStageMask: api::VkPipelineStageFlags,
5007 _dstStageMask: api::VkPipelineStageFlags,
5008 _dependencyFlags: api::VkDependencyFlags,
5009 _memoryBarrierCount: u32,
5010 _pMemoryBarriers: *const api::VkMemoryBarrier,
5011 _bufferMemoryBarrierCount: u32,
5012 _pBufferMemoryBarriers: *const api::VkBufferMemoryBarrier,
5013 _imageMemoryBarrierCount: u32,
5014 _pImageMemoryBarriers: *const api::VkImageMemoryBarrier,
5019 #[allow(non_snake_case)]
5020 pub unsafe extern "system" fn vkCmdBeginQuery(
5021 _commandBuffer: api::VkCommandBuffer,
5022 _queryPool: api::VkQueryPool,
5024 _flags: api::VkQueryControlFlags,
5029 #[allow(non_snake_case)]
5030 pub unsafe extern "system" fn vkCmdEndQuery(
5031 _commandBuffer: api::VkCommandBuffer,
5032 _queryPool: api::VkQueryPool,
5038 #[allow(non_snake_case)]
5039 pub unsafe extern "system" fn vkCmdResetQueryPool(
5040 _commandBuffer: api::VkCommandBuffer,
5041 _queryPool: api::VkQueryPool,
5048 #[allow(non_snake_case)]
5049 pub unsafe extern "system" fn vkCmdWriteTimestamp(
5050 _commandBuffer: api::VkCommandBuffer,
5051 _pipelineStage: api::VkPipelineStageFlagBits,
5052 _queryPool: api::VkQueryPool,
5058 #[allow(non_snake_case)]
5059 pub unsafe extern "system" fn vkCmdCopyQueryPoolResults(
5060 _commandBuffer: api::VkCommandBuffer,
5061 _queryPool: api::VkQueryPool,
5064 _dstBuffer: api::VkBuffer,
5065 _dstOffset: api::VkDeviceSize,
5066 _stride: api::VkDeviceSize,
5067 _flags: api::VkQueryResultFlags,
5072 #[allow(non_snake_case)]
5073 pub unsafe extern "system" fn vkCmdPushConstants(
5074 _commandBuffer: api::VkCommandBuffer,
5075 _layout: api::VkPipelineLayout,
5076 _stageFlags: api::VkShaderStageFlags,
5079 _pValues: *const c_void,
5084 #[allow(non_snake_case)]
5085 pub unsafe extern "system" fn vkCmdBeginRenderPass(
5086 _commandBuffer: api::VkCommandBuffer,
5087 _pRenderPassBegin: *const api::VkRenderPassBeginInfo,
5088 _contents: api::VkSubpassContents,
5093 #[allow(non_snake_case)]
5094 pub unsafe extern "system" fn vkCmdNextSubpass(
5095 _commandBuffer: api::VkCommandBuffer,
5096 _contents: api::VkSubpassContents,
5101 #[allow(non_snake_case)]
5102 pub unsafe extern "system" fn vkCmdEndRenderPass(_commandBuffer: api::VkCommandBuffer) {
5106 #[allow(non_snake_case)]
5107 pub unsafe extern "system" fn vkCmdExecuteCommands(
5108 _commandBuffer: api::VkCommandBuffer,
5109 _commandBufferCount: u32,
5110 _pCommandBuffers: *const api::VkCommandBuffer,
5115 #[allow(non_snake_case)]
5116 pub unsafe extern "system" fn vkBindBufferMemory2(
5117 _device: api::VkDevice,
5118 bind_info_count: u32,
5119 bind_infos: *const api::VkBindBufferMemoryInfo,
5120 ) -> api::VkResult {
5121 assert_ne!(bind_info_count, 0);
5122 let bind_infos = slice::from_raw_parts(bind_infos, bind_info_count as usize);
5123 for bind_info in bind_infos {
5124 parse_next_chain_const!{
5126 root = api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO,
5127 device_group_info: api::VkBindBufferMemoryDeviceGroupInfo = api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO,
5129 if !device_group_info.is_null() {
5130 let device_group_info = &*device_group_info;
5131 if device_group_info.deviceIndexCount == 0 {
5133 assert_eq!(device_group_info.deviceIndexCount, 1);
5134 assert_eq!(*device_group_info.pDeviceIndices, 0);
5137 let bind_info = &*bind_info;
5138 let mut buffer = MutHandle::from(bind_info.buffer).unwrap();
5139 let device_memory = SharedHandle::from(bind_info.memory).unwrap();
5140 let device_memory_size = device_memory.size();
5141 assert!(bind_info.memoryOffset < device_memory_size as u64);
5142 let offset = bind_info.memoryOffset as usize;
5143 assert!(buffer.size.checked_add(offset).unwrap() <= device_memory_size);
5144 assert_eq!(offset % BUFFER_ALIGNMENT, 0);
5145 buffer.memory = Some(BufferMemory {
5153 #[allow(non_snake_case)]
5154 pub unsafe extern "system" fn vkBindImageMemory2(
5155 _device: api::VkDevice,
5156 bind_info_count: u32,
5157 bind_infos: *const api::VkBindImageMemoryInfo,
5158 ) -> api::VkResult {
5159 assert_ne!(bind_info_count, 0);
5160 let bind_infos = slice::from_raw_parts(bind_infos, bind_info_count as usize);
5161 for bind_info in bind_infos {
5162 parse_next_chain_const!{
5164 root = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
5165 device_group_info: api::VkBindImageMemoryDeviceGroupInfo = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO,
5166 swapchain_info: api::VkBindImageMemorySwapchainInfoKHR = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR,
5167 plane_info: api::VkBindImagePlaneMemoryInfo = api::VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO,
5169 if !device_group_info.is_null() {
5170 let device_group_info = &*device_group_info;
5171 if device_group_info.deviceIndexCount == 0 {
5173 assert_eq!(device_group_info.deviceIndexCount, 1);
5174 assert_eq!(*device_group_info.pDeviceIndices, 0);
5177 if !swapchain_info.is_null() {
5180 if !plane_info.is_null() {
5183 let bind_info = &*bind_info;
5184 let mut image = MutHandle::from(bind_info.image).unwrap();
5185 let device_memory = SharedHandle::from(bind_info.memory).unwrap();
5186 let device_memory_size = device_memory.size();
5187 let image_memory_layout = image.properties.computed_properties().memory_layout;
5188 assert!(bind_info.memoryOffset < device_memory_size as u64);
5189 let offset = bind_info.memoryOffset as usize;
5190 assert!(image_memory_layout.size.checked_add(offset).unwrap() <= device_memory_size);
5191 assert_eq!(offset % image_memory_layout.alignment, 0);
5192 image.memory = Some(ImageMemory {
5200 #[allow(non_snake_case)]
5201 pub unsafe extern "system" fn vkGetDeviceGroupPeerMemoryFeatures(
5202 _device: api::VkDevice,
5204 _localDeviceIndex: u32,
5205 _remoteDeviceIndex: u32,
5206 _pPeerMemoryFeatures: *mut api::VkPeerMemoryFeatureFlags,
5211 #[allow(non_snake_case)]
5212 pub unsafe extern "system" fn vkCmdSetDeviceMask(
5213 _commandBuffer: api::VkCommandBuffer,
5219 #[allow(non_snake_case)]
5220 pub unsafe extern "system" fn vkCmdDispatchBase(
5221 _commandBuffer: api::VkCommandBuffer,
5232 #[allow(non_snake_case)]
5233 pub unsafe extern "system" fn vkEnumeratePhysicalDeviceGroups(
5234 instance: api::VkInstance,
5235 physical_device_group_count: *mut u32,
5236 physical_device_group_properties: *mut api::VkPhysicalDeviceGroupProperties,
5237 ) -> api::VkResult {
5239 physical_device_group_count,
5240 physical_device_group_properties,
5242 |physical_device_group_properties, _| {
5243 parse_next_chain_mut!{
5244 physical_device_group_properties,
5245 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES,
5247 let mut physical_devices = [Handle::null(); api::VK_MAX_DEVICE_GROUP_SIZE as usize];
5248 physical_devices[0] = SharedHandle::from(instance)
5252 *physical_device_group_properties = api::VkPhysicalDeviceGroupProperties {
5253 sType: physical_device_group_properties.sType,
5254 pNext: physical_device_group_properties.pNext,
5255 physicalDeviceCount: 1,
5256 physicalDevices: physical_devices,
5257 subsetAllocation: api::VK_TRUE,
5263 #[allow(non_snake_case)]
5264 pub unsafe extern "system" fn vkGetImageMemoryRequirements2(
5265 _device: api::VkDevice,
5266 info: *const api::VkImageMemoryRequirementsInfo2,
5267 memory_requirements: *mut api::VkMemoryRequirements2,
5269 #![cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))]
5270 parse_next_chain_const!{
5272 root = api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2,
5273 image_plane_memory_requirements_info: api::VkImagePlaneMemoryRequirementsInfo = api::VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO,
5275 parse_next_chain_mut!{
5276 memory_requirements,
5277 root = api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
5278 dedicated_requirements: api::VkMemoryDedicatedRequirements = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS,
5280 if !image_plane_memory_requirements_info.is_null() {
5284 let image = SharedHandle::from(info.image).unwrap();
5285 let memory_requirements = &mut *memory_requirements;
5286 let layout = image.properties.computed_properties().memory_layout;
5287 memory_requirements.memoryRequirements = api::VkMemoryRequirements {
5288 size: layout.size as u64,
5289 alignment: layout.alignment as u64,
5290 memoryTypeBits: DeviceMemoryType::Main.to_bits(),
5291 ..mem::zeroed() // for padding fields
5293 if !dedicated_requirements.is_null() {
5294 let dedicated_requirements = &mut *dedicated_requirements;
5295 dedicated_requirements.prefersDedicatedAllocation = api::VK_FALSE;
5296 dedicated_requirements.requiresDedicatedAllocation = api::VK_FALSE;
5300 #[allow(non_snake_case)]
5301 pub unsafe extern "system" fn vkGetBufferMemoryRequirements2(
5302 _device: api::VkDevice,
5303 info: *const api::VkBufferMemoryRequirementsInfo2,
5304 memory_requirements: *mut api::VkMemoryRequirements2,
5306 #![cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))]
5307 parse_next_chain_const!{
5309 root = api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
5311 parse_next_chain_mut!{
5312 memory_requirements,
5313 root = api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
5314 dedicated_requirements: api::VkMemoryDedicatedRequirements = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS,
5316 let memory_requirements = &mut *memory_requirements;
5318 let buffer = SharedHandle::from(info.buffer).unwrap();
5319 let layout = DeviceMemoryLayout::calculate(buffer.size, BUFFER_ALIGNMENT);
5320 memory_requirements.memoryRequirements = api::VkMemoryRequirements {
5321 size: layout.size as u64,
5322 alignment: layout.alignment as u64,
5323 memoryTypeBits: DeviceMemoryType::Main.to_bits(),
5324 ..mem::zeroed() // for padding fields
5326 if !dedicated_requirements.is_null() {
5327 let dedicated_requirements = &mut *dedicated_requirements;
5328 dedicated_requirements.prefersDedicatedAllocation = api::VK_FALSE;
5329 dedicated_requirements.requiresDedicatedAllocation = api::VK_FALSE;
5333 #[allow(non_snake_case)]
5334 pub unsafe extern "system" fn vkGetImageSparseMemoryRequirements2(
5335 _device: api::VkDevice,
5336 _pInfo: *const api::VkImageSparseMemoryRequirementsInfo2,
5337 _pSparseMemoryRequirementCount: *mut u32,
5338 _pSparseMemoryRequirements: *mut api::VkSparseImageMemoryRequirements2,
5343 #[allow(non_snake_case)]
5344 pub unsafe extern "system" fn vkGetPhysicalDeviceFeatures2(
5345 physical_device: api::VkPhysicalDevice,
5346 features: *mut api::VkPhysicalDeviceFeatures2,
5348 parse_next_chain_mut!{
5350 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
5351 sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
5352 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
5353 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
5354 physical_device_shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
5355 physical_device_protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
5356 physical_device_multiview_features: api::VkPhysicalDeviceMultiviewFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
5358 let physical_device = SharedHandle::from(physical_device).unwrap();
5359 physical_device.features.export_feature_set(&mut *features);
5360 if !sampler_ycbcr_conversion_features.is_null() {
5363 .export_feature_set(&mut *sampler_ycbcr_conversion_features);
5365 if !physical_device_16bit_storage_features.is_null() {
5368 .export_feature_set(&mut *physical_device_16bit_storage_features);
5370 if !variable_pointer_features.is_null() {
5373 .export_feature_set(&mut *variable_pointer_features);
5375 if !physical_device_shader_draw_parameter_features.is_null() {
5378 .export_feature_set(&mut *physical_device_shader_draw_parameter_features);
5380 if !physical_device_protected_memory_features.is_null() {
5383 .export_feature_set(&mut *physical_device_protected_memory_features);
5385 if !physical_device_multiview_features.is_null() {
5388 .export_feature_set(&mut *physical_device_multiview_features);
5392 #[allow(non_snake_case)]
5393 pub unsafe extern "system" fn vkGetPhysicalDeviceProperties2(
5394 physical_device: api::VkPhysicalDevice,
5395 properties: *mut api::VkPhysicalDeviceProperties2,
5397 parse_next_chain_mut!{
5399 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
5400 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES,
5401 multiview_properties: api::VkPhysicalDeviceMultiviewProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES,
5402 id_properties: api::VkPhysicalDeviceIDProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES,
5403 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES,
5404 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES,
5405 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES,
5407 let properties = &mut *properties;
5408 let physical_device = SharedHandle::from(physical_device).unwrap();
5409 properties.properties = physical_device.properties;
5410 if !point_clipping_properties.is_null() {
5411 let point_clipping_properties = &mut *point_clipping_properties;
5412 *point_clipping_properties = api::VkPhysicalDevicePointClippingProperties {
5413 sType: point_clipping_properties.sType,
5414 pNext: point_clipping_properties.pNext,
5415 ..physical_device.point_clipping_properties
5418 if !multiview_properties.is_null() {
5419 let multiview_properties = &mut *multiview_properties;
5420 *multiview_properties = api::VkPhysicalDeviceMultiviewProperties {
5421 sType: multiview_properties.sType,
5422 pNext: multiview_properties.pNext,
5423 ..physical_device.multiview_properties
5426 if !id_properties.is_null() {
5427 let id_properties = &mut *id_properties;
5428 *id_properties = api::VkPhysicalDeviceIDProperties {
5429 sType: id_properties.sType,
5430 pNext: id_properties.pNext,
5431 ..physical_device.id_properties
5434 if !maintenance_3_properties.is_null() {
5435 let maintenance_3_properties = &mut *maintenance_3_properties;
5436 *maintenance_3_properties = api::VkPhysicalDeviceMaintenance3Properties {
5437 sType: maintenance_3_properties.sType,
5438 pNext: maintenance_3_properties.pNext,
5439 ..physical_device.maintenance_3_properties
5442 if !protected_memory_properties.is_null() {
5443 let protected_memory_properties = &mut *protected_memory_properties;
5444 *protected_memory_properties = api::VkPhysicalDeviceProtectedMemoryProperties {
5445 sType: protected_memory_properties.sType,
5446 pNext: protected_memory_properties.pNext,
5447 ..physical_device.protected_memory_properties
5450 if !subgroup_properties.is_null() {
5451 let subgroup_properties = &mut *subgroup_properties;
5452 *subgroup_properties = api::VkPhysicalDeviceSubgroupProperties {
5453 sType: subgroup_properties.sType,
5454 pNext: subgroup_properties.pNext,
5455 ..physical_device.subgroup_properties
5460 #[allow(non_snake_case)]
5461 pub unsafe extern "system" fn vkGetPhysicalDeviceFormatProperties2(
5462 _physical_device: api::VkPhysicalDevice,
5463 format: api::VkFormat,
5464 format_properties: *mut api::VkFormatProperties2,
5466 parse_next_chain_mut!{
5468 root = api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
5470 let format_properties = &mut *format_properties;
5471 format_properties.formatProperties = PhysicalDevice::get_format_properties(format);
5474 #[allow(non_snake_case)]
5475 pub unsafe extern "system" fn vkGetPhysicalDeviceImageFormatProperties2(
5476 _physicalDevice: api::VkPhysicalDevice,
5477 _pImageFormatInfo: *const api::VkPhysicalDeviceImageFormatInfo2,
5478 _pImageFormatProperties: *mut api::VkImageFormatProperties2,
5479 ) -> api::VkResult {
5483 #[allow(non_snake_case)]
5484 pub unsafe extern "system" fn vkGetPhysicalDeviceQueueFamilyProperties2(
5485 physical_device: api::VkPhysicalDevice,
5486 queue_family_property_count: *mut u32,
5487 queue_family_properties: *mut api::VkQueueFamilyProperties2,
5490 queue_family_property_count,
5491 queue_family_properties,
5492 QUEUE_COUNTS.iter(),
5493 |queue_family_properties, &count| {
5494 get_physical_device_queue_family_properties(
5495 &SharedHandle::from(physical_device).unwrap(),
5496 queue_family_properties,
5503 #[allow(non_snake_case)]
5504 pub unsafe extern "system" fn vkGetPhysicalDeviceMemoryProperties2(
5505 physical_device: api::VkPhysicalDevice,
5506 memory_properties: *mut api::VkPhysicalDeviceMemoryProperties2,
5508 #![cfg_attr(feature = "cargo-clippy", allow(clippy::needless_update))]
5509 let physical_device = SharedHandle::from(physical_device).unwrap();
5510 parse_next_chain_mut!{
5512 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2,
5514 let memory_properties = &mut *memory_properties;
5515 let mut properties: api::VkPhysicalDeviceMemoryProperties = mem::zeroed();
5516 properties.memoryTypeCount = DeviceMemoryTypes::default().len() as u32;
5517 for (memory_type, _) in DeviceMemoryTypes::default().iter() {
5518 properties.memoryTypes[memory_type as usize] = api::VkMemoryType {
5519 propertyFlags: memory_type.flags(),
5520 heapIndex: memory_type.heap() as u32,
5523 properties.memoryHeapCount = DeviceMemoryHeaps::default().len() as u32;
5524 for (memory_heap, _) in DeviceMemoryHeaps::default().iter() {
5525 properties.memoryHeaps[memory_heap as usize] = api::VkMemoryHeap {
5526 size: match memory_heap {
5527 DeviceMemoryHeap::Main => physical_device.system_memory_size * 7 / 8,
5529 flags: memory_heap.flags(),
5530 ..mem::zeroed() // for padding fields
5533 memory_properties.memoryProperties = properties;
5536 #[allow(non_snake_case)]
5537 pub unsafe extern "system" fn vkGetPhysicalDeviceSparseImageFormatProperties2(
5538 _physicalDevice: api::VkPhysicalDevice,
5539 _pFormatInfo: *const api::VkPhysicalDeviceSparseImageFormatInfo2,
5540 _pPropertyCount: *mut u32,
5541 _pProperties: *mut api::VkSparseImageFormatProperties2,
5546 #[allow(non_snake_case)]
5547 pub unsafe extern "system" fn vkTrimCommandPool(
5548 _device: api::VkDevice,
5549 _commandPool: api::VkCommandPool,
5550 _flags: api::VkCommandPoolTrimFlags,
5555 #[allow(non_snake_case)]
5556 pub unsafe extern "system" fn vkGetDeviceQueue2(
5557 device: api::VkDevice,
5558 queue_info: *const api::VkDeviceQueueInfo2,
5559 queue: *mut api::VkQueue,
5561 parse_next_chain_const!{
5563 root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2,
5565 let queue_info = &*queue_info;
5566 assert_eq!(queue_info.flags, 0);
5567 let device = SharedHandle::from(device).unwrap();
5568 *queue = device.queues[queue_info.queueFamilyIndex as usize][queue_info.queueIndex as usize]
5572 #[allow(non_snake_case)]
5573 pub unsafe extern "system" fn vkCreateSamplerYcbcrConversion(
5574 _device: api::VkDevice,
5575 _pCreateInfo: *const api::VkSamplerYcbcrConversionCreateInfo,
5576 _pAllocator: *const api::VkAllocationCallbacks,
5577 _pYcbcrConversion: *mut api::VkSamplerYcbcrConversion,
5578 ) -> api::VkResult {
5582 #[allow(non_snake_case)]
5583 pub unsafe extern "system" fn vkDestroySamplerYcbcrConversion(
5584 _device: api::VkDevice,
5585 _ycbcrConversion: api::VkSamplerYcbcrConversion,
5586 _pAllocator: *const api::VkAllocationCallbacks,
5591 #[allow(non_snake_case)]
5592 pub unsafe extern "system" fn vkCreateDescriptorUpdateTemplate(
5593 _device: api::VkDevice,
5594 _pCreateInfo: *const api::VkDescriptorUpdateTemplateCreateInfo,
5595 _pAllocator: *const api::VkAllocationCallbacks,
5596 _pDescriptorUpdateTemplate: *mut api::VkDescriptorUpdateTemplate,
5597 ) -> api::VkResult {
5601 #[allow(non_snake_case)]
5602 pub unsafe extern "system" fn vkDestroyDescriptorUpdateTemplate(
5603 _device: api::VkDevice,
5604 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5605 _pAllocator: *const api::VkAllocationCallbacks,
5610 #[allow(non_snake_case)]
5611 pub unsafe extern "system" fn vkUpdateDescriptorSetWithTemplate(
5612 _device: api::VkDevice,
5613 _descriptorSet: api::VkDescriptorSet,
5614 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5615 _pData: *const c_void,
5620 #[allow(non_snake_case)]
5621 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalBufferProperties(
5622 _physicalDevice: api::VkPhysicalDevice,
5623 _pExternalBufferInfo: *const api::VkPhysicalDeviceExternalBufferInfo,
5624 _pExternalBufferProperties: *mut api::VkExternalBufferProperties,
5629 #[allow(non_snake_case)]
5630 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalFenceProperties(
5631 _physicalDevice: api::VkPhysicalDevice,
5632 _pExternalFenceInfo: *const api::VkPhysicalDeviceExternalFenceInfo,
5633 _pExternalFenceProperties: *mut api::VkExternalFenceProperties,
5638 #[allow(non_snake_case)]
5639 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalSemaphoreProperties(
5640 _physicalDevice: api::VkPhysicalDevice,
5641 _pExternalSemaphoreInfo: *const api::VkPhysicalDeviceExternalSemaphoreInfo,
5642 _pExternalSemaphoreProperties: *mut api::VkExternalSemaphoreProperties,
5647 #[allow(non_snake_case)]
5648 pub unsafe extern "system" fn vkGetDescriptorSetLayoutSupport(
5649 _device: api::VkDevice,
5650 _pCreateInfo: *const api::VkDescriptorSetLayoutCreateInfo,
5651 _pSupport: *mut api::VkDescriptorSetLayoutSupport,
5656 #[allow(non_snake_case)]
5657 pub unsafe extern "system" fn vkDestroySurfaceKHR(
5658 _instance: api::VkInstance,
5659 surface: api::VkSurfaceKHR,
5660 _allocator: *const api::VkAllocationCallbacks,
5662 if let Some(surface) = SharedHandle::from(surface) {
5663 let surface_implementation = SurfacePlatform::from(surface.platform)
5665 .get_surface_implementation();
5666 surface_implementation.destroy_surface(surface.into_nonnull());
5670 #[allow(non_snake_case)]
5671 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceSupportKHR(
5672 _physicalDevice: api::VkPhysicalDevice,
5673 _queueFamilyIndex: u32,
5674 _surface: api::VkSurfaceKHR,
5675 _pSupported: *mut api::VkBool32,
5676 ) -> api::VkResult {
5680 #[allow(non_snake_case)]
5681 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
5682 physical_device: api::VkPhysicalDevice,
5683 surface: api::VkSurfaceKHR,
5684 surface_capabilities: *mut api::VkSurfaceCapabilitiesKHR,
5685 ) -> api::VkResult {
5686 let mut surface_capabilities_2 = api::VkSurfaceCapabilities2KHR {
5687 sType: api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
5689 surfaceCapabilities: mem::zeroed(),
5691 match vkGetPhysicalDeviceSurfaceCapabilities2KHR(
5693 &api::VkPhysicalDeviceSurfaceInfo2KHR {
5694 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR,
5698 &mut surface_capabilities_2,
5700 api::VK_SUCCESS => {
5701 *surface_capabilities = surface_capabilities_2.surfaceCapabilities;
5708 #[allow(non_snake_case)]
5709 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceFormatsKHR(
5710 _physical_device: api::VkPhysicalDevice,
5711 surface: api::VkSurfaceKHR,
5712 surface_format_count: *mut u32,
5713 surface_formats: *mut api::VkSurfaceFormatKHR,
5714 ) -> api::VkResult {
5715 let surface_implementation =
5716 SurfacePlatform::from(SharedHandle::from(surface).unwrap().platform)
5718 .get_surface_implementation();
5719 let returned_surface_formats = match surface_implementation.get_surface_formats(surface) {
5720 Ok(returned_surface_formats) => returned_surface_formats,
5721 Err(result) => return result,
5724 surface_format_count,
5726 returned_surface_formats.iter(),
5731 #[allow(non_snake_case)]
5732 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfacePresentModesKHR(
5733 _physical_device: api::VkPhysicalDevice,
5734 surface: api::VkSurfaceKHR,
5735 present_mode_count: *mut u32,
5736 present_modes: *mut api::VkPresentModeKHR,
5737 ) -> api::VkResult {
5738 let surface_implementation =
5739 SurfacePlatform::from(SharedHandle::from(surface).unwrap().platform)
5741 .get_surface_implementation();
5742 let returned_present_modes = match surface_implementation.get_present_modes(surface) {
5743 Ok(returned_present_modes) => returned_present_modes,
5744 Err(result) => return result,
5749 returned_present_modes.iter(),
5754 #[allow(non_snake_case)]
5755 pub unsafe extern "system" fn vkCreateSwapchainKHR(
5756 _device: api::VkDevice,
5757 create_info: *const api::VkSwapchainCreateInfoKHR,
5758 _allocator: *const api::VkAllocationCallbacks,
5759 swapchain: *mut api::VkSwapchainKHR,
5760 ) -> api::VkResult {
5761 parse_next_chain_const!{
5763 root = api::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
5764 device_group_swapchain_create_info: api::VkDeviceGroupSwapchainCreateInfoKHR = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR,
5766 let create_info = &*create_info;
5767 let device_group_swapchain_create_info = if device_group_swapchain_create_info.is_null() {
5770 Some(&*device_group_swapchain_create_info)
5772 *swapchain = Handle::null();
5774 SurfacePlatform::from(SharedHandle::from(create_info.surface).unwrap().platform).unwrap();
5776 .get_surface_implementation()
5777 .build(create_info, device_group_swapchain_create_info)
5779 Ok(new_swapchain) => {
5780 *swapchain = OwnedHandle::<api::VkSwapchainKHR>::new(new_swapchain).take();
5783 Err(error) => error,
5787 #[allow(non_snake_case)]
5788 pub unsafe extern "system" fn vkDestroySwapchainKHR(
5789 _device: api::VkDevice,
5790 swapchain: api::VkSwapchainKHR,
5791 _allocator: *const api::VkAllocationCallbacks,
5793 OwnedHandle::from(swapchain);
5796 #[allow(non_snake_case)]
5797 pub unsafe extern "system" fn vkGetSwapchainImagesKHR(
5798 _device: api::VkDevice,
5799 _swapchain: api::VkSwapchainKHR,
5800 _pSwapchainImageCount: *mut u32,
5801 _pSwapchainImages: *mut api::VkImage,
5802 ) -> api::VkResult {
5806 #[allow(non_snake_case)]
5807 pub unsafe extern "system" fn vkAcquireNextImageKHR(
5808 _device: api::VkDevice,
5809 _swapchain: api::VkSwapchainKHR,
5811 _semaphore: api::VkSemaphore,
5812 _fence: api::VkFence,
5813 _pImageIndex: *mut u32,
5814 ) -> api::VkResult {
5818 #[allow(non_snake_case)]
5819 pub unsafe extern "system" fn vkQueuePresentKHR(
5820 _queue: api::VkQueue,
5821 _pPresentInfo: *const api::VkPresentInfoKHR,
5822 ) -> api::VkResult {
5826 #[allow(non_snake_case)]
5827 pub unsafe extern "system" fn vkGetDeviceGroupPresentCapabilitiesKHR(
5828 _device: api::VkDevice,
5829 _pDeviceGroupPresentCapabilities: *mut api::VkDeviceGroupPresentCapabilitiesKHR,
5830 ) -> api::VkResult {
5834 #[allow(non_snake_case)]
5835 pub unsafe extern "system" fn vkGetDeviceGroupSurfacePresentModesKHR(
5836 _device: api::VkDevice,
5837 _surface: api::VkSurfaceKHR,
5838 _pModes: *mut api::VkDeviceGroupPresentModeFlagsKHR,
5839 ) -> api::VkResult {
5843 #[allow(non_snake_case)]
5844 pub unsafe extern "system" fn vkGetPhysicalDevicePresentRectanglesKHR(
5845 _physicalDevice: api::VkPhysicalDevice,
5846 _surface: api::VkSurfaceKHR,
5847 _pRectCount: *mut u32,
5848 _pRects: *mut api::VkRect2D,
5849 ) -> api::VkResult {
5853 #[allow(non_snake_case)]
5854 pub unsafe extern "system" fn vkAcquireNextImage2KHR(
5855 _device: api::VkDevice,
5856 _pAcquireInfo: *const api::VkAcquireNextImageInfoKHR,
5857 _pImageIndex: *mut u32,
5858 ) -> api::VkResult {
5862 #[allow(non_snake_case)]
5863 #[cfg(kazan_include_unused_vulkan_api)]
5864 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPropertiesKHR(
5865 _physicalDevice: api::VkPhysicalDevice,
5866 _pPropertyCount: *mut u32,
5867 _pProperties: *mut api::VkDisplayPropertiesKHR,
5868 ) -> api::VkResult {
5872 #[allow(non_snake_case)]
5873 #[cfg(kazan_include_unused_vulkan_api)]
5874 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
5875 _physicalDevice: api::VkPhysicalDevice,
5876 _pPropertyCount: *mut u32,
5877 _pProperties: *mut api::VkDisplayPlanePropertiesKHR,
5878 ) -> api::VkResult {
5882 #[allow(non_snake_case)]
5883 #[cfg(kazan_include_unused_vulkan_api)]
5884 pub unsafe extern "system" fn vkGetDisplayPlaneSupportedDisplaysKHR(
5885 _physicalDevice: api::VkPhysicalDevice,
5887 _pDisplayCount: *mut u32,
5888 _pDisplays: *mut api::VkDisplayKHR,
5889 ) -> api::VkResult {
5893 #[allow(non_snake_case)]
5894 #[cfg(kazan_include_unused_vulkan_api)]
5895 pub unsafe extern "system" fn vkGetDisplayModePropertiesKHR(
5896 _physicalDevice: api::VkPhysicalDevice,
5897 _display: api::VkDisplayKHR,
5898 _pPropertyCount: *mut u32,
5899 _pProperties: *mut api::VkDisplayModePropertiesKHR,
5900 ) -> api::VkResult {
5904 #[allow(non_snake_case)]
5905 #[cfg(kazan_include_unused_vulkan_api)]
5906 pub unsafe extern "system" fn vkCreateDisplayModeKHR(
5907 _physicalDevice: api::VkPhysicalDevice,
5908 _display: api::VkDisplayKHR,
5909 _pCreateInfo: *const api::VkDisplayModeCreateInfoKHR,
5910 _pAllocator: *const api::VkAllocationCallbacks,
5911 _pMode: *mut api::VkDisplayModeKHR,
5912 ) -> api::VkResult {
5916 #[allow(non_snake_case)]
5917 #[cfg(kazan_include_unused_vulkan_api)]
5918 pub unsafe extern "system" fn vkGetDisplayPlaneCapabilitiesKHR(
5919 _physicalDevice: api::VkPhysicalDevice,
5920 _mode: api::VkDisplayModeKHR,
5922 _pCapabilities: *mut api::VkDisplayPlaneCapabilitiesKHR,
5923 ) -> api::VkResult {
5927 #[allow(non_snake_case)]
5928 #[cfg(kazan_include_unused_vulkan_api)]
5929 pub unsafe extern "system" fn vkCreateDisplayPlaneSurfaceKHR(
5930 _instance: api::VkInstance,
5931 _pCreateInfo: *const api::VkDisplaySurfaceCreateInfoKHR,
5932 _pAllocator: *const api::VkAllocationCallbacks,
5933 _pSurface: *mut api::VkSurfaceKHR,
5934 ) -> api::VkResult {
5938 #[allow(non_snake_case)]
5939 #[cfg(kazan_include_unused_vulkan_api)]
5940 pub unsafe extern "system" fn vkCreateSharedSwapchainsKHR(
5941 _device: api::VkDevice,
5942 _swapchainCount: u32,
5943 _pCreateInfos: *const api::VkSwapchainCreateInfoKHR,
5944 _pAllocator: *const api::VkAllocationCallbacks,
5945 _pSwapchains: *mut api::VkSwapchainKHR,
5946 ) -> api::VkResult {
5950 #[allow(non_snake_case)]
5951 #[cfg(kazan_include_unused_vulkan_api)]
5952 pub unsafe extern "system" fn vkGetMemoryFdKHR(
5953 _device: api::VkDevice,
5954 _pGetFdInfo: *const api::VkMemoryGetFdInfoKHR,
5956 ) -> api::VkResult {
5960 #[allow(non_snake_case)]
5961 #[cfg(kazan_include_unused_vulkan_api)]
5962 pub unsafe extern "system" fn vkGetMemoryFdPropertiesKHR(
5963 _device: api::VkDevice,
5964 _handleType: api::VkExternalMemoryHandleTypeFlagBits,
5966 _pMemoryFdProperties: *mut api::VkMemoryFdPropertiesKHR,
5967 ) -> api::VkResult {
5971 #[allow(non_snake_case)]
5972 #[cfg(kazan_include_unused_vulkan_api)]
5973 pub unsafe extern "system" fn vkImportSemaphoreFdKHR(
5974 _device: api::VkDevice,
5975 _pImportSemaphoreFdInfo: *const api::VkImportSemaphoreFdInfoKHR,
5976 ) -> api::VkResult {
5980 #[allow(non_snake_case)]
5981 #[cfg(kazan_include_unused_vulkan_api)]
5982 pub unsafe extern "system" fn vkGetSemaphoreFdKHR(
5983 _device: api::VkDevice,
5984 _pGetFdInfo: *const api::VkSemaphoreGetFdInfoKHR,
5986 ) -> api::VkResult {
5990 #[allow(non_snake_case)]
5991 #[cfg(kazan_include_unused_vulkan_api)]
5992 pub unsafe extern "system" fn vkCmdPushDescriptorSetKHR(
5993 _commandBuffer: api::VkCommandBuffer,
5994 _pipelineBindPoint: api::VkPipelineBindPoint,
5995 _layout: api::VkPipelineLayout,
5997 _descriptorWriteCount: u32,
5998 _pDescriptorWrites: *const api::VkWriteDescriptorSet,
6003 #[allow(non_snake_case)]
6004 #[cfg(kazan_include_unused_vulkan_api)]
6005 pub unsafe extern "system" fn vkCmdPushDescriptorSetWithTemplateKHR(
6006 _commandBuffer: api::VkCommandBuffer,
6007 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
6008 _layout: api::VkPipelineLayout,
6010 _pData: *const c_void,
6015 #[allow(non_snake_case)]
6016 #[cfg(kazan_include_unused_vulkan_api)]
6017 pub unsafe extern "system" fn vkCreateRenderPass2KHR(
6018 _device: api::VkDevice,
6019 _pCreateInfo: *const api::VkRenderPassCreateInfo2KHR,
6020 _pAllocator: *const api::VkAllocationCallbacks,
6021 _pRenderPass: *mut api::VkRenderPass,
6022 ) -> api::VkResult {
6026 #[allow(non_snake_case)]
6027 #[cfg(kazan_include_unused_vulkan_api)]
6028 pub unsafe extern "system" fn vkCmdBeginRenderPass2KHR(
6029 _commandBuffer: api::VkCommandBuffer,
6030 _pRenderPassBegin: *const api::VkRenderPassBeginInfo,
6031 _pSubpassBeginInfo: *const api::VkSubpassBeginInfoKHR,
6036 #[allow(non_snake_case)]
6037 #[cfg(kazan_include_unused_vulkan_api)]
6038 pub unsafe extern "system" fn vkCmdNextSubpass2KHR(
6039 _commandBuffer: api::VkCommandBuffer,
6040 _pSubpassBeginInfo: *const api::VkSubpassBeginInfoKHR,
6041 _pSubpassEndInfo: *const api::VkSubpassEndInfoKHR,
6046 #[allow(non_snake_case)]
6047 #[cfg(kazan_include_unused_vulkan_api)]
6048 pub unsafe extern "system" fn vkCmdEndRenderPass2KHR(
6049 _commandBuffer: api::VkCommandBuffer,
6050 _pSubpassEndInfo: *const api::VkSubpassEndInfoKHR,
6055 #[allow(non_snake_case)]
6056 #[cfg(kazan_include_unused_vulkan_api)]
6057 pub unsafe extern "system" fn vkGetSwapchainStatusKHR(
6058 _device: api::VkDevice,
6059 _swapchain: api::VkSwapchainKHR,
6060 ) -> api::VkResult {
6064 #[allow(non_snake_case)]
6065 #[cfg(kazan_include_unused_vulkan_api)]
6066 pub unsafe extern "system" fn vkImportFenceFdKHR(
6067 _device: api::VkDevice,
6068 _pImportFenceFdInfo: *const api::VkImportFenceFdInfoKHR,
6069 ) -> api::VkResult {
6073 #[allow(non_snake_case)]
6074 #[cfg(kazan_include_unused_vulkan_api)]
6075 pub unsafe extern "system" fn vkGetFenceFdKHR(
6076 _device: api::VkDevice,
6077 _pGetFdInfo: *const api::VkFenceGetFdInfoKHR,
6079 ) -> api::VkResult {
6083 #[allow(non_snake_case)]
6084 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilities2KHR(
6085 _physical_device: api::VkPhysicalDevice,
6086 surface_info: *const api::VkPhysicalDeviceSurfaceInfo2KHR,
6087 surface_capabilities: *mut api::VkSurfaceCapabilities2KHR,
6088 ) -> api::VkResult {
6089 parse_next_chain_const!{
6091 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR,
6093 let surface_info = &*surface_info;
6094 parse_next_chain_mut!{
6095 surface_capabilities,
6096 root = api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
6098 let surface_capabilities = &mut *surface_capabilities;
6099 let surface_implementation =
6100 SurfacePlatform::from(SharedHandle::from(surface_info.surface).unwrap().platform)
6102 .get_surface_implementation();
6103 match surface_implementation.get_capabilities(surface_info.surface) {
6104 Ok(capabilities) => {
6105 surface_capabilities.surfaceCapabilities = capabilities;
6108 Err(result) => result,
6112 #[allow(non_snake_case)]
6113 #[cfg(kazan_include_unused_vulkan_api)]
6114 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceFormats2KHR(
6115 _physicalDevice: api::VkPhysicalDevice,
6116 _pSurfaceInfo: *const api::VkPhysicalDeviceSurfaceInfo2KHR,
6117 _pSurfaceFormatCount: *mut u32,
6118 _pSurfaceFormats: *mut api::VkSurfaceFormat2KHR,
6119 ) -> api::VkResult {
6123 #[allow(non_snake_case)]
6124 #[cfg(kazan_include_unused_vulkan_api)]
6125 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayProperties2KHR(
6126 _physicalDevice: api::VkPhysicalDevice,
6127 _pPropertyCount: *mut u32,
6128 _pProperties: *mut api::VkDisplayProperties2KHR,
6129 ) -> api::VkResult {
6133 #[allow(non_snake_case)]
6134 #[cfg(kazan_include_unused_vulkan_api)]
6135 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPlaneProperties2KHR(
6136 _physicalDevice: api::VkPhysicalDevice,
6137 _pPropertyCount: *mut u32,
6138 _pProperties: *mut api::VkDisplayPlaneProperties2KHR,
6139 ) -> api::VkResult {
6143 #[allow(non_snake_case)]
6144 #[cfg(kazan_include_unused_vulkan_api)]
6145 pub unsafe extern "system" fn vkGetDisplayModeProperties2KHR(
6146 _physicalDevice: api::VkPhysicalDevice,
6147 _display: api::VkDisplayKHR,
6148 _pPropertyCount: *mut u32,
6149 _pProperties: *mut api::VkDisplayModeProperties2KHR,
6150 ) -> api::VkResult {
6154 #[allow(non_snake_case)]
6155 #[cfg(kazan_include_unused_vulkan_api)]
6156 pub unsafe extern "system" fn vkGetDisplayPlaneCapabilities2KHR(
6157 _physicalDevice: api::VkPhysicalDevice,
6158 _pDisplayPlaneInfo: *const api::VkDisplayPlaneInfo2KHR,
6159 _pCapabilities: *mut api::VkDisplayPlaneCapabilities2KHR,
6160 ) -> api::VkResult {
6164 #[allow(non_snake_case)]
6165 #[cfg(kazan_include_unused_vulkan_api)]
6166 pub unsafe extern "system" fn vkCmdDrawIndirectCountKHR(
6167 _commandBuffer: api::VkCommandBuffer,
6168 _buffer: api::VkBuffer,
6169 _offset: api::VkDeviceSize,
6170 _countBuffer: api::VkBuffer,
6171 _countBufferOffset: api::VkDeviceSize,
6178 #[allow(non_snake_case)]
6179 #[cfg(kazan_include_unused_vulkan_api)]
6180 pub unsafe extern "system" fn vkCmdDrawIndexedIndirectCountKHR(
6181 _commandBuffer: api::VkCommandBuffer,
6182 _buffer: api::VkBuffer,
6183 _offset: api::VkDeviceSize,
6184 _countBuffer: api::VkBuffer,
6185 _countBufferOffset: api::VkDeviceSize,
6192 #[allow(non_snake_case)]
6193 #[cfg(kazan_include_unused_vulkan_api)]
6194 pub unsafe extern "system" fn vkCreateDebugReportCallbackEXT(
6195 _instance: api::VkInstance,
6196 _pCreateInfo: *const api::VkDebugReportCallbackCreateInfoEXT,
6197 _pAllocator: *const api::VkAllocationCallbacks,
6198 _pCallback: *mut api::VkDebugReportCallbackEXT,
6199 ) -> api::VkResult {
6203 #[allow(non_snake_case)]
6204 #[cfg(kazan_include_unused_vulkan_api)]
6205 pub unsafe extern "system" fn vkDestroyDebugReportCallbackEXT(
6206 _instance: api::VkInstance,
6207 _callback: api::VkDebugReportCallbackEXT,
6208 _pAllocator: *const api::VkAllocationCallbacks,
6213 #[allow(non_snake_case)]
6214 #[cfg(kazan_include_unused_vulkan_api)]
6215 pub unsafe extern "system" fn vkDebugReportMessageEXT(
6216 _instance: api::VkInstance,
6217 _flags: api::VkDebugReportFlagsEXT,
6218 _objectType: api::VkDebugReportObjectTypeEXT,
6222 _pLayerPrefix: *const c_char,
6223 _pMessage: *const c_char,
6228 #[allow(non_snake_case)]
6229 #[cfg(kazan_include_unused_vulkan_api)]
6230 pub unsafe extern "system" fn vkDebugMarkerSetObjectTagEXT(
6231 _device: api::VkDevice,
6232 _pTagInfo: *const api::VkDebugMarkerObjectTagInfoEXT,
6233 ) -> api::VkResult {
6237 #[allow(non_snake_case)]
6238 #[cfg(kazan_include_unused_vulkan_api)]
6239 pub unsafe extern "system" fn vkDebugMarkerSetObjectNameEXT(
6240 _device: api::VkDevice,
6241 _pNameInfo: *const api::VkDebugMarkerObjectNameInfoEXT,
6242 ) -> api::VkResult {
6246 #[allow(non_snake_case)]
6247 #[cfg(kazan_include_unused_vulkan_api)]
6248 pub unsafe extern "system" fn vkCmdDebugMarkerBeginEXT(
6249 _commandBuffer: api::VkCommandBuffer,
6250 _pMarkerInfo: *const api::VkDebugMarkerMarkerInfoEXT,
6255 #[allow(non_snake_case)]
6256 #[cfg(kazan_include_unused_vulkan_api)]
6257 pub unsafe extern "system" fn vkCmdDebugMarkerEndEXT(_commandBuffer: api::VkCommandBuffer) {
6261 #[allow(non_snake_case)]
6262 #[cfg(kazan_include_unused_vulkan_api)]
6263 pub unsafe extern "system" fn vkCmdDebugMarkerInsertEXT(
6264 _commandBuffer: api::VkCommandBuffer,
6265 _pMarkerInfo: *const api::VkDebugMarkerMarkerInfoEXT,
6270 #[allow(non_snake_case)]
6271 #[cfg(kazan_include_unused_vulkan_api)]
6272 pub unsafe extern "system" fn vkCmdDrawIndirectCountAMD(
6273 _commandBuffer: api::VkCommandBuffer,
6274 _buffer: api::VkBuffer,
6275 _offset: api::VkDeviceSize,
6276 _countBuffer: api::VkBuffer,
6277 _countBufferOffset: api::VkDeviceSize,
6284 #[allow(non_snake_case)]
6285 #[cfg(kazan_include_unused_vulkan_api)]
6286 pub unsafe extern "system" fn vkCmdDrawIndexedIndirectCountAMD(
6287 _commandBuffer: api::VkCommandBuffer,
6288 _buffer: api::VkBuffer,
6289 _offset: api::VkDeviceSize,
6290 _countBuffer: api::VkBuffer,
6291 _countBufferOffset: api::VkDeviceSize,
6298 #[allow(non_snake_case)]
6299 #[cfg(kazan_include_unused_vulkan_api)]
6300 pub unsafe extern "system" fn vkGetShaderInfoAMD(
6301 _device: api::VkDevice,
6302 _pipeline: api::VkPipeline,
6303 _shaderStage: api::VkShaderStageFlagBits,
6304 _infoType: api::VkShaderInfoTypeAMD,
6305 _pInfoSize: *mut usize,
6306 _pInfo: *mut c_void,
6307 ) -> api::VkResult {
6311 #[allow(non_snake_case)]
6312 #[cfg(kazan_include_unused_vulkan_api)]
6313 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
6314 _physicalDevice: api::VkPhysicalDevice,
6315 _format: api::VkFormat,
6316 _type_: api::VkImageType,
6317 _tiling: api::VkImageTiling,
6318 _usage: api::VkImageUsageFlags,
6319 _flags: api::VkImageCreateFlags,
6320 _externalHandleType: api::VkExternalMemoryHandleTypeFlagsNV,
6321 _pExternalImageFormatProperties: *mut api::VkExternalImageFormatPropertiesNV,
6322 ) -> api::VkResult {
6326 #[allow(non_snake_case)]
6327 #[cfg(kazan_include_unused_vulkan_api)]
6328 pub unsafe extern "system" fn vkCmdBeginConditionalRenderingEXT(
6329 _commandBuffer: api::VkCommandBuffer,
6330 _pConditionalRenderingBegin: *const api::VkConditionalRenderingBeginInfoEXT,
6335 #[allow(non_snake_case)]
6336 #[cfg(kazan_include_unused_vulkan_api)]
6337 pub unsafe extern "system" fn vkCmdEndConditionalRenderingEXT(
6338 _commandBuffer: api::VkCommandBuffer,
6343 #[allow(non_snake_case)]
6344 #[cfg(kazan_include_unused_vulkan_api)]
6345 pub unsafe extern "system" fn vkCmdSetViewportWScalingNV(
6346 _commandBuffer: api::VkCommandBuffer,
6347 _firstViewport: u32,
6348 _viewportCount: u32,
6349 _pViewportWScalings: *const api::VkViewportWScalingNV,
6354 #[allow(non_snake_case)]
6355 #[cfg(kazan_include_unused_vulkan_api)]
6356 pub unsafe extern "system" fn vkReleaseDisplayEXT(
6357 _physicalDevice: api::VkPhysicalDevice,
6358 _display: api::VkDisplayKHR,
6359 ) -> api::VkResult {
6363 #[allow(non_snake_case)]
6364 #[cfg(kazan_include_unused_vulkan_api)]
6365 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilities2EXT(
6366 _physicalDevice: api::VkPhysicalDevice,
6367 _surface: api::VkSurfaceKHR,
6368 _pSurfaceCapabilities: *mut api::VkSurfaceCapabilities2EXT,
6369 ) -> api::VkResult {
6373 #[allow(non_snake_case)]
6374 #[cfg(kazan_include_unused_vulkan_api)]
6375 pub unsafe extern "system" fn vkDisplayPowerControlEXT(
6376 _device: api::VkDevice,
6377 _display: api::VkDisplayKHR,
6378 _pDisplayPowerInfo: *const api::VkDisplayPowerInfoEXT,
6379 ) -> api::VkResult {
6383 #[allow(non_snake_case)]
6384 #[cfg(kazan_include_unused_vulkan_api)]
6385 pub unsafe extern "system" fn vkRegisterDeviceEventEXT(
6386 _device: api::VkDevice,
6387 _pDeviceEventInfo: *const api::VkDeviceEventInfoEXT,
6388 _pAllocator: *const api::VkAllocationCallbacks,
6389 _pFence: *mut api::VkFence,
6390 ) -> api::VkResult {
6394 #[allow(non_snake_case)]
6395 #[cfg(kazan_include_unused_vulkan_api)]
6396 pub unsafe extern "system" fn vkRegisterDisplayEventEXT(
6397 _device: api::VkDevice,
6398 _display: api::VkDisplayKHR,
6399 _pDisplayEventInfo: *const api::VkDisplayEventInfoEXT,
6400 _pAllocator: *const api::VkAllocationCallbacks,
6401 _pFence: *mut api::VkFence,
6402 ) -> api::VkResult {
6406 #[allow(non_snake_case)]
6407 #[cfg(kazan_include_unused_vulkan_api)]
6408 pub unsafe extern "system" fn vkGetSwapchainCounterEXT(
6409 _device: api::VkDevice,
6410 _swapchain: api::VkSwapchainKHR,
6411 _counter: api::VkSurfaceCounterFlagBitsEXT,
6412 _pCounterValue: *mut u64,
6413 ) -> api::VkResult {
6417 #[allow(non_snake_case)]
6418 #[cfg(kazan_include_unused_vulkan_api)]
6419 pub unsafe extern "system" fn vkGetRefreshCycleDurationGOOGLE(
6420 _device: api::VkDevice,
6421 _swapchain: api::VkSwapchainKHR,
6422 _pDisplayTimingProperties: *mut api::VkRefreshCycleDurationGOOGLE,
6423 ) -> api::VkResult {
6427 #[allow(non_snake_case)]
6428 #[cfg(kazan_include_unused_vulkan_api)]
6429 pub unsafe extern "system" fn vkGetPastPresentationTimingGOOGLE(
6430 _device: api::VkDevice,
6431 _swapchain: api::VkSwapchainKHR,
6432 _pPresentationTimingCount: *mut u32,
6433 _pPresentationTimings: *mut api::VkPastPresentationTimingGOOGLE,
6434 ) -> api::VkResult {
6438 #[allow(non_snake_case)]
6439 #[cfg(kazan_include_unused_vulkan_api)]
6440 pub unsafe extern "system" fn vkCmdSetDiscardRectangleEXT(
6441 _commandBuffer: api::VkCommandBuffer,
6442 _firstDiscardRectangle: u32,
6443 _discardRectangleCount: u32,
6444 _pDiscardRectangles: *const api::VkRect2D,
6449 #[allow(non_snake_case)]
6450 #[cfg(kazan_include_unused_vulkan_api)]
6451 pub unsafe extern "system" fn vkSetHdrMetadataEXT(
6452 _device: api::VkDevice,
6453 _swapchainCount: u32,
6454 _pSwapchains: *const api::VkSwapchainKHR,
6455 _pMetadata: *const api::VkHdrMetadataEXT,
6460 #[allow(non_snake_case)]
6461 #[cfg(kazan_include_unused_vulkan_api)]
6462 pub unsafe extern "system" fn vkSetDebugUtilsObjectNameEXT(
6463 _device: api::VkDevice,
6464 _pNameInfo: *const api::VkDebugUtilsObjectNameInfoEXT,
6465 ) -> api::VkResult {
6469 #[allow(non_snake_case)]
6470 #[cfg(kazan_include_unused_vulkan_api)]
6471 pub unsafe extern "system" fn vkSetDebugUtilsObjectTagEXT(
6472 _device: api::VkDevice,
6473 _pTagInfo: *const api::VkDebugUtilsObjectTagInfoEXT,
6474 ) -> api::VkResult {
6478 #[allow(non_snake_case)]
6479 #[cfg(kazan_include_unused_vulkan_api)]
6480 pub unsafe extern "system" fn vkQueueBeginDebugUtilsLabelEXT(
6481 _queue: api::VkQueue,
6482 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6487 #[allow(non_snake_case)]
6488 #[cfg(kazan_include_unused_vulkan_api)]
6489 pub unsafe extern "system" fn vkQueueEndDebugUtilsLabelEXT(_queue: api::VkQueue) {
6493 #[allow(non_snake_case)]
6494 #[cfg(kazan_include_unused_vulkan_api)]
6495 pub unsafe extern "system" fn vkQueueInsertDebugUtilsLabelEXT(
6496 _queue: api::VkQueue,
6497 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6502 #[allow(non_snake_case)]
6503 #[cfg(kazan_include_unused_vulkan_api)]
6504 pub unsafe extern "system" fn vkCmdBeginDebugUtilsLabelEXT(
6505 _commandBuffer: api::VkCommandBuffer,
6506 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6511 #[allow(non_snake_case)]
6512 #[cfg(kazan_include_unused_vulkan_api)]
6513 pub unsafe extern "system" fn vkCmdEndDebugUtilsLabelEXT(_commandBuffer: api::VkCommandBuffer) {
6517 #[allow(non_snake_case)]
6518 #[cfg(kazan_include_unused_vulkan_api)]
6519 pub unsafe extern "system" fn vkCmdInsertDebugUtilsLabelEXT(
6520 _commandBuffer: api::VkCommandBuffer,
6521 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6526 #[allow(non_snake_case)]
6527 #[cfg(kazan_include_unused_vulkan_api)]
6528 pub unsafe extern "system" fn vkCreateDebugUtilsMessengerEXT(
6529 _instance: api::VkInstance,
6530 _pCreateInfo: *const api::VkDebugUtilsMessengerCreateInfoEXT,
6531 _pAllocator: *const api::VkAllocationCallbacks,
6532 _pMessenger: *mut api::VkDebugUtilsMessengerEXT,
6533 ) -> api::VkResult {
6537 #[allow(non_snake_case)]
6538 #[cfg(kazan_include_unused_vulkan_api)]
6539 pub unsafe extern "system" fn vkDestroyDebugUtilsMessengerEXT(
6540 _instance: api::VkInstance,
6541 _messenger: api::VkDebugUtilsMessengerEXT,
6542 _pAllocator: *const api::VkAllocationCallbacks,
6547 #[allow(non_snake_case)]
6548 #[cfg(kazan_include_unused_vulkan_api)]
6549 pub unsafe extern "system" fn vkSubmitDebugUtilsMessageEXT(
6550 _instance: api::VkInstance,
6551 _messageSeverity: api::VkDebugUtilsMessageSeverityFlagBitsEXT,
6552 _messageTypes: api::VkDebugUtilsMessageTypeFlagsEXT,
6553 _pCallbackData: *const api::VkDebugUtilsMessengerCallbackDataEXT,
6558 #[allow(non_snake_case)]
6559 #[cfg(kazan_include_unused_vulkan_api)]
6560 pub unsafe extern "system" fn vkCmdSetSampleLocationsEXT(
6561 _commandBuffer: api::VkCommandBuffer,
6562 _pSampleLocationsInfo: *const api::VkSampleLocationsInfoEXT,
6567 #[allow(non_snake_case)]
6568 #[cfg(kazan_include_unused_vulkan_api)]
6569 pub unsafe extern "system" fn vkGetPhysicalDeviceMultisamplePropertiesEXT(
6570 _physicalDevice: api::VkPhysicalDevice,
6571 _samples: api::VkSampleCountFlagBits,
6572 _pMultisampleProperties: *mut api::VkMultisamplePropertiesEXT,
6577 #[allow(non_snake_case)]
6578 #[cfg(kazan_include_unused_vulkan_api)]
6579 pub unsafe extern "system" fn vkCreateValidationCacheEXT(
6580 _device: api::VkDevice,
6581 _pCreateInfo: *const api::VkValidationCacheCreateInfoEXT,
6582 _pAllocator: *const api::VkAllocationCallbacks,
6583 _pValidationCache: *mut api::VkValidationCacheEXT,
6584 ) -> api::VkResult {
6588 #[allow(non_snake_case)]
6589 #[cfg(kazan_include_unused_vulkan_api)]
6590 pub unsafe extern "system" fn vkDestroyValidationCacheEXT(
6591 _device: api::VkDevice,
6592 _validationCache: api::VkValidationCacheEXT,
6593 _pAllocator: *const api::VkAllocationCallbacks,
6598 #[allow(non_snake_case)]
6599 #[cfg(kazan_include_unused_vulkan_api)]
6600 pub unsafe extern "system" fn vkMergeValidationCachesEXT(
6601 _device: api::VkDevice,
6602 _dstCache: api::VkValidationCacheEXT,
6603 _srcCacheCount: u32,
6604 _pSrcCaches: *const api::VkValidationCacheEXT,
6605 ) -> api::VkResult {
6609 #[allow(non_snake_case)]
6610 #[cfg(kazan_include_unused_vulkan_api)]
6611 pub unsafe extern "system" fn vkGetValidationCacheDataEXT(
6612 _device: api::VkDevice,
6613 _validationCache: api::VkValidationCacheEXT,
6614 _pDataSize: *mut usize,
6615 _pData: *mut c_void,
6616 ) -> api::VkResult {
6620 #[allow(non_snake_case)]
6621 #[cfg(kazan_include_unused_vulkan_api)]
6622 pub unsafe extern "system" fn vkCmdBindShadingRateImageNV(
6623 _commandBuffer: api::VkCommandBuffer,
6624 _imageView: api::VkImageView,
6625 _imageLayout: api::VkImageLayout,
6630 #[allow(non_snake_case)]
6631 #[cfg(kazan_include_unused_vulkan_api)]
6632 pub unsafe extern "system" fn vkCmdSetViewportShadingRatePaletteNV(
6633 _commandBuffer: api::VkCommandBuffer,
6634 _firstViewport: u32,
6635 _viewportCount: u32,
6636 _pShadingRatePalettes: *const api::VkShadingRatePaletteNV,
6641 #[allow(non_snake_case)]
6642 #[cfg(kazan_include_unused_vulkan_api)]
6643 pub unsafe extern "system" fn vkCmdSetCoarseSampleOrderNV(
6644 _commandBuffer: api::VkCommandBuffer,
6645 _sampleOrderType: api::VkCoarseSampleOrderTypeNV,
6646 _customSampleOrderCount: u32,
6647 _pCustomSampleOrders: *const api::VkCoarseSampleOrderCustomNV,
6652 #[allow(non_snake_case)]
6653 #[cfg(kazan_include_unused_vulkan_api)]
6654 pub unsafe extern "system" fn vkGetMemoryHostPointerPropertiesEXT(
6655 _device: api::VkDevice,
6656 _handleType: api::VkExternalMemoryHandleTypeFlagBits,
6657 _pHostPointer: *const c_void,
6658 _pMemoryHostPointerProperties: *mut api::VkMemoryHostPointerPropertiesEXT,
6659 ) -> api::VkResult {
6663 #[allow(non_snake_case)]
6664 #[cfg(kazan_include_unused_vulkan_api)]
6665 pub unsafe extern "system" fn vkCmdWriteBufferMarkerAMD(
6666 _commandBuffer: api::VkCommandBuffer,
6667 _pipelineStage: api::VkPipelineStageFlagBits,
6668 _dstBuffer: api::VkBuffer,
6669 _dstOffset: api::VkDeviceSize,
6675 #[allow(non_snake_case)]
6676 #[cfg(kazan_include_unused_vulkan_api)]
6677 pub unsafe extern "system" fn vkCmdDrawMeshTasksNV(
6678 _commandBuffer: api::VkCommandBuffer,
6685 #[allow(non_snake_case)]
6686 #[cfg(kazan_include_unused_vulkan_api)]
6687 pub unsafe extern "system" fn vkCmdDrawMeshTasksIndirectNV(
6688 _commandBuffer: api::VkCommandBuffer,
6689 _buffer: api::VkBuffer,
6690 _offset: api::VkDeviceSize,
6697 #[allow(non_snake_case)]
6698 #[cfg(kazan_include_unused_vulkan_api)]
6699 pub unsafe extern "system" fn vkCmdDrawMeshTasksIndirectCountNV(
6700 _commandBuffer: api::VkCommandBuffer,
6701 _buffer: api::VkBuffer,
6702 _offset: api::VkDeviceSize,
6703 _countBuffer: api::VkBuffer,
6704 _countBufferOffset: api::VkDeviceSize,
6711 #[allow(non_snake_case)]
6712 #[cfg(kazan_include_unused_vulkan_api)]
6713 pub unsafe extern "system" fn vkCmdSetExclusiveScissorNV(
6714 _commandBuffer: api::VkCommandBuffer,
6715 _firstExclusiveScissor: u32,
6716 _exclusiveScissorCount: u32,
6717 _pExclusiveScissors: *const api::VkRect2D,
6722 #[allow(non_snake_case)]
6723 #[cfg(kazan_include_unused_vulkan_api)]
6724 pub unsafe extern "system" fn vkCmdSetCheckpointNV(
6725 _commandBuffer: api::VkCommandBuffer,
6726 _pCheckpointMarker: *const c_void,
6731 #[allow(non_snake_case)]
6732 #[cfg(kazan_include_unused_vulkan_api)]
6733 pub unsafe extern "system" fn vkGetQueueCheckpointDataNV(
6734 _queue: api::VkQueue,
6735 _pCheckpointDataCount: *mut u32,
6736 _pCheckpointData: *mut api::VkCheckpointDataNV,
6741 #[cfg(target_os = "linux")]
6742 #[allow(non_snake_case)]
6743 pub unsafe extern "system" fn vkCreateXcbSurfaceKHR(
6744 _instance: api::VkInstance,
6745 create_info: *const api::VkXcbSurfaceCreateInfoKHR,
6746 _allocator: *const api::VkAllocationCallbacks,
6747 surface: *mut api::VkSurfaceKHR,
6748 ) -> api::VkResult {
6749 parse_next_chain_const!{
6751 root = api::VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR,
6753 let create_info = &*create_info;
6754 let new_surface = Box::new(api::VkIcdSurfaceXcb {
6755 base: api::VkIcdSurfaceBase {
6756 platform: api::VK_ICD_WSI_PLATFORM_XCB,
6758 connection: create_info.connection,
6759 window: create_info.window,
6761 *surface = api::VkSurfaceKHR::new(NonNull::new(
6762 Box::into_raw(new_surface) as *mut api::VkIcdSurfaceBase
6767 #[cfg(target_os = "linux")]
6768 #[allow(non_snake_case)]
6769 pub unsafe extern "system" fn vkGetPhysicalDeviceXcbPresentationSupportKHR(
6770 _physicalDevice: api::VkPhysicalDevice,
6771 _queueFamilyIndex: u32,
6772 _connection: *mut xcb::ffi::xcb_connection_t,
6773 _visual_id: xcb::ffi::xcb_visualid_t,
6774 ) -> api::VkBool32 {