1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 // Copyright 2018 Jacob Lifshay
8 DeviceMemory, DeviceMemoryAllocation, DeviceMemoryHeap, DeviceMemoryHeaps, DeviceMemoryLayout,
9 DeviceMemoryType, DeviceMemoryTypes,
11 use enum_map::EnumMap;
12 use handle::{Handle, OwnedHandle, SharedHandle};
15 use shader_module::ShaderModule;
18 use std::iter::FromIterator;
21 use std::os::raw::{c_char, c_int, c_void};
23 use std::ptr::null_mut;
24 use std::ptr::NonNull;
26 use std::str::FromStr;
27 use swapchain::{SurfaceImplementation, SurfacePlatform, Swapchain};
33 /// structure types the driver should know about
34 fn is_supported_structure_type(v: api::VkStructureType) -> bool {
38 api::VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR => return true,
43 api::VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR
44 | api::VK_STRUCTURE_TYPE_APPLICATION_INFO
45 | api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO
46 | api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO
47 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO
48 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO
49 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR
50 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO
51 | api::VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
52 | api::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
53 | api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
54 | api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2
55 | api::VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
56 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
57 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
58 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO
59 | api::VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
60 | api::VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
61 | api::VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
62 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
63 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
64 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
65 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT
66 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO
67 | api::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
68 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO
69 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO
70 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO
71 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR
72 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR
73 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO
74 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO
75 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR
76 | api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
77 | api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2
78 | api::VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
79 | api::VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO
80 | api::VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO
81 | api::VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO
82 | api::VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES
83 | api::VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES
84 | api::VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES
85 | api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO
86 | api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO
87 | api::VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES
88 | api::VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
89 | api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2
90 | api::VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
91 | api::VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
92 | api::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
93 | api::VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2
94 | api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
95 | api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2
96 | api::VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO
97 | api::VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2
98 | api::VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR
99 | api::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
100 | api::VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO
101 | api::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
102 | api::VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
103 | api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO
104 | api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
105 | api::VK_STRUCTURE_TYPE_MEMORY_BARRIER
106 | api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO
107 | api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS
108 | api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2
109 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES
110 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO
111 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO
112 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO
113 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO
114 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2
115 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES
116 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES
117 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2
118 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES
119 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2
120 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES
121 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES
122 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES
123 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2
124 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES
125 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES
126 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES
127 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES
128 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2
129 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES
130 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR
131 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES
132 | api::VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
133 | api::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
134 | api::VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
135 | api::VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
136 | api::VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
137 | api::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
138 | api::VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
139 | api::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
140 | api::VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
141 | api::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO
142 | api::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
143 | api::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
144 | api::VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
145 | api::VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
146 | api::VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO
147 | api::VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
148 | api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2
149 | api::VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
150 | api::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
151 | api::VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO
152 | api::VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO
153 | api::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
154 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO
155 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES
156 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO
157 | api::VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
158 | api::VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
159 | api::VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2
160 | api::VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2
161 | api::VK_STRUCTURE_TYPE_SUBMIT_INFO
162 | api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR
163 | api::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
164 | api::VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET => true,
169 fn verify_structure_type_is_supported(v: api::VkStructureType) {
171 is_supported_structure_type(v),
172 "missing structure type in is_supported_structure_type: {:?}",
177 unsafe fn parse_next_chain_const(
178 root: *const api::VkBaseInStructure,
179 expected_root_struct_type: api::VkStructureType,
180 expected_child_structs: &[(api::VkStructureType, *mut *const api::VkBaseInStructure)],
182 verify_structure_type_is_supported(expected_root_struct_type);
183 let ref root = *root;
184 assert_eq!(root.sType, expected_root_struct_type);
185 for &(child_struct_type, child_struct) in expected_child_structs.iter() {
186 verify_structure_type_is_supported(child_struct_type);
187 *child_struct = null();
189 let mut child = root.pNext as *const api::VkBaseInStructure;
190 while !child.is_null() {
191 let ref child_ref = *child;
192 let search_for_type = child_ref.sType;
193 let mut found = false;
194 for &(child_struct_type, child_struct) in expected_child_structs.iter() {
195 if child_struct_type == search_for_type {
197 (*child_struct).is_null(),
198 "duplicate struct type in pNext chain: {:?}",
201 *child_struct = child;
207 found || !is_supported_structure_type(search_for_type),
208 "unexpected struct type in pNext chain: {:?}",
211 child = child_ref.pNext as *const _;
215 unsafe fn parse_next_chain_mut(
216 root: *mut api::VkBaseOutStructure,
217 expected_root_struct_type: api::VkStructureType,
218 expected_child_structs: &[(api::VkStructureType, *mut *mut api::VkBaseOutStructure)],
220 parse_next_chain_const(
221 root as *const api::VkBaseInStructure,
222 expected_root_struct_type,
223 mem::transmute(expected_child_structs),
227 macro_rules! parse_next_chain_const {
230 root = $root_type:expr,
231 $($name:ident: $var_type:ty = $struct_type:expr,)*
233 $(let mut $name: *const $var_type = null();)*
234 parse_next_chain_const(
235 $root as *const api::VkBaseInStructure,
237 &[$(($struct_type, &mut $name as *mut *const $var_type as *mut *const api::VkBaseInStructure)),*]
242 macro_rules! parse_next_chain_mut {
245 root = $root_type:expr,
246 $($name:ident: $var_type:ty = $struct_type:expr,)*
248 $(let mut $name: *mut $var_type = null_mut();)*
249 parse_next_chain_mut(
250 $root as *mut api::VkBaseOutStructure,
252 &[$(($struct_type, &mut $name as *mut *mut $var_type as *mut *mut api::VkBaseOutStructure)),*]
257 fn copy_str_to_char_array(dest: &mut [c_char], src: &str) {
258 assert!(dest.len() >= src.len() + 1);
259 let src = src.as_bytes();
260 for i in 0..src.len() {
261 dest[i] = src[i] as c_char;
263 for i in src.len()..dest.len() {
268 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Enum)]
270 #[allow(non_camel_case_types)]
274 VK_KHR_device_group_creation,
276 VK_KHR_descriptor_update_template,
278 VK_KHR_get_memory_requirements2,
279 VK_KHR_get_physical_device_properties2,
280 VK_KHR_sampler_ycbcr_conversion,
283 VK_KHR_external_memory_capabilities,
284 VK_KHR_external_fence_capabilities,
285 VK_KHR_external_semaphore_capabilities,
286 VK_KHR_16bit_storage,
287 VK_KHR_storage_buffer_storage_class,
288 VK_KHR_dedicated_allocation,
289 VK_KHR_external_fence,
290 VK_KHR_external_memory,
291 VK_KHR_external_semaphore,
293 VK_KHR_relaxed_block_layout,
294 VK_KHR_shader_draw_parameters,
295 VK_KHR_variable_pointers,
301 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
302 pub enum ExtensionScope {
307 macro_rules! extensions {
308 [$($extension:expr),*] => {
310 let extensions: Extensions = [$($extension),*].iter().map(|v|*v).collect();
317 pub fn get_required_extensions(self) -> Extensions {
319 Extension::VK_KHR_surface
320 | Extension::VK_KHR_bind_memory2
321 | Extension::VK_KHR_device_group_creation
322 | Extension::VK_KHR_descriptor_update_template
323 | Extension::VK_KHR_maintenance1
324 | Extension::VK_KHR_get_memory_requirements2
325 | Extension::VK_KHR_get_physical_device_properties2
326 | Extension::VK_KHR_maintenance2
327 | Extension::VK_KHR_storage_buffer_storage_class
328 | Extension::VK_KHR_relaxed_block_layout
329 | Extension::VK_KHR_shader_draw_parameters => extensions![],
330 Extension::VK_KHR_device_group => extensions![Extension::VK_KHR_device_group_creation],
331 Extension::VK_KHR_sampler_ycbcr_conversion => extensions![
332 Extension::VK_KHR_maintenance1,
333 Extension::VK_KHR_bind_memory2,
334 Extension::VK_KHR_get_memory_requirements2,
335 Extension::VK_KHR_get_physical_device_properties2
337 Extension::VK_KHR_maintenance3
338 | Extension::VK_KHR_external_memory_capabilities
339 | Extension::VK_KHR_external_fence_capabilities
340 | Extension::VK_KHR_external_semaphore_capabilities
341 | Extension::VK_KHR_multiview => {
342 extensions![Extension::VK_KHR_get_physical_device_properties2]
344 Extension::VK_KHR_16bit_storage | Extension::VK_KHR_variable_pointers => extensions![
345 Extension::VK_KHR_get_physical_device_properties2,
346 Extension::VK_KHR_storage_buffer_storage_class
348 Extension::VK_KHR_dedicated_allocation => {
349 extensions![Extension::VK_KHR_get_memory_requirements2]
351 Extension::VK_KHR_external_fence => {
352 extensions![Extension::VK_KHR_external_fence_capabilities]
354 Extension::VK_KHR_external_memory => {
355 extensions![Extension::VK_KHR_external_memory_capabilities]
357 Extension::VK_KHR_external_semaphore => {
358 extensions![Extension::VK_KHR_external_semaphore_capabilities]
360 Extension::VK_KHR_swapchain => extensions![Extension::VK_KHR_surface],
362 Extension::VK_KHR_xcb_surface => extensions![Extension::VK_KHR_surface],
365 pub fn get_recursively_required_extensions(self) -> Extensions {
366 let mut retval = self.get_required_extensions();
367 let mut worklist: EnumMap<Extension, Extension> = enum_map!{_ => self};
368 let worklist = worklist.as_mut_slice();
369 let mut worklist_size = 1;
370 while worklist_size > 0 {
372 let extension = worklist[worklist_size];
373 retval[extension] = true;
374 for (extension, &v) in extension.get_required_extensions().iter() {
375 if v && !retval[extension] {
376 worklist[worklist_size] = extension;
383 pub fn get_name(self) -> &'static str {
385 ($($(#[$attributes:meta])* $name:ident,)*) => {
387 $($(#[$attributes])* Extension::$name => stringify!($name),)*
395 VK_KHR_device_group_creation,
396 VK_KHR_descriptor_update_template,
398 VK_KHR_get_memory_requirements2,
399 VK_KHR_get_physical_device_properties2,
400 VK_KHR_sampler_ycbcr_conversion,
403 VK_KHR_external_memory_capabilities,
404 VK_KHR_external_fence_capabilities,
405 VK_KHR_external_semaphore_capabilities,
406 VK_KHR_16bit_storage,
407 VK_KHR_storage_buffer_storage_class,
408 VK_KHR_dedicated_allocation,
409 VK_KHR_external_fence,
410 VK_KHR_external_memory,
411 VK_KHR_external_semaphore,
413 VK_KHR_relaxed_block_layout,
414 VK_KHR_shader_draw_parameters,
415 VK_KHR_variable_pointers,
421 pub fn get_spec_version(self) -> u32 {
423 Extension::VK_KHR_surface => api::VK_KHR_SURFACE_SPEC_VERSION,
424 Extension::VK_KHR_bind_memory2 => api::VK_KHR_BIND_MEMORY_2_SPEC_VERSION,
425 Extension::VK_KHR_device_group => api::VK_KHR_DEVICE_GROUP_SPEC_VERSION,
426 Extension::VK_KHR_device_group_creation => {
427 api::VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION
429 Extension::VK_KHR_descriptor_update_template => {
430 api::VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION
432 Extension::VK_KHR_maintenance1 => api::VK_KHR_MAINTENANCE1_SPEC_VERSION,
433 Extension::VK_KHR_get_memory_requirements2 => {
434 api::VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION
436 Extension::VK_KHR_get_physical_device_properties2 => {
437 api::VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION
439 Extension::VK_KHR_sampler_ycbcr_conversion => {
440 api::VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION
442 Extension::VK_KHR_maintenance2 => api::VK_KHR_MAINTENANCE2_SPEC_VERSION,
443 Extension::VK_KHR_maintenance3 => api::VK_KHR_MAINTENANCE3_SPEC_VERSION,
444 Extension::VK_KHR_external_memory_capabilities => {
445 api::VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION
447 Extension::VK_KHR_external_fence_capabilities => {
448 api::VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION
450 Extension::VK_KHR_external_semaphore_capabilities => {
451 api::VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION
453 Extension::VK_KHR_16bit_storage => api::VK_KHR_16BIT_STORAGE_SPEC_VERSION,
454 Extension::VK_KHR_storage_buffer_storage_class => {
455 api::VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION
457 Extension::VK_KHR_dedicated_allocation => api::VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION,
458 Extension::VK_KHR_external_fence => api::VK_KHR_EXTERNAL_FENCE_SPEC_VERSION,
459 Extension::VK_KHR_external_memory => api::VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION,
460 Extension::VK_KHR_external_semaphore => api::VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION,
461 Extension::VK_KHR_multiview => api::VK_KHR_MULTIVIEW_SPEC_VERSION,
462 Extension::VK_KHR_relaxed_block_layout => api::VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION,
463 Extension::VK_KHR_shader_draw_parameters => {
464 api::VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION
466 Extension::VK_KHR_variable_pointers => api::VK_KHR_VARIABLE_POINTERS_SPEC_VERSION,
467 Extension::VK_KHR_swapchain => api::VK_KHR_SWAPCHAIN_SPEC_VERSION,
469 Extension::VK_KHR_xcb_surface => api::VK_KHR_XCB_SURFACE_SPEC_VERSION,
472 pub fn get_properties(self) -> api::VkExtensionProperties {
473 let mut retval = api::VkExtensionProperties {
474 extensionName: [0; api::VK_MAX_EXTENSION_NAME_SIZE as usize],
475 specVersion: self.get_spec_version(),
477 copy_str_to_char_array(&mut retval.extensionName, self.get_name());
480 pub fn get_scope(self) -> ExtensionScope {
482 Extension::VK_KHR_surface
483 | Extension::VK_KHR_device_group_creation
484 | Extension::VK_KHR_get_physical_device_properties2
485 | Extension::VK_KHR_external_memory_capabilities
486 | Extension::VK_KHR_external_fence_capabilities
487 | Extension::VK_KHR_external_semaphore_capabilities => ExtensionScope::Instance,
488 Extension::VK_KHR_bind_memory2
489 | Extension::VK_KHR_device_group
490 | Extension::VK_KHR_descriptor_update_template
491 | Extension::VK_KHR_maintenance1
492 | Extension::VK_KHR_get_memory_requirements2
493 | Extension::VK_KHR_sampler_ycbcr_conversion
494 | Extension::VK_KHR_maintenance2
495 | Extension::VK_KHR_maintenance3
496 | Extension::VK_KHR_16bit_storage
497 | Extension::VK_KHR_storage_buffer_storage_class
498 | Extension::VK_KHR_dedicated_allocation
499 | Extension::VK_KHR_external_fence
500 | Extension::VK_KHR_external_memory
501 | Extension::VK_KHR_external_semaphore
502 | Extension::VK_KHR_multiview
503 | Extension::VK_KHR_relaxed_block_layout
504 | Extension::VK_KHR_shader_draw_parameters
505 | Extension::VK_KHR_variable_pointers
506 | Extension::VK_KHR_swapchain => ExtensionScope::Device,
508 Extension::VK_KHR_xcb_surface => ExtensionScope::Instance,
513 impl FromStr for Extension {
515 fn from_str(s: &str) -> Result<Self, Self::Err> {
516 for (i, _) in Extensions::default().iter() {
517 if s == i.get_name() {
525 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
526 pub struct Extensions(EnumMap<Extension, bool>);
529 pub fn create_empty() -> Self {
530 Extensions(enum_map!{_ => false})
532 pub fn is_empty(&self) -> bool {
533 self.iter().all(|(_, &v)| !v)
535 pub fn is_full(&self) -> bool {
536 self.iter().all(|(_, &v)| v)
538 pub fn get_allowed_extensions_from_instance_scope(&self) -> Self {
539 let mut retval = Extensions::default();
540 let instance_extensions = Self::instance_extensions();
541 for (extension, value) in retval.iter_mut() {
542 if extension.get_scope() == ExtensionScope::Instance {
543 *value = self[extension];
546 let required_extensions =
547 instance_extensions & extension.get_recursively_required_extensions();
548 *value = (!*self & required_extensions).is_empty();
552 pub fn instance_extensions() -> Self {
554 (|extension: Extension| extension.get_scope() == ExtensionScope::Instance).into(),
557 pub fn device_extensions() -> Self {
558 !Self::instance_extensions()
562 impl FromIterator<Extension> for Extensions {
563 fn from_iter<T: IntoIterator<Item = Extension>>(v: T) -> Extensions {
564 let mut retval = Extensions::create_empty();
566 retval[extension] = true;
572 impl Default for Extensions {
573 fn default() -> Self {
578 impl Deref for Extensions {
579 type Target = EnumMap<Extension, bool>;
580 fn deref(&self) -> &Self::Target {
585 impl DerefMut for Extensions {
586 fn deref_mut(&mut self) -> &mut Self::Target {
591 impl BitAnd for Extensions {
593 fn bitand(self, rhs: Self) -> Self {
594 let mut retval = Self::default();
595 for (index, retval) in retval.iter_mut() {
596 *retval = self[index] & rhs[index];
602 impl BitOr for Extensions {
604 fn bitor(self, rhs: Self) -> Self {
605 let mut retval = Self::default();
606 for (index, retval) in retval.iter_mut() {
607 *retval = self[index] | rhs[index];
613 impl BitXor for Extensions {
615 fn bitxor(self, rhs: Self) -> Self {
616 let mut retval = Self::default();
617 for (index, retval) in retval.iter_mut() {
618 *retval = self[index] ^ rhs[index];
624 impl Not for Extensions {
626 fn not(mut self) -> Self {
627 for v in self.values_mut() {
634 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
635 enum GetProcAddressScope {
643 scope: GetProcAddressScope,
644 extensions: &Extensions,
645 ) -> api::PFN_vkVoidFunction {
646 let mut name = unsafe { CStr::from_ptr(name) }.to_str().ok()?;
648 use std::mem::transmute;
655 global: scope != GetProcAddressScope::Device,
656 instance: scope == GetProcAddressScope::Instance,
657 device: scope != GetProcAddressScope::Global,
659 macro_rules! proc_alias_khr {
660 ($base_name:ident, $required_extension:expr) => {
661 if name == concat!(stringify!($base_name), "KHR") {
662 if scope.instance && $required_extension {
663 name = stringify!($base_name);
672 extensions[Extension::VK_KHR_bind_memory2]
676 extensions[Extension::VK_KHR_bind_memory2]
680 extensions[Extension::VK_KHR_device_group]
684 extensions[Extension::VK_KHR_device_group]
687 vkCreateDescriptorUpdateTemplate,
688 extensions[Extension::VK_KHR_descriptor_update_template]
691 vkCreateSamplerYcbcrConversion,
692 extensions[Extension::VK_KHR_sampler_ycbcr_conversion]
695 vkDestroyDescriptorUpdateTemplate,
696 extensions[Extension::VK_KHR_descriptor_update_template]
699 vkDestroySamplerYcbcrConversion,
700 extensions[Extension::VK_KHR_sampler_ycbcr_conversion]
703 vkEnumeratePhysicalDeviceGroups,
704 extensions[Extension::VK_KHR_device_group_creation]
707 vkGetBufferMemoryRequirements2,
708 extensions[Extension::VK_KHR_get_memory_requirements2]
711 vkGetDescriptorSetLayoutSupport,
712 extensions[Extension::VK_KHR_maintenance3]
715 vkGetDeviceGroupPeerMemoryFeatures,
716 extensions[Extension::VK_KHR_device_group]
719 vkGetImageMemoryRequirements2,
720 extensions[Extension::VK_KHR_get_memory_requirements2]
723 vkGetImageSparseMemoryRequirements2,
724 extensions[Extension::VK_KHR_get_memory_requirements2]
727 vkGetPhysicalDeviceExternalBufferProperties,
728 extensions[Extension::VK_KHR_external_memory_capabilities]
731 vkGetPhysicalDeviceExternalFenceProperties,
732 extensions[Extension::VK_KHR_external_fence_capabilities]
735 vkGetPhysicalDeviceExternalSemaphoreProperties,
736 extensions[Extension::VK_KHR_external_semaphore_capabilities]
739 vkGetPhysicalDeviceFeatures2,
740 extensions[Extension::VK_KHR_get_physical_device_properties2]
743 vkGetPhysicalDeviceFormatProperties2,
744 extensions[Extension::VK_KHR_get_physical_device_properties2]
747 vkGetPhysicalDeviceImageFormatProperties2,
748 extensions[Extension::VK_KHR_get_physical_device_properties2]
751 vkGetPhysicalDeviceMemoryProperties2,
752 extensions[Extension::VK_KHR_get_physical_device_properties2]
755 vkGetPhysicalDeviceProperties2,
756 extensions[Extension::VK_KHR_get_physical_device_properties2]
759 vkGetPhysicalDeviceQueueFamilyProperties2,
760 extensions[Extension::VK_KHR_get_physical_device_properties2]
763 vkGetPhysicalDeviceSparseImageFormatProperties2,
764 extensions[Extension::VK_KHR_get_physical_device_properties2]
768 extensions[Extension::VK_KHR_maintenance1]
771 vkUpdateDescriptorSetWithTemplate,
772 extensions[Extension::VK_KHR_descriptor_update_template]
774 macro_rules! proc_address {
775 ($name:ident, $pfn_name:ident, $required_scope:ident, $required_extension:expr) => {
776 if stringify!($name) == name {
777 if scope.$required_scope && $required_extension {
778 let f: $pfn_name = Some($name);
779 return unsafe { transmute(f) };
786 #[cfg_attr(rustfmt, rustfmt_skip)]
788 proc_address!(vkCreateInstance, PFN_vkCreateInstance, global, true);
789 proc_address!(vkEnumerateInstanceExtensionProperties, PFN_vkEnumerateInstanceExtensionProperties, global, true);
790 proc_address!(vkEnumerateInstanceLayerProperties, PFN_vkEnumerateInstanceLayerProperties, global, true);
791 proc_address!(vkEnumerateInstanceVersion, PFN_vkEnumerateInstanceVersion, global, true);
793 proc_address!(vkAllocateCommandBuffers, PFN_vkAllocateCommandBuffers, device, true);
794 proc_address!(vkAllocateDescriptorSets, PFN_vkAllocateDescriptorSets, device, true);
795 proc_address!(vkAllocateMemory, PFN_vkAllocateMemory, device, true);
796 proc_address!(vkBeginCommandBuffer, PFN_vkBeginCommandBuffer, device, true);
797 proc_address!(vkBindBufferMemory, PFN_vkBindBufferMemory, device, true);
798 proc_address!(vkBindBufferMemory2, PFN_vkBindBufferMemory2, device, true);
799 proc_address!(vkBindImageMemory, PFN_vkBindImageMemory, device, true);
800 proc_address!(vkBindImageMemory2, PFN_vkBindImageMemory2, device, true);
801 proc_address!(vkCmdBeginQuery, PFN_vkCmdBeginQuery, device, true);
802 proc_address!(vkCmdBeginRenderPass, PFN_vkCmdBeginRenderPass, device, true);
803 proc_address!(vkCmdBindDescriptorSets, PFN_vkCmdBindDescriptorSets, device, true);
804 proc_address!(vkCmdBindIndexBuffer, PFN_vkCmdBindIndexBuffer, device, true);
805 proc_address!(vkCmdBindPipeline, PFN_vkCmdBindPipeline, device, true);
806 proc_address!(vkCmdBindVertexBuffers, PFN_vkCmdBindVertexBuffers, device, true);
807 proc_address!(vkCmdBlitImage, PFN_vkCmdBlitImage, device, true);
808 proc_address!(vkCmdClearAttachments, PFN_vkCmdClearAttachments, device, true);
809 proc_address!(vkCmdClearColorImage, PFN_vkCmdClearColorImage, device, true);
810 proc_address!(vkCmdClearDepthStencilImage, PFN_vkCmdClearDepthStencilImage, device, true);
811 proc_address!(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, device, true);
812 proc_address!(vkCmdCopyBufferToImage, PFN_vkCmdCopyBufferToImage, device, true);
813 proc_address!(vkCmdCopyImage, PFN_vkCmdCopyImage, device, true);
814 proc_address!(vkCmdCopyImageToBuffer, PFN_vkCmdCopyImageToBuffer, device, true);
815 proc_address!(vkCmdCopyQueryPoolResults, PFN_vkCmdCopyQueryPoolResults, device, true);
816 proc_address!(vkCmdDispatch, PFN_vkCmdDispatch, device, true);
817 proc_address!(vkCmdDispatchBase, PFN_vkCmdDispatchBase, device, true);
818 proc_address!(vkCmdDispatchIndirect, PFN_vkCmdDispatchIndirect, device, true);
819 proc_address!(vkCmdDraw, PFN_vkCmdDraw, device, true);
820 proc_address!(vkCmdDrawIndexed, PFN_vkCmdDrawIndexed, device, true);
821 proc_address!(vkCmdDrawIndexedIndirect, PFN_vkCmdDrawIndexedIndirect, device, true);
822 proc_address!(vkCmdDrawIndirect, PFN_vkCmdDrawIndirect, device, true);
823 proc_address!(vkCmdEndQuery, PFN_vkCmdEndQuery, device, true);
824 proc_address!(vkCmdEndRenderPass, PFN_vkCmdEndRenderPass, device, true);
825 proc_address!(vkCmdExecuteCommands, PFN_vkCmdExecuteCommands, device, true);
826 proc_address!(vkCmdFillBuffer, PFN_vkCmdFillBuffer, device, true);
827 proc_address!(vkCmdNextSubpass, PFN_vkCmdNextSubpass, device, true);
828 proc_address!(vkCmdPipelineBarrier, PFN_vkCmdPipelineBarrier, device, true);
829 proc_address!(vkCmdPushConstants, PFN_vkCmdPushConstants, device, true);
830 proc_address!(vkCmdResetEvent, PFN_vkCmdResetEvent, device, true);
831 proc_address!(vkCmdResetQueryPool, PFN_vkCmdResetQueryPool, device, true);
832 proc_address!(vkCmdResolveImage, PFN_vkCmdResolveImage, device, true);
833 proc_address!(vkCmdSetBlendConstants, PFN_vkCmdSetBlendConstants, device, true);
834 proc_address!(vkCmdSetDepthBias, PFN_vkCmdSetDepthBias, device, true);
835 proc_address!(vkCmdSetDepthBounds, PFN_vkCmdSetDepthBounds, device, true);
836 proc_address!(vkCmdSetDeviceMask, PFN_vkCmdSetDeviceMask, device, true);
837 proc_address!(vkCmdSetEvent, PFN_vkCmdSetEvent, device, true);
838 proc_address!(vkCmdSetLineWidth, PFN_vkCmdSetLineWidth, device, true);
839 proc_address!(vkCmdSetScissor, PFN_vkCmdSetScissor, device, true);
840 proc_address!(vkCmdSetStencilCompareMask, PFN_vkCmdSetStencilCompareMask, device, true);
841 proc_address!(vkCmdSetStencilReference, PFN_vkCmdSetStencilReference, device, true);
842 proc_address!(vkCmdSetStencilWriteMask, PFN_vkCmdSetStencilWriteMask, device, true);
843 proc_address!(vkCmdSetViewport, PFN_vkCmdSetViewport, device, true);
844 proc_address!(vkCmdUpdateBuffer, PFN_vkCmdUpdateBuffer, device, true);
845 proc_address!(vkCmdWaitEvents, PFN_vkCmdWaitEvents, device, true);
846 proc_address!(vkCmdWriteTimestamp, PFN_vkCmdWriteTimestamp, device, true);
847 proc_address!(vkCreateBuffer, PFN_vkCreateBuffer, device, true);
848 proc_address!(vkCreateBufferView, PFN_vkCreateBufferView, device, true);
849 proc_address!(vkCreateCommandPool, PFN_vkCreateCommandPool, device, true);
850 proc_address!(vkCreateComputePipelines, PFN_vkCreateComputePipelines, device, true);
851 proc_address!(vkCreateDescriptorPool, PFN_vkCreateDescriptorPool, device, true);
852 proc_address!(vkCreateDescriptorSetLayout, PFN_vkCreateDescriptorSetLayout, device, true);
853 proc_address!(vkCreateDescriptorUpdateTemplate, PFN_vkCreateDescriptorUpdateTemplate, device, true);
854 proc_address!(vkCreateDevice, PFN_vkCreateDevice, instance, true);
855 proc_address!(vkCreateEvent, PFN_vkCreateEvent, device, true);
856 proc_address!(vkCreateFence, PFN_vkCreateFence, device, true);
857 proc_address!(vkCreateFramebuffer, PFN_vkCreateFramebuffer, device, true);
858 proc_address!(vkCreateGraphicsPipelines, PFN_vkCreateGraphicsPipelines, device, true);
859 proc_address!(vkCreateImage, PFN_vkCreateImage, device, true);
860 proc_address!(vkCreateImageView, PFN_vkCreateImageView, device, true);
861 proc_address!(vkCreatePipelineCache, PFN_vkCreatePipelineCache, device, true);
862 proc_address!(vkCreatePipelineLayout, PFN_vkCreatePipelineLayout, device, true);
863 proc_address!(vkCreateQueryPool, PFN_vkCreateQueryPool, device, true);
864 proc_address!(vkCreateRenderPass, PFN_vkCreateRenderPass, device, true);
865 proc_address!(vkCreateSampler, PFN_vkCreateSampler, device, true);
866 proc_address!(vkCreateSamplerYcbcrConversion, PFN_vkCreateSamplerYcbcrConversion, device, true);
867 proc_address!(vkCreateSemaphore, PFN_vkCreateSemaphore, device, true);
868 proc_address!(vkCreateShaderModule, PFN_vkCreateShaderModule, device, true);
869 proc_address!(vkDestroyBuffer, PFN_vkDestroyBuffer, device, true);
870 proc_address!(vkDestroyBufferView, PFN_vkDestroyBufferView, device, true);
871 proc_address!(vkDestroyCommandPool, PFN_vkDestroyCommandPool, device, true);
872 proc_address!(vkDestroyDescriptorPool, PFN_vkDestroyDescriptorPool, device, true);
873 proc_address!(vkDestroyDescriptorSetLayout, PFN_vkDestroyDescriptorSetLayout, device, true);
874 proc_address!(vkDestroyDescriptorUpdateTemplate, PFN_vkDestroyDescriptorUpdateTemplate, device, true);
875 proc_address!(vkDestroyDevice, PFN_vkDestroyDevice, device, true);
876 proc_address!(vkDestroyEvent, PFN_vkDestroyEvent, device, true);
877 proc_address!(vkDestroyFence, PFN_vkDestroyFence, device, true);
878 proc_address!(vkDestroyFramebuffer, PFN_vkDestroyFramebuffer, device, true);
879 proc_address!(vkDestroyImage, PFN_vkDestroyImage, device, true);
880 proc_address!(vkDestroyImageView, PFN_vkDestroyImageView, device, true);
881 proc_address!(vkDestroyInstance, PFN_vkDestroyInstance, instance, true);
882 proc_address!(vkDestroyPipeline, PFN_vkDestroyPipeline, device, true);
883 proc_address!(vkDestroyPipelineCache, PFN_vkDestroyPipelineCache, device, true);
884 proc_address!(vkDestroyPipelineLayout, PFN_vkDestroyPipelineLayout, device, true);
885 proc_address!(vkDestroyQueryPool, PFN_vkDestroyQueryPool, device, true);
886 proc_address!(vkDestroyRenderPass, PFN_vkDestroyRenderPass, device, true);
887 proc_address!(vkDestroySampler, PFN_vkDestroySampler, device, true);
888 proc_address!(vkDestroySamplerYcbcrConversion, PFN_vkDestroySamplerYcbcrConversion, device, true);
889 proc_address!(vkDestroySemaphore, PFN_vkDestroySemaphore, device, true);
890 proc_address!(vkDestroyShaderModule, PFN_vkDestroyShaderModule, device, true);
891 proc_address!(vkDeviceWaitIdle, PFN_vkDeviceWaitIdle, device, true);
892 proc_address!(vkEndCommandBuffer, PFN_vkEndCommandBuffer, device, true);
893 proc_address!(vkEnumerateDeviceExtensionProperties, PFN_vkEnumerateDeviceExtensionProperties, instance, true);
894 proc_address!(vkEnumerateDeviceLayerProperties, PFN_vkEnumerateDeviceLayerProperties, instance, true);
895 proc_address!(vkEnumeratePhysicalDeviceGroups, PFN_vkEnumeratePhysicalDeviceGroups, instance, true);
896 proc_address!(vkEnumeratePhysicalDevices, PFN_vkEnumeratePhysicalDevices, instance, true);
897 proc_address!(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, device, true);
898 proc_address!(vkFreeCommandBuffers, PFN_vkFreeCommandBuffers, device, true);
899 proc_address!(vkFreeDescriptorSets, PFN_vkFreeDescriptorSets, device, true);
900 proc_address!(vkFreeMemory, PFN_vkFreeMemory, device, true);
901 proc_address!(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, device, true);
902 proc_address!(vkGetBufferMemoryRequirements2, PFN_vkGetBufferMemoryRequirements2, device, true);
903 proc_address!(vkGetDescriptorSetLayoutSupport, PFN_vkGetDescriptorSetLayoutSupport, device, true);
904 proc_address!(vkGetDeviceGroupPeerMemoryFeatures, PFN_vkGetDeviceGroupPeerMemoryFeatures, device, true);
905 proc_address!(vkGetDeviceMemoryCommitment, PFN_vkGetDeviceMemoryCommitment, device, true);
906 proc_address!(vkGetDeviceProcAddr, PFN_vkGetDeviceProcAddr, device, true);
907 proc_address!(vkGetDeviceQueue, PFN_vkGetDeviceQueue, device, true);
908 proc_address!(vkGetDeviceQueue2, PFN_vkGetDeviceQueue2, device, true);
909 proc_address!(vkGetEventStatus, PFN_vkGetEventStatus, device, true);
910 proc_address!(vkGetFenceStatus, PFN_vkGetFenceStatus, device, true);
911 proc_address!(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, device, true);
912 proc_address!(vkGetImageMemoryRequirements2, PFN_vkGetImageMemoryRequirements2, device, true);
913 proc_address!(vkGetImageSparseMemoryRequirements, PFN_vkGetImageSparseMemoryRequirements, device, true);
914 proc_address!(vkGetImageSparseMemoryRequirements2, PFN_vkGetImageSparseMemoryRequirements2, device, true);
915 proc_address!(vkGetImageSubresourceLayout, PFN_vkGetImageSubresourceLayout, device, true);
916 proc_address!(vkGetInstanceProcAddr, PFN_vkGetInstanceProcAddr, device, true);
917 proc_address!(vkGetPhysicalDeviceExternalBufferProperties, PFN_vkGetPhysicalDeviceExternalBufferProperties, instance, true);
918 proc_address!(vkGetPhysicalDeviceExternalFenceProperties, PFN_vkGetPhysicalDeviceExternalFenceProperties, instance, true);
919 proc_address!(vkGetPhysicalDeviceExternalSemaphoreProperties, PFN_vkGetPhysicalDeviceExternalSemaphoreProperties, instance, true);
920 proc_address!(vkGetPhysicalDeviceFeatures, PFN_vkGetPhysicalDeviceFeatures, instance, true);
921 proc_address!(vkGetPhysicalDeviceFeatures2, PFN_vkGetPhysicalDeviceFeatures2, instance, true);
922 proc_address!(vkGetPhysicalDeviceFormatProperties, PFN_vkGetPhysicalDeviceFormatProperties, instance, true);
923 proc_address!(vkGetPhysicalDeviceFormatProperties2, PFN_vkGetPhysicalDeviceFormatProperties2, instance, true);
924 proc_address!(vkGetPhysicalDeviceImageFormatProperties, PFN_vkGetPhysicalDeviceImageFormatProperties, instance, true);
925 proc_address!(vkGetPhysicalDeviceImageFormatProperties2, PFN_vkGetPhysicalDeviceImageFormatProperties2, instance, true);
926 proc_address!(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, instance, true);
927 proc_address!(vkGetPhysicalDeviceMemoryProperties2, PFN_vkGetPhysicalDeviceMemoryProperties2, instance, true);
928 proc_address!(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, instance, true);
929 proc_address!(vkGetPhysicalDeviceProperties2, PFN_vkGetPhysicalDeviceProperties2, instance, true);
930 proc_address!(vkGetPhysicalDeviceQueueFamilyProperties, PFN_vkGetPhysicalDeviceQueueFamilyProperties, instance, true);
931 proc_address!(vkGetPhysicalDeviceQueueFamilyProperties2, PFN_vkGetPhysicalDeviceQueueFamilyProperties2, instance, true);
932 proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties, PFN_vkGetPhysicalDeviceSparseImageFormatProperties, instance, true);
933 proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties2, PFN_vkGetPhysicalDeviceSparseImageFormatProperties2, instance, true);
934 proc_address!(vkGetPipelineCacheData, PFN_vkGetPipelineCacheData, device, true);
935 proc_address!(vkGetQueryPoolResults, PFN_vkGetQueryPoolResults, device, true);
936 proc_address!(vkGetRenderAreaGranularity, PFN_vkGetRenderAreaGranularity, device, true);
937 proc_address!(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, device, true);
938 proc_address!(vkMapMemory, PFN_vkMapMemory, device, true);
939 proc_address!(vkMergePipelineCaches, PFN_vkMergePipelineCaches, device, true);
940 proc_address!(vkQueueBindSparse, PFN_vkQueueBindSparse, device, true);
941 proc_address!(vkQueueSubmit, PFN_vkQueueSubmit, device, true);
942 proc_address!(vkQueueWaitIdle, PFN_vkQueueWaitIdle, device, true);
943 proc_address!(vkResetCommandBuffer, PFN_vkResetCommandBuffer, device, true);
944 proc_address!(vkResetCommandPool, PFN_vkResetCommandPool, device, true);
945 proc_address!(vkResetDescriptorPool, PFN_vkResetDescriptorPool, device, true);
946 proc_address!(vkResetEvent, PFN_vkResetEvent, device, true);
947 proc_address!(vkResetFences, PFN_vkResetFences, device, true);
948 proc_address!(vkSetEvent, PFN_vkSetEvent, device, true);
949 proc_address!(vkTrimCommandPool, PFN_vkTrimCommandPool, device, true);
950 proc_address!(vkUnmapMemory, PFN_vkUnmapMemory, device, true);
951 proc_address!(vkUpdateDescriptorSets, PFN_vkUpdateDescriptorSets, device, true);
952 proc_address!(vkUpdateDescriptorSetWithTemplate, PFN_vkUpdateDescriptorSetWithTemplate, device, true);
953 proc_address!(vkWaitForFences, PFN_vkWaitForFences, device, true);
955 proc_address!(vkDestroySurfaceKHR, PFN_vkDestroySurfaceKHR, device, extensions[Extension::VK_KHR_surface]);
956 proc_address!(vkGetPhysicalDeviceSurfaceSupportKHR, PFN_vkGetPhysicalDeviceSurfaceSupportKHR, device, extensions[Extension::VK_KHR_surface]);
957 proc_address!(vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, device, extensions[Extension::VK_KHR_surface]);
958 proc_address!(vkGetPhysicalDeviceSurfaceFormatsKHR, PFN_vkGetPhysicalDeviceSurfaceFormatsKHR, device, extensions[Extension::VK_KHR_surface]);
959 proc_address!(vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR, device, extensions[Extension::VK_KHR_surface]);
961 proc_address!(vkCreateSwapchainKHR, PFN_vkCreateSwapchainKHR, device, extensions[Extension::VK_KHR_swapchain]);
962 proc_address!(vkDestroySwapchainKHR, PFN_vkDestroySwapchainKHR, device, extensions[Extension::VK_KHR_swapchain]);
963 proc_address!(vkGetSwapchainImagesKHR, PFN_vkGetSwapchainImagesKHR, device, extensions[Extension::VK_KHR_swapchain]);
964 proc_address!(vkAcquireNextImageKHR, PFN_vkAcquireNextImageKHR, device, extensions[Extension::VK_KHR_swapchain]);
965 proc_address!(vkQueuePresentKHR, PFN_vkQueuePresentKHR, device, extensions[Extension::VK_KHR_swapchain]);
966 proc_address!(vkGetDeviceGroupPresentCapabilitiesKHR, PFN_vkGetDeviceGroupPresentCapabilitiesKHR, device, extensions[Extension::VK_KHR_swapchain]);
967 proc_address!(vkGetDeviceGroupSurfacePresentModesKHR, PFN_vkGetDeviceGroupSurfacePresentModesKHR, device, extensions[Extension::VK_KHR_swapchain]);
968 proc_address!(vkGetPhysicalDevicePresentRectanglesKHR, PFN_vkGetPhysicalDevicePresentRectanglesKHR, device, extensions[Extension::VK_KHR_swapchain]);
969 proc_address!(vkAcquireNextImage2KHR, PFN_vkAcquireNextImage2KHR, device, extensions[Extension::VK_KHR_swapchain]);
972 proc_address!(vkCreateXcbSurfaceKHR, PFN_vkCreateXcbSurfaceKHR, device, extensions[Extension::VK_KHR_xcb_surface]);
974 proc_address!(vkGetPhysicalDeviceXcbPresentationSupportKHR, PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR, device, extensions[Extension::VK_KHR_xcb_surface]);
976 proc_address!(vkCmdBeginConditionalRenderingEXT, PFN_vkCmdBeginConditionalRenderingEXT, device, unknown);
977 proc_address!(vkCmdBeginDebugUtilsLabelEXT, PFN_vkCmdBeginDebugUtilsLabelEXT, device, unknown);
978 proc_address!(vkCmdBeginRenderPass2KHR, PFN_vkCmdBeginRenderPass2KHR, device, unknown);
979 proc_address!(vkCmdBindShadingRateImageNV, PFN_vkCmdBindShadingRateImageNV, device, unknown);
980 proc_address!(vkCmdDebugMarkerBeginEXT, PFN_vkCmdDebugMarkerBeginEXT, device, unknown);
981 proc_address!(vkCmdDebugMarkerEndEXT, PFN_vkCmdDebugMarkerEndEXT, device, unknown);
982 proc_address!(vkCmdDebugMarkerInsertEXT, PFN_vkCmdDebugMarkerInsertEXT, device, unknown);
983 proc_address!(vkCmdDrawIndexedIndirectCountAMD, PFN_vkCmdDrawIndexedIndirectCountAMD, device, unknown);
984 proc_address!(vkCmdDrawIndexedIndirectCountKHR, PFN_vkCmdDrawIndexedIndirectCountKHR, device, unknown);
985 proc_address!(vkCmdDrawIndirectCountAMD, PFN_vkCmdDrawIndirectCountAMD, device, unknown);
986 proc_address!(vkCmdDrawIndirectCountKHR, PFN_vkCmdDrawIndirectCountKHR, device, unknown);
987 proc_address!(vkCmdDrawMeshTasksIndirectCountNV, PFN_vkCmdDrawMeshTasksIndirectCountNV, device, unknown);
988 proc_address!(vkCmdDrawMeshTasksIndirectNV, PFN_vkCmdDrawMeshTasksIndirectNV, device, unknown);
989 proc_address!(vkCmdDrawMeshTasksNV, PFN_vkCmdDrawMeshTasksNV, device, unknown);
990 proc_address!(vkCmdEndConditionalRenderingEXT, PFN_vkCmdEndConditionalRenderingEXT, device, unknown);
991 proc_address!(vkCmdEndDebugUtilsLabelEXT, PFN_vkCmdEndDebugUtilsLabelEXT, device, unknown);
992 proc_address!(vkCmdEndRenderPass2KHR, PFN_vkCmdEndRenderPass2KHR, device, unknown);
993 proc_address!(vkCmdInsertDebugUtilsLabelEXT, PFN_vkCmdInsertDebugUtilsLabelEXT, device, unknown);
994 proc_address!(vkCmdNextSubpass2KHR, PFN_vkCmdNextSubpass2KHR, device, unknown);
995 proc_address!(vkCmdPushDescriptorSetKHR, PFN_vkCmdPushDescriptorSetKHR, device, unknown);
996 proc_address!(vkCmdPushDescriptorSetWithTemplateKHR, PFN_vkCmdPushDescriptorSetWithTemplateKHR, device, unknown);
997 proc_address!(vkCmdSetCheckpointNV, PFN_vkCmdSetCheckpointNV, device, unknown);
998 proc_address!(vkCmdSetCoarseSampleOrderNV, PFN_vkCmdSetCoarseSampleOrderNV, device, unknown);
999 proc_address!(vkCmdSetDiscardRectangleEXT, PFN_vkCmdSetDiscardRectangleEXT, device, unknown);
1000 proc_address!(vkCmdSetExclusiveScissorNV, PFN_vkCmdSetExclusiveScissorNV, device, unknown);
1001 proc_address!(vkCmdSetSampleLocationsEXT, PFN_vkCmdSetSampleLocationsEXT, device, unknown);
1002 proc_address!(vkCmdSetViewportShadingRatePaletteNV, PFN_vkCmdSetViewportShadingRatePaletteNV, device, unknown);
1003 proc_address!(vkCmdSetViewportWScalingNV, PFN_vkCmdSetViewportWScalingNV, device, unknown);
1004 proc_address!(vkCmdWriteBufferMarkerAMD, PFN_vkCmdWriteBufferMarkerAMD, device, unknown);
1005 proc_address!(vkCreateDebugReportCallbackEXT, PFN_vkCreateDebugReportCallbackEXT, device, unknown);
1006 proc_address!(vkCreateDebugUtilsMessengerEXT, PFN_vkCreateDebugUtilsMessengerEXT, device, unknown);
1007 proc_address!(vkCreateDisplayModeKHR, PFN_vkCreateDisplayModeKHR, device, unknown);
1008 proc_address!(vkCreateDisplayPlaneSurfaceKHR, PFN_vkCreateDisplayPlaneSurfaceKHR, device, unknown);
1009 proc_address!(vkCreateRenderPass2KHR, PFN_vkCreateRenderPass2KHR, device, unknown);
1010 proc_address!(vkCreateSharedSwapchainsKHR, PFN_vkCreateSharedSwapchainsKHR, device, unknown);
1011 proc_address!(vkCreateValidationCacheEXT, PFN_vkCreateValidationCacheEXT, device, unknown);
1012 proc_address!(vkDebugMarkerSetObjectNameEXT, PFN_vkDebugMarkerSetObjectNameEXT, device, unknown);
1013 proc_address!(vkDebugMarkerSetObjectTagEXT, PFN_vkDebugMarkerSetObjectTagEXT, device, unknown);
1014 proc_address!(vkDebugReportCallbackEXT, PFN_vkDebugReportCallbackEXT, device, unknown);
1015 proc_address!(vkDebugReportMessageEXT, PFN_vkDebugReportMessageEXT, device, unknown);
1016 proc_address!(vkDebugUtilsMessengerCallbackEXT, PFN_vkDebugUtilsMessengerCallbackEXT, device, unknown);
1017 proc_address!(vkDestroyDebugReportCallbackEXT, PFN_vkDestroyDebugReportCallbackEXT, device, unknown);
1018 proc_address!(vkDestroyDebugUtilsMessengerEXT, PFN_vkDestroyDebugUtilsMessengerEXT, device, unknown);
1019 proc_address!(vkDestroyValidationCacheEXT, PFN_vkDestroyValidationCacheEXT, device, unknown);
1020 proc_address!(vkDisplayPowerControlEXT, PFN_vkDisplayPowerControlEXT, device, unknown);
1021 proc_address!(vkGetDisplayModeProperties2KHR, PFN_vkGetDisplayModeProperties2KHR, device, unknown);
1022 proc_address!(vkGetDisplayModePropertiesKHR, PFN_vkGetDisplayModePropertiesKHR, device, unknown);
1023 proc_address!(vkGetDisplayPlaneCapabilities2KHR, PFN_vkGetDisplayPlaneCapabilities2KHR, device, unknown);
1024 proc_address!(vkGetDisplayPlaneCapabilitiesKHR, PFN_vkGetDisplayPlaneCapabilitiesKHR, device, unknown);
1025 proc_address!(vkGetDisplayPlaneSupportedDisplaysKHR, PFN_vkGetDisplayPlaneSupportedDisplaysKHR, device, unknown);
1026 proc_address!(vkGetFenceFdKHR, PFN_vkGetFenceFdKHR, device, unknown);
1027 proc_address!(vkGetMemoryFdKHR, PFN_vkGetMemoryFdKHR, device, unknown);
1028 proc_address!(vkGetMemoryFdPropertiesKHR, PFN_vkGetMemoryFdPropertiesKHR, device, unknown);
1029 proc_address!(vkGetMemoryHostPointerPropertiesEXT, PFN_vkGetMemoryHostPointerPropertiesEXT, device, unknown);
1030 proc_address!(vkGetPastPresentationTimingGOOGLE, PFN_vkGetPastPresentationTimingGOOGLE, device, unknown);
1031 proc_address!(vkGetPhysicalDeviceDisplayPlaneProperties2KHR, PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR, device, unknown);
1032 proc_address!(vkGetPhysicalDeviceDisplayPlanePropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR, device, unknown);
1033 proc_address!(vkGetPhysicalDeviceDisplayProperties2KHR, PFN_vkGetPhysicalDeviceDisplayProperties2KHR, device, unknown);
1034 proc_address!(vkGetPhysicalDeviceDisplayPropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPropertiesKHR, device, unknown);
1035 proc_address!(vkGetPhysicalDeviceExternalImageFormatPropertiesNV, PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV, device, unknown);
1036 proc_address!(vkGetPhysicalDeviceMultisamplePropertiesEXT, PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT, device, unknown);
1037 proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2EXT, PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT, device, unknown);
1038 proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2KHR, PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR, device, unknown);
1039 proc_address!(vkGetPhysicalDeviceSurfaceFormats2KHR, PFN_vkGetPhysicalDeviceSurfaceFormats2KHR, device, unknown);
1040 proc_address!(vkGetQueueCheckpointDataNV, PFN_vkGetQueueCheckpointDataNV, device, unknown);
1041 proc_address!(vkGetRefreshCycleDurationGOOGLE, PFN_vkGetRefreshCycleDurationGOOGLE, device, unknown);
1042 proc_address!(vkGetSemaphoreFdKHR, PFN_vkGetSemaphoreFdKHR, device, unknown);
1043 proc_address!(vkGetShaderInfoAMD, PFN_vkGetShaderInfoAMD, device, unknown);
1044 proc_address!(vkGetSwapchainCounterEXT, PFN_vkGetSwapchainCounterEXT, device, unknown);
1045 proc_address!(vkGetSwapchainStatusKHR, PFN_vkGetSwapchainStatusKHR, device, unknown);
1046 proc_address!(vkGetValidationCacheDataEXT, PFN_vkGetValidationCacheDataEXT, device, unknown);
1047 proc_address!(vkImportFenceFdKHR, PFN_vkImportFenceFdKHR, device, unknown);
1048 proc_address!(vkImportSemaphoreFdKHR, PFN_vkImportSemaphoreFdKHR, device, unknown);
1049 proc_address!(vkMergeValidationCachesEXT, PFN_vkMergeValidationCachesEXT, device, unknown);
1050 proc_address!(vkQueueBeginDebugUtilsLabelEXT, PFN_vkQueueBeginDebugUtilsLabelEXT, device, unknown);
1051 proc_address!(vkQueueEndDebugUtilsLabelEXT, PFN_vkQueueEndDebugUtilsLabelEXT, device, unknown);
1052 proc_address!(vkQueueInsertDebugUtilsLabelEXT, PFN_vkQueueInsertDebugUtilsLabelEXT, device, unknown);
1053 proc_address!(vkRegisterDeviceEventEXT, PFN_vkRegisterDeviceEventEXT, device, unknown);
1054 proc_address!(vkRegisterDisplayEventEXT, PFN_vkRegisterDisplayEventEXT, device, unknown);
1055 proc_address!(vkReleaseDisplayEXT, PFN_vkReleaseDisplayEXT, device, unknown);
1056 proc_address!(vkSetDebugUtilsObjectNameEXT, PFN_vkSetDebugUtilsObjectNameEXT, device, unknown);
1057 proc_address!(vkSetDebugUtilsObjectTagEXT, PFN_vkSetDebugUtilsObjectTagEXT, device, unknown);
1058 proc_address!(vkSetHdrMetadataEXT, PFN_vkSetHdrMetadataEXT, device, unknown);
1059 proc_address!(vkSubmitDebugUtilsMessageEXT, PFN_vkSubmitDebugUtilsMessageEXT, device, unknown);
1062 //eprintln!("unknown function: {:?}", name);
1066 #[derive(Debug, Copy, Clone)]
1067 pub struct Features {
1068 features: api::VkPhysicalDeviceFeatures,
1069 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures,
1070 sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures,
1071 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures,
1072 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures,
1073 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures,
1074 multiview_features: api::VkPhysicalDeviceMultiviewFeatures,
1080 features: api::VkPhysicalDeviceFeatures {
1081 robustBufferAccess: api::VK_TRUE,
1082 fullDrawIndexUint32: api::VK_TRUE,
1083 imageCubeArray: api::VK_TRUE,
1084 independentBlend: api::VK_FALSE,
1085 geometryShader: api::VK_FALSE,
1086 tessellationShader: api::VK_FALSE,
1087 sampleRateShading: api::VK_FALSE,
1088 dualSrcBlend: api::VK_FALSE,
1089 logicOp: api::VK_TRUE,
1090 multiDrawIndirect: api::VK_TRUE,
1091 drawIndirectFirstInstance: api::VK_TRUE,
1092 depthClamp: api::VK_FALSE,
1093 depthBiasClamp: api::VK_FALSE,
1094 fillModeNonSolid: api::VK_TRUE,
1095 depthBounds: api::VK_FALSE,
1096 wideLines: api::VK_FALSE,
1097 largePoints: api::VK_FALSE,
1098 alphaToOne: api::VK_TRUE,
1099 multiViewport: api::VK_TRUE,
1100 samplerAnisotropy: api::VK_FALSE,
1101 textureCompressionETC2: api::VK_FALSE, // FIXME: enable texture compression
1102 textureCompressionASTC_LDR: api::VK_FALSE, // FIXME: enable texture compression
1103 textureCompressionBC: api::VK_FALSE, // FIXME: enable texture compression
1104 occlusionQueryPrecise: api::VK_FALSE,
1105 pipelineStatisticsQuery: api::VK_FALSE,
1106 vertexPipelineStoresAndAtomics: api::VK_TRUE,
1107 fragmentStoresAndAtomics: api::VK_TRUE,
1108 shaderTessellationAndGeometryPointSize: api::VK_FALSE,
1109 shaderImageGatherExtended: api::VK_FALSE,
1110 shaderStorageImageExtendedFormats: api::VK_FALSE,
1111 shaderStorageImageMultisample: api::VK_FALSE,
1112 shaderStorageImageReadWithoutFormat: api::VK_FALSE,
1113 shaderStorageImageWriteWithoutFormat: api::VK_FALSE,
1114 shaderUniformBufferArrayDynamicIndexing: api::VK_TRUE,
1115 shaderSampledImageArrayDynamicIndexing: api::VK_TRUE,
1116 shaderStorageBufferArrayDynamicIndexing: api::VK_TRUE,
1117 shaderStorageImageArrayDynamicIndexing: api::VK_TRUE,
1118 shaderClipDistance: api::VK_FALSE,
1119 shaderCullDistance: api::VK_FALSE,
1120 shaderFloat64: api::VK_TRUE,
1121 shaderInt64: api::VK_TRUE,
1122 shaderInt16: api::VK_TRUE,
1123 shaderResourceResidency: api::VK_FALSE,
1124 shaderResourceMinLod: api::VK_FALSE,
1125 sparseBinding: api::VK_FALSE,
1126 sparseResidencyBuffer: api::VK_FALSE,
1127 sparseResidencyImage2D: api::VK_FALSE,
1128 sparseResidencyImage3D: api::VK_FALSE,
1129 sparseResidency2Samples: api::VK_FALSE,
1130 sparseResidency4Samples: api::VK_FALSE,
1131 sparseResidency8Samples: api::VK_FALSE,
1132 sparseResidency16Samples: api::VK_FALSE,
1133 sparseResidencyAliased: api::VK_FALSE,
1134 variableMultisampleRate: api::VK_FALSE,
1135 inheritedQueries: api::VK_FALSE,
1137 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures {
1138 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1140 storageBuffer16BitAccess: api::VK_TRUE,
1141 uniformAndStorageBuffer16BitAccess: api::VK_TRUE,
1142 storagePushConstant16: api::VK_TRUE,
1143 storageInputOutput16: api::VK_TRUE,
1145 sampler_ycbcr_conversion_features:
1146 api::VkPhysicalDeviceSamplerYcbcrConversionFeatures {
1147 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1149 samplerYcbcrConversion: api::VK_FALSE,
1151 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures {
1152 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1154 variablePointersStorageBuffer: api::VK_TRUE,
1155 variablePointers: api::VK_TRUE,
1157 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures {
1158 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1160 shaderDrawParameters: api::VK_TRUE,
1162 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures {
1163 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1165 protectedMemory: api::VK_FALSE,
1167 multiview_features: api::VkPhysicalDeviceMultiviewFeatures {
1168 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1170 multiview: api::VK_FALSE,
1171 multiviewGeometryShader: api::VK_FALSE,
1172 multiviewTessellationShader: api::VK_FALSE,
1176 fn splat(value: bool) -> Self {
1177 let value32 = if value { api::VK_TRUE } else { api::VK_FALSE };
1179 features: api::VkPhysicalDeviceFeatures {
1180 robustBufferAccess: value32,
1181 fullDrawIndexUint32: value32,
1182 imageCubeArray: value32,
1183 independentBlend: value32,
1184 geometryShader: value32,
1185 tessellationShader: value32,
1186 sampleRateShading: value32,
1187 dualSrcBlend: value32,
1189 multiDrawIndirect: value32,
1190 drawIndirectFirstInstance: value32,
1191 depthClamp: value32,
1192 depthBiasClamp: value32,
1193 fillModeNonSolid: value32,
1194 depthBounds: value32,
1196 largePoints: value32,
1197 alphaToOne: value32,
1198 multiViewport: value32,
1199 samplerAnisotropy: value32,
1200 textureCompressionETC2: value32,
1201 textureCompressionASTC_LDR: value32,
1202 textureCompressionBC: value32,
1203 occlusionQueryPrecise: value32,
1204 pipelineStatisticsQuery: value32,
1205 vertexPipelineStoresAndAtomics: value32,
1206 fragmentStoresAndAtomics: value32,
1207 shaderTessellationAndGeometryPointSize: value32,
1208 shaderImageGatherExtended: value32,
1209 shaderStorageImageExtendedFormats: value32,
1210 shaderStorageImageMultisample: value32,
1211 shaderStorageImageReadWithoutFormat: value32,
1212 shaderStorageImageWriteWithoutFormat: value32,
1213 shaderUniformBufferArrayDynamicIndexing: value32,
1214 shaderSampledImageArrayDynamicIndexing: value32,
1215 shaderStorageBufferArrayDynamicIndexing: value32,
1216 shaderStorageImageArrayDynamicIndexing: value32,
1217 shaderClipDistance: value32,
1218 shaderCullDistance: value32,
1219 shaderFloat64: value32,
1220 shaderInt64: value32,
1221 shaderInt16: value32,
1222 shaderResourceResidency: value32,
1223 shaderResourceMinLod: value32,
1224 sparseBinding: value32,
1225 sparseResidencyBuffer: value32,
1226 sparseResidencyImage2D: value32,
1227 sparseResidencyImage3D: value32,
1228 sparseResidency2Samples: value32,
1229 sparseResidency4Samples: value32,
1230 sparseResidency8Samples: value32,
1231 sparseResidency16Samples: value32,
1232 sparseResidencyAliased: value32,
1233 variableMultisampleRate: value32,
1234 inheritedQueries: value32,
1236 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures {
1237 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1239 storageBuffer16BitAccess: value32,
1240 uniformAndStorageBuffer16BitAccess: value32,
1241 storagePushConstant16: value32,
1242 storageInputOutput16: value32,
1244 sampler_ycbcr_conversion_features:
1245 api::VkPhysicalDeviceSamplerYcbcrConversionFeatures {
1246 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1248 samplerYcbcrConversion: value32,
1250 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures {
1251 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1253 variablePointersStorageBuffer: value32,
1254 variablePointers: value32,
1256 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures {
1257 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1259 shaderDrawParameters: value32,
1261 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures {
1262 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1264 protectedMemory: value32,
1266 multiview_features: api::VkPhysicalDeviceMultiviewFeatures {
1267 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1270 multiviewGeometryShader: value32,
1271 multiviewTessellationShader: value32,
1275 fn visit2_mut<F: FnMut(&mut bool, &mut bool)>(&mut self, rhs: &mut Self, f: F) {
1276 struct VisitorStruct<F: FnMut(&mut bool, &mut bool)>(F);
1278 fn visit(&mut self, v1: &mut T, v2: &mut T);
1280 impl<F: FnMut(&mut bool, &mut bool)> Visitor<bool> for VisitorStruct<F> {
1281 fn visit(&mut self, v1: &mut bool, v2: &mut bool) {
1285 impl<F: FnMut(&mut bool, &mut bool)> Visitor<api::VkBool32> for VisitorStruct<F> {
1286 fn visit(&mut self, value1: &mut api::VkBool32, value2: &mut api::VkBool32) {
1287 let mut temp1 = *value1 != api::VK_FALSE;
1288 let mut temp2 = *value2 != api::VK_FALSE;
1289 (self.0)(&mut temp1, &mut temp2);
1290 *value1 = if temp1 { api::VK_TRUE } else { api::VK_FALSE };
1291 *value2 = if temp2 { api::VK_TRUE } else { api::VK_FALSE };
1294 let mut visitor = VisitorStruct(f);
1295 macro_rules! visit {
1296 ($member1:ident.$member2:ident) => {
1297 visitor.visit(&mut self.$member1.$member2, &mut rhs.$member1.$member2)
1299 ($member:ident) => {
1300 visitor.visit(&mut self.$member1, &mut rhs.$member1)
1303 visit!(features.robustBufferAccess);
1304 visit!(features.fullDrawIndexUint32);
1305 visit!(features.imageCubeArray);
1306 visit!(features.independentBlend);
1307 visit!(features.geometryShader);
1308 visit!(features.tessellationShader);
1309 visit!(features.sampleRateShading);
1310 visit!(features.dualSrcBlend);
1311 visit!(features.logicOp);
1312 visit!(features.multiDrawIndirect);
1313 visit!(features.drawIndirectFirstInstance);
1314 visit!(features.depthClamp);
1315 visit!(features.depthBiasClamp);
1316 visit!(features.fillModeNonSolid);
1317 visit!(features.depthBounds);
1318 visit!(features.wideLines);
1319 visit!(features.largePoints);
1320 visit!(features.alphaToOne);
1321 visit!(features.multiViewport);
1322 visit!(features.samplerAnisotropy);
1323 visit!(features.textureCompressionETC2);
1324 visit!(features.textureCompressionASTC_LDR);
1325 visit!(features.textureCompressionBC);
1326 visit!(features.occlusionQueryPrecise);
1327 visit!(features.pipelineStatisticsQuery);
1328 visit!(features.vertexPipelineStoresAndAtomics);
1329 visit!(features.fragmentStoresAndAtomics);
1330 visit!(features.shaderTessellationAndGeometryPointSize);
1331 visit!(features.shaderImageGatherExtended);
1332 visit!(features.shaderStorageImageExtendedFormats);
1333 visit!(features.shaderStorageImageMultisample);
1334 visit!(features.shaderStorageImageReadWithoutFormat);
1335 visit!(features.shaderStorageImageWriteWithoutFormat);
1336 visit!(features.shaderUniformBufferArrayDynamicIndexing);
1337 visit!(features.shaderSampledImageArrayDynamicIndexing);
1338 visit!(features.shaderStorageBufferArrayDynamicIndexing);
1339 visit!(features.shaderStorageImageArrayDynamicIndexing);
1340 visit!(features.shaderClipDistance);
1341 visit!(features.shaderCullDistance);
1342 visit!(features.shaderFloat64);
1343 visit!(features.shaderInt64);
1344 visit!(features.shaderInt16);
1345 visit!(features.shaderResourceResidency);
1346 visit!(features.shaderResourceMinLod);
1347 visit!(features.sparseBinding);
1348 visit!(features.sparseResidencyBuffer);
1349 visit!(features.sparseResidencyImage2D);
1350 visit!(features.sparseResidencyImage3D);
1351 visit!(features.sparseResidency2Samples);
1352 visit!(features.sparseResidency4Samples);
1353 visit!(features.sparseResidency8Samples);
1354 visit!(features.sparseResidency16Samples);
1355 visit!(features.sparseResidencyAliased);
1356 visit!(features.variableMultisampleRate);
1357 visit!(features.inheritedQueries);
1358 visit!(physical_device_16bit_storage_features.storageBuffer16BitAccess);
1359 visit!(physical_device_16bit_storage_features.uniformAndStorageBuffer16BitAccess);
1360 visit!(physical_device_16bit_storage_features.storagePushConstant16);
1361 visit!(physical_device_16bit_storage_features.storageInputOutput16);
1362 visit!(sampler_ycbcr_conversion_features.samplerYcbcrConversion);
1363 visit!(variable_pointer_features.variablePointersStorageBuffer);
1364 visit!(variable_pointer_features.variablePointers);
1365 visit!(shader_draw_parameter_features.shaderDrawParameters);
1366 visit!(protected_memory_features.protectedMemory);
1367 visit!(multiview_features.multiview);
1368 visit!(multiview_features.multiviewGeometryShader);
1369 visit!(multiview_features.multiviewTessellationShader);
1371 fn visit2<F: FnMut(bool, bool)>(mut self, mut rhs: Self, mut f: F) {
1372 self.visit2_mut(&mut rhs, |v1, v2| f(*v1, *v2));
1374 fn visit_mut<F: FnMut(&mut bool)>(&mut self, mut f: F) {
1375 let mut rhs = *self;
1376 self.visit2_mut(&mut rhs, |v, _| f(v));
1378 fn visit<F: FnMut(bool)>(mut self, mut f: F) {
1379 self.visit_mut(|v| f(*v));
1383 trait ImportExportFeatureSet<T> {
1384 fn import_feature_set(&mut self, features: &T);
1385 fn export_feature_set(&self, features: &mut T);
1388 impl ImportExportFeatureSet<api::VkPhysicalDeviceFeatures> for Features {
1389 fn import_feature_set(&mut self, features: &api::VkPhysicalDeviceFeatures) {
1390 self.features = *features;
1392 fn export_feature_set(&self, features: &mut api::VkPhysicalDeviceFeatures) {
1393 *features = self.features;
1397 impl ImportExportFeatureSet<api::VkPhysicalDeviceFeatures2> for Features {
1398 fn import_feature_set(&mut self, features: &api::VkPhysicalDeviceFeatures2) {
1399 self.features = features.features;
1401 fn export_feature_set(&self, features: &mut api::VkPhysicalDeviceFeatures2) {
1402 features.features = self.features;
1406 macro_rules! impl_import_export_feature_set {
1407 ($type:ident, $member:ident) => {
1408 impl ImportExportFeatureSet<api::$type> for Features {
1409 fn import_feature_set(&mut self, features: &api::$type) {
1410 self.$member = api::$type {
1411 sType: self.$member.sType,
1412 pNext: self.$member.pNext,
1416 fn export_feature_set(&self, features: &mut api::$type) {
1417 *features = api::$type {
1418 sType: features.sType,
1419 pNext: features.pNext,
1427 impl_import_export_feature_set!(
1428 VkPhysicalDevice16BitStorageFeatures,
1429 physical_device_16bit_storage_features
1432 impl_import_export_feature_set!(
1433 VkPhysicalDeviceSamplerYcbcrConversionFeatures,
1434 sampler_ycbcr_conversion_features
1437 impl_import_export_feature_set!(
1438 VkPhysicalDeviceVariablePointerFeatures,
1439 variable_pointer_features
1442 impl_import_export_feature_set!(
1443 VkPhysicalDeviceShaderDrawParameterFeatures,
1444 shader_draw_parameter_features
1447 impl_import_export_feature_set!(
1448 VkPhysicalDeviceProtectedMemoryFeatures,
1449 protected_memory_features
1452 impl_import_export_feature_set!(VkPhysicalDeviceMultiviewFeatures, multiview_features);
1454 impl Eq for Features {}
1456 impl PartialEq for Features {
1457 fn eq(&self, rhs: &Self) -> bool {
1458 let mut equal = true;
1459 self.visit2(*rhs, |a, b| equal &= a == b);
1464 impl BitAndAssign for Features {
1465 fn bitand_assign(&mut self, mut rhs: Self) {
1466 self.visit2_mut(&mut rhs, |l, r| *l &= *r);
1470 impl BitOrAssign for Features {
1471 fn bitor_assign(&mut self, mut rhs: Self) {
1472 self.visit2_mut(&mut rhs, |l, r| *l |= *r);
1476 impl BitXorAssign for Features {
1477 fn bitxor_assign(&mut self, mut rhs: Self) {
1478 self.visit2_mut(&mut rhs, |l, r| *l ^= *r);
1482 impl BitAnd for Features {
1484 fn bitand(mut self, rhs: Self) -> Self {
1490 impl BitOr for Features {
1492 fn bitor(mut self, rhs: Self) -> Self {
1498 impl BitXor for Features {
1500 fn bitxor(mut self, rhs: Self) -> Self {
1506 impl Not for Features {
1508 fn not(mut self) -> Self {
1509 self.visit_mut(|v| *v = !*v);
1517 physical_device: SharedHandle<api::VkPhysicalDevice>,
1518 extensions: Extensions,
1520 queues: Vec<Vec<OwnedHandle<api::VkQueue>>>,
1525 physical_device: SharedHandle<api::VkPhysicalDevice>,
1526 create_info: *const api::VkDeviceCreateInfo,
1527 ) -> Result<OwnedHandle<api::VkDevice>, api::VkResult> {
1528 parse_next_chain_const!{
1530 root = api::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
1531 device_group_device_create_info: api::VkDeviceGroupDeviceCreateInfo = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO,
1532 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1533 physical_device_features_2: api::VkPhysicalDeviceFeatures2 = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
1534 physical_device_multiview_features: api::VkPhysicalDeviceMultiviewFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1535 physical_device_protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1536 physical_device_sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1537 physical_device_shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1538 physical_device_variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1540 let ref create_info = *create_info;
1541 if create_info.enabledLayerCount != 0 {
1542 return Err(api::VK_ERROR_LAYER_NOT_PRESENT);
1544 let mut enabled_extensions = physical_device.enabled_extensions;
1545 if create_info.enabledExtensionCount != 0 {
1546 for &extension_name in slice::from_raw_parts(
1547 create_info.ppEnabledExtensionNames,
1548 create_info.enabledExtensionCount as usize,
1550 let extension: Extension = CStr::from_ptr(extension_name)
1552 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?
1554 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?;
1555 assert_eq!(extension.get_scope(), ExtensionScope::Device);
1556 enabled_extensions[extension] = true;
1559 for extension in enabled_extensions
1561 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
1563 let missing_extensions = extension.get_required_extensions() & !enabled_extensions;
1564 for missing_extension in missing_extensions
1566 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
1569 "extension {} enabled but required extension {} is not enabled",
1570 extension.get_name(),
1571 missing_extension.get_name()
1575 let mut selected_features = Features::splat(false);
1576 if !device_group_device_create_info.is_null() {
1577 let api::VkDeviceGroupDeviceCreateInfo {
1580 physicalDeviceCount: physical_device_count,
1581 pPhysicalDevices: physical_devices,
1582 } = *device_group_device_create_info;
1584 physical_device_count, 1,
1585 "multiple devices in a group are not implemented"
1589 physical_device.get_handle(),
1590 "unknown physical_device"
1593 if !physical_device_16bit_storage_features.is_null() {
1594 selected_features.import_feature_set(&*physical_device_16bit_storage_features);
1596 if !physical_device_features_2.is_null() {
1597 selected_features.import_feature_set(&*physical_device_features_2);
1598 } else if !create_info.pEnabledFeatures.is_null() {
1599 selected_features.import_feature_set(&*create_info.pEnabledFeatures);
1601 if !physical_device_multiview_features.is_null() {
1602 selected_features.import_feature_set(&*physical_device_multiview_features);
1604 if !physical_device_protected_memory_features.is_null() {
1605 selected_features.import_feature_set(&*physical_device_protected_memory_features);
1607 if !physical_device_sampler_ycbcr_conversion_features.is_null() {
1609 .import_feature_set(&*physical_device_sampler_ycbcr_conversion_features);
1611 if !physical_device_shader_draw_parameter_features.is_null() {
1612 selected_features.import_feature_set(&*physical_device_shader_draw_parameter_features);
1613 } else if enabled_extensions[Extension::VK_KHR_shader_draw_parameters] {
1615 .shader_draw_parameter_features
1616 .shaderDrawParameters = api::VK_TRUE;
1618 if !physical_device_variable_pointer_features.is_null() {
1619 selected_features.import_feature_set(&*physical_device_variable_pointer_features);
1621 if (selected_features & !physical_device.features) != Features::splat(false) {
1622 return Err(api::VK_ERROR_FEATURE_NOT_PRESENT);
1624 assert_ne!(create_info.queueCreateInfoCount, 0);
1625 let queue_create_infos = slice::from_raw_parts(
1626 create_info.pQueueCreateInfos,
1627 create_info.queueCreateInfoCount as usize,
1629 assert!(queue_create_infos.len() <= QUEUE_FAMILY_COUNT as usize);
1630 let mut total_queue_count = 0;
1631 let mut queue_counts: Vec<_> = Vec::new();
1632 for queue_create_info in queue_create_infos {
1633 parse_next_chain_const!{
1634 queue_create_info as *const api::VkDeviceQueueCreateInfo,
1635 root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
1637 let api::VkDeviceQueueCreateInfo {
1641 queueFamilyIndex: queue_family_index,
1642 queueCount: queue_count,
1643 pQueuePriorities: queue_priorities,
1644 } = *queue_create_info;
1645 assert_eq!(flags & api::VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT, 0);
1646 assert!(queue_family_index < QUEUE_FAMILY_COUNT);
1647 assert!(queue_count <= QUEUE_COUNTS[queue_family_index as usize]);
1648 let queue_priorities = slice::from_raw_parts(queue_priorities, queue_count as usize);
1649 for &queue_priority in queue_priorities {
1650 assert!(queue_priority >= 0.0 && queue_priority <= 1.0);
1652 assert_eq!(QUEUE_FAMILY_COUNT, 1, "multiple queues are not implemented");
1654 QUEUE_COUNTS, [1; QUEUE_FAMILY_COUNT as usize],
1655 "multiple queues are not implemented"
1657 queue_counts.push(queue_count as usize);
1658 total_queue_count += queue_count as usize;
1660 assert!(total_queue_count <= TOTAL_QUEUE_COUNT);
1661 let mut queues = Vec::new();
1662 for queue_count in queue_counts {
1663 let mut queue_family_queues = Vec::new();
1664 for _queue_index in 0..queue_count {
1665 queue_family_queues.push(OwnedHandle::<api::VkQueue>::new(Queue {}));
1667 queues.push(queue_family_queues);
1669 Ok(OwnedHandle::<api::VkDevice>::new(Device {
1671 extensions: enabled_extensions,
1672 features: selected_features,
1678 pub struct PhysicalDevice {
1679 enabled_extensions: Extensions,
1680 allowed_extensions: Extensions,
1681 properties: api::VkPhysicalDeviceProperties,
1683 system_memory_size: u64,
1684 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties,
1685 multiview_properties: api::VkPhysicalDeviceMultiviewProperties,
1686 id_properties: api::VkPhysicalDeviceIDProperties,
1687 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties,
1688 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties,
1689 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties,
1692 impl PhysicalDevice {
1693 pub fn get_pipeline_cache_uuid() -> uuid::Uuid {
1694 // FIXME: return real uuid
1697 pub fn get_device_uuid() -> uuid::Uuid {
1698 // FIXME: return real uuid
1701 pub fn get_driver_uuid() -> uuid::Uuid {
1702 // FIXME: return real uuid
1705 pub fn get_limits() -> api::VkPhysicalDeviceLimits {
1706 api::VkPhysicalDeviceLimits {
1707 maxImageDimension1D: !0,
1708 maxImageDimension2D: !0,
1709 maxImageDimension3D: !0,
1710 maxImageDimensionCube: !0,
1711 maxImageArrayLayers: !0,
1712 maxTexelBufferElements: !0,
1713 maxUniformBufferRange: !0,
1714 maxStorageBufferRange: !0,
1715 maxPushConstantsSize: !0,
1716 maxMemoryAllocationCount: !0,
1717 maxSamplerAllocationCount: !0,
1718 bufferImageGranularity: 1,
1719 sparseAddressSpaceSize: 0,
1720 maxBoundDescriptorSets: !0,
1721 maxPerStageDescriptorSamplers: !0,
1722 maxPerStageDescriptorUniformBuffers: !0,
1723 maxPerStageDescriptorStorageBuffers: !0,
1724 maxPerStageDescriptorSampledImages: !0,
1725 maxPerStageDescriptorStorageImages: !0,
1726 maxPerStageDescriptorInputAttachments: !0,
1727 maxPerStageResources: !0,
1728 maxDescriptorSetSamplers: !0,
1729 maxDescriptorSetUniformBuffers: !0,
1730 maxDescriptorSetUniformBuffersDynamic: !0,
1731 maxDescriptorSetStorageBuffers: !0,
1732 maxDescriptorSetStorageBuffersDynamic: !0,
1733 maxDescriptorSetSampledImages: !0,
1734 maxDescriptorSetStorageImages: !0,
1735 maxDescriptorSetInputAttachments: !0,
1736 maxVertexInputAttributes: !0,
1737 maxVertexInputBindings: !0,
1738 maxVertexInputAttributeOffset: !0,
1739 maxVertexInputBindingStride: !0,
1740 maxVertexOutputComponents: !0,
1741 maxTessellationGenerationLevel: 0,
1742 maxTessellationPatchSize: 0,
1743 maxTessellationControlPerVertexInputComponents: 0,
1744 maxTessellationControlPerVertexOutputComponents: 0,
1745 maxTessellationControlPerPatchOutputComponents: 0,
1746 maxTessellationControlTotalOutputComponents: 0,
1747 maxTessellationEvaluationInputComponents: 0,
1748 maxTessellationEvaluationOutputComponents: 0,
1749 maxGeometryShaderInvocations: 0,
1750 maxGeometryInputComponents: 0,
1751 maxGeometryOutputComponents: 0,
1752 maxGeometryOutputVertices: 0,
1753 maxGeometryTotalOutputComponents: 0,
1754 maxFragmentInputComponents: !0,
1755 maxFragmentOutputAttachments: !0,
1756 maxFragmentDualSrcAttachments: 0,
1757 maxFragmentCombinedOutputResources: !0,
1758 maxComputeSharedMemorySize: !0,
1759 maxComputeWorkGroupCount: [!0; 3],
1760 maxComputeWorkGroupInvocations: !0,
1761 maxComputeWorkGroupSize: [!0; 3],
1762 subPixelPrecisionBits: 4, // FIXME: update to correct value
1763 subTexelPrecisionBits: 4, // FIXME: update to correct value
1764 mipmapPrecisionBits: 4, // FIXME: update to correct value
1765 maxDrawIndexedIndexValue: !0,
1766 maxDrawIndirectCount: !0,
1767 maxSamplerLodBias: 2.0, // FIXME: update to correct value
1768 maxSamplerAnisotropy: 1.0,
1770 maxViewportDimensions: [4096; 2], // FIXME: update to correct value
1771 viewportBoundsRange: [-8192.0, 8191.0], // FIXME: update to correct value
1772 viewportSubPixelBits: 0,
1773 minMemoryMapAlignment: MIN_MEMORY_MAP_ALIGNMENT,
1774 minTexelBufferOffsetAlignment: 64, // FIXME: update to correct value
1775 minUniformBufferOffsetAlignment: 64, // FIXME: update to correct value
1776 minStorageBufferOffsetAlignment: 64, // FIXME: update to correct value
1777 minTexelOffset: -8, // FIXME: update to correct value
1778 maxTexelOffset: 7, // FIXME: update to correct value
1779 minTexelGatherOffset: 0,
1780 maxTexelGatherOffset: 0,
1781 minInterpolationOffset: 0.0,
1782 maxInterpolationOffset: 0.0,
1783 subPixelInterpolationOffsetBits: 0,
1784 maxFramebufferWidth: 4096, // FIXME: update to correct value
1785 maxFramebufferHeight: 4096, // FIXME: update to correct value
1786 maxFramebufferLayers: 256, // FIXME: update to correct value
1787 framebufferColorSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1788 framebufferDepthSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1789 framebufferStencilSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1790 framebufferNoAttachmentsSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1791 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1792 maxColorAttachments: 4,
1793 sampledImageColorSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1794 sampledImageIntegerSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1795 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1796 sampledImageDepthSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1797 sampledImageStencilSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1798 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1799 storageImageSampleCounts: api::VK_SAMPLE_COUNT_1_BIT, // FIXME: update to correct value
1800 maxSampleMaskWords: 1,
1801 timestampComputeAndGraphics: api::VK_FALSE,
1802 timestampPeriod: 0.0,
1803 maxClipDistances: 0,
1804 maxCullDistances: 0,
1805 maxCombinedClipAndCullDistances: 0,
1806 discreteQueuePriorities: 2,
1807 pointSizeRange: [1.0; 2],
1808 lineWidthRange: [1.0; 2],
1809 pointSizeGranularity: 0.0,
1810 lineWidthGranularity: 0.0,
1811 strictLines: api::VK_FALSE,
1812 standardSampleLocations: api::VK_TRUE,
1813 optimalBufferCopyOffsetAlignment: 16,
1814 optimalBufferCopyRowPitchAlignment: 16,
1815 nonCoherentAtomSize: 1, //TODO: check if this is correct
1818 pub fn get_format_properties(format: api::VkFormat) -> api::VkFormatProperties {
1820 api::VK_FORMAT_UNDEFINED => api::VkFormatProperties {
1821 linearTilingFeatures: 0,
1822 optimalTilingFeatures: 0,
1825 api::VK_FORMAT_R4G4_UNORM_PACK8 => api::VkFormatProperties {
1827 linearTilingFeatures: 0,
1828 optimalTilingFeatures: 0,
1831 api::VK_FORMAT_R4G4B4A4_UNORM_PACK16 => api::VkFormatProperties {
1833 linearTilingFeatures: 0,
1834 optimalTilingFeatures: 0,
1837 api::VK_FORMAT_B4G4R4A4_UNORM_PACK16 => api::VkFormatProperties {
1839 linearTilingFeatures: 0,
1840 optimalTilingFeatures: 0,
1843 api::VK_FORMAT_R5G6B5_UNORM_PACK16 => api::VkFormatProperties {
1845 linearTilingFeatures: 0,
1846 optimalTilingFeatures: 0,
1849 api::VK_FORMAT_B5G6R5_UNORM_PACK16 => api::VkFormatProperties {
1851 linearTilingFeatures: 0,
1852 optimalTilingFeatures: 0,
1855 api::VK_FORMAT_R5G5B5A1_UNORM_PACK16 => api::VkFormatProperties {
1857 linearTilingFeatures: 0,
1858 optimalTilingFeatures: 0,
1861 api::VK_FORMAT_B5G5R5A1_UNORM_PACK16 => api::VkFormatProperties {
1863 linearTilingFeatures: 0,
1864 optimalTilingFeatures: 0,
1867 api::VK_FORMAT_A1R5G5B5_UNORM_PACK16 => api::VkFormatProperties {
1869 linearTilingFeatures: 0,
1870 optimalTilingFeatures: 0,
1873 api::VK_FORMAT_R8_UNORM => api::VkFormatProperties {
1875 linearTilingFeatures: 0,
1876 optimalTilingFeatures: 0,
1879 api::VK_FORMAT_R8_SNORM => api::VkFormatProperties {
1881 linearTilingFeatures: 0,
1882 optimalTilingFeatures: 0,
1885 api::VK_FORMAT_R8_USCALED => api::VkFormatProperties {
1887 linearTilingFeatures: 0,
1888 optimalTilingFeatures: 0,
1891 api::VK_FORMAT_R8_SSCALED => api::VkFormatProperties {
1893 linearTilingFeatures: 0,
1894 optimalTilingFeatures: 0,
1897 api::VK_FORMAT_R8_UINT => api::VkFormatProperties {
1899 linearTilingFeatures: 0,
1900 optimalTilingFeatures: 0,
1903 api::VK_FORMAT_R8_SINT => api::VkFormatProperties {
1905 linearTilingFeatures: 0,
1906 optimalTilingFeatures: 0,
1909 api::VK_FORMAT_R8_SRGB => api::VkFormatProperties {
1911 linearTilingFeatures: 0,
1912 optimalTilingFeatures: 0,
1915 api::VK_FORMAT_R8G8_UNORM => api::VkFormatProperties {
1917 linearTilingFeatures: 0,
1918 optimalTilingFeatures: 0,
1921 api::VK_FORMAT_R8G8_SNORM => api::VkFormatProperties {
1923 linearTilingFeatures: 0,
1924 optimalTilingFeatures: 0,
1927 api::VK_FORMAT_R8G8_USCALED => api::VkFormatProperties {
1929 linearTilingFeatures: 0,
1930 optimalTilingFeatures: 0,
1933 api::VK_FORMAT_R8G8_SSCALED => api::VkFormatProperties {
1935 linearTilingFeatures: 0,
1936 optimalTilingFeatures: 0,
1939 api::VK_FORMAT_R8G8_UINT => api::VkFormatProperties {
1941 linearTilingFeatures: 0,
1942 optimalTilingFeatures: 0,
1945 api::VK_FORMAT_R8G8_SINT => api::VkFormatProperties {
1947 linearTilingFeatures: 0,
1948 optimalTilingFeatures: 0,
1951 api::VK_FORMAT_R8G8_SRGB => api::VkFormatProperties {
1953 linearTilingFeatures: 0,
1954 optimalTilingFeatures: 0,
1957 api::VK_FORMAT_R8G8B8_UNORM => api::VkFormatProperties {
1959 linearTilingFeatures: 0,
1960 optimalTilingFeatures: 0,
1963 api::VK_FORMAT_R8G8B8_SNORM => api::VkFormatProperties {
1965 linearTilingFeatures: 0,
1966 optimalTilingFeatures: 0,
1969 api::VK_FORMAT_R8G8B8_USCALED => api::VkFormatProperties {
1971 linearTilingFeatures: 0,
1972 optimalTilingFeatures: 0,
1975 api::VK_FORMAT_R8G8B8_SSCALED => api::VkFormatProperties {
1977 linearTilingFeatures: 0,
1978 optimalTilingFeatures: 0,
1981 api::VK_FORMAT_R8G8B8_UINT => api::VkFormatProperties {
1983 linearTilingFeatures: 0,
1984 optimalTilingFeatures: 0,
1987 api::VK_FORMAT_R8G8B8_SINT => api::VkFormatProperties {
1989 linearTilingFeatures: 0,
1990 optimalTilingFeatures: 0,
1993 api::VK_FORMAT_R8G8B8_SRGB => api::VkFormatProperties {
1995 linearTilingFeatures: 0,
1996 optimalTilingFeatures: 0,
1999 api::VK_FORMAT_B8G8R8_UNORM => api::VkFormatProperties {
2001 linearTilingFeatures: 0,
2002 optimalTilingFeatures: 0,
2005 api::VK_FORMAT_B8G8R8_SNORM => api::VkFormatProperties {
2007 linearTilingFeatures: 0,
2008 optimalTilingFeatures: 0,
2011 api::VK_FORMAT_B8G8R8_USCALED => api::VkFormatProperties {
2013 linearTilingFeatures: 0,
2014 optimalTilingFeatures: 0,
2017 api::VK_FORMAT_B8G8R8_SSCALED => api::VkFormatProperties {
2019 linearTilingFeatures: 0,
2020 optimalTilingFeatures: 0,
2023 api::VK_FORMAT_B8G8R8_UINT => api::VkFormatProperties {
2025 linearTilingFeatures: 0,
2026 optimalTilingFeatures: 0,
2029 api::VK_FORMAT_B8G8R8_SINT => api::VkFormatProperties {
2031 linearTilingFeatures: 0,
2032 optimalTilingFeatures: 0,
2035 api::VK_FORMAT_B8G8R8_SRGB => api::VkFormatProperties {
2037 linearTilingFeatures: 0,
2038 optimalTilingFeatures: 0,
2041 api::VK_FORMAT_R8G8B8A8_UNORM => api::VkFormatProperties {
2043 linearTilingFeatures: 0,
2044 optimalTilingFeatures: 0,
2047 api::VK_FORMAT_R8G8B8A8_SNORM => api::VkFormatProperties {
2049 linearTilingFeatures: 0,
2050 optimalTilingFeatures: 0,
2053 api::VK_FORMAT_R8G8B8A8_USCALED => api::VkFormatProperties {
2055 linearTilingFeatures: 0,
2056 optimalTilingFeatures: 0,
2059 api::VK_FORMAT_R8G8B8A8_SSCALED => api::VkFormatProperties {
2061 linearTilingFeatures: 0,
2062 optimalTilingFeatures: 0,
2065 api::VK_FORMAT_R8G8B8A8_UINT => api::VkFormatProperties {
2067 linearTilingFeatures: 0,
2068 optimalTilingFeatures: 0,
2071 api::VK_FORMAT_R8G8B8A8_SINT => api::VkFormatProperties {
2073 linearTilingFeatures: 0,
2074 optimalTilingFeatures: 0,
2077 api::VK_FORMAT_R8G8B8A8_SRGB => api::VkFormatProperties {
2079 linearTilingFeatures: 0,
2080 optimalTilingFeatures: 0,
2083 api::VK_FORMAT_B8G8R8A8_UNORM => api::VkFormatProperties {
2085 linearTilingFeatures: 0,
2086 optimalTilingFeatures: 0,
2089 api::VK_FORMAT_B8G8R8A8_SNORM => api::VkFormatProperties {
2091 linearTilingFeatures: 0,
2092 optimalTilingFeatures: 0,
2095 api::VK_FORMAT_B8G8R8A8_USCALED => api::VkFormatProperties {
2097 linearTilingFeatures: 0,
2098 optimalTilingFeatures: 0,
2101 api::VK_FORMAT_B8G8R8A8_SSCALED => api::VkFormatProperties {
2103 linearTilingFeatures: 0,
2104 optimalTilingFeatures: 0,
2107 api::VK_FORMAT_B8G8R8A8_UINT => api::VkFormatProperties {
2109 linearTilingFeatures: 0,
2110 optimalTilingFeatures: 0,
2113 api::VK_FORMAT_B8G8R8A8_SINT => api::VkFormatProperties {
2115 linearTilingFeatures: 0,
2116 optimalTilingFeatures: 0,
2119 api::VK_FORMAT_B8G8R8A8_SRGB => api::VkFormatProperties {
2121 linearTilingFeatures: 0,
2122 optimalTilingFeatures: 0,
2125 api::VK_FORMAT_A8B8G8R8_UNORM_PACK32 => api::VkFormatProperties {
2127 linearTilingFeatures: 0,
2128 optimalTilingFeatures: 0,
2131 api::VK_FORMAT_A8B8G8R8_SNORM_PACK32 => api::VkFormatProperties {
2133 linearTilingFeatures: 0,
2134 optimalTilingFeatures: 0,
2137 api::VK_FORMAT_A8B8G8R8_USCALED_PACK32 => api::VkFormatProperties {
2139 linearTilingFeatures: 0,
2140 optimalTilingFeatures: 0,
2143 api::VK_FORMAT_A8B8G8R8_SSCALED_PACK32 => api::VkFormatProperties {
2145 linearTilingFeatures: 0,
2146 optimalTilingFeatures: 0,
2149 api::VK_FORMAT_A8B8G8R8_UINT_PACK32 => api::VkFormatProperties {
2151 linearTilingFeatures: 0,
2152 optimalTilingFeatures: 0,
2155 api::VK_FORMAT_A8B8G8R8_SINT_PACK32 => api::VkFormatProperties {
2157 linearTilingFeatures: 0,
2158 optimalTilingFeatures: 0,
2161 api::VK_FORMAT_A8B8G8R8_SRGB_PACK32 => api::VkFormatProperties {
2163 linearTilingFeatures: 0,
2164 optimalTilingFeatures: 0,
2167 api::VK_FORMAT_A2R10G10B10_UNORM_PACK32 => api::VkFormatProperties {
2169 linearTilingFeatures: 0,
2170 optimalTilingFeatures: 0,
2173 api::VK_FORMAT_A2R10G10B10_SNORM_PACK32 => api::VkFormatProperties {
2175 linearTilingFeatures: 0,
2176 optimalTilingFeatures: 0,
2179 api::VK_FORMAT_A2R10G10B10_USCALED_PACK32 => api::VkFormatProperties {
2181 linearTilingFeatures: 0,
2182 optimalTilingFeatures: 0,
2185 api::VK_FORMAT_A2R10G10B10_SSCALED_PACK32 => api::VkFormatProperties {
2187 linearTilingFeatures: 0,
2188 optimalTilingFeatures: 0,
2191 api::VK_FORMAT_A2R10G10B10_UINT_PACK32 => api::VkFormatProperties {
2193 linearTilingFeatures: 0,
2194 optimalTilingFeatures: 0,
2197 api::VK_FORMAT_A2R10G10B10_SINT_PACK32 => api::VkFormatProperties {
2199 linearTilingFeatures: 0,
2200 optimalTilingFeatures: 0,
2203 api::VK_FORMAT_A2B10G10R10_UNORM_PACK32 => api::VkFormatProperties {
2205 linearTilingFeatures: 0,
2206 optimalTilingFeatures: 0,
2209 api::VK_FORMAT_A2B10G10R10_SNORM_PACK32 => api::VkFormatProperties {
2211 linearTilingFeatures: 0,
2212 optimalTilingFeatures: 0,
2215 api::VK_FORMAT_A2B10G10R10_USCALED_PACK32 => api::VkFormatProperties {
2217 linearTilingFeatures: 0,
2218 optimalTilingFeatures: 0,
2221 api::VK_FORMAT_A2B10G10R10_SSCALED_PACK32 => api::VkFormatProperties {
2223 linearTilingFeatures: 0,
2224 optimalTilingFeatures: 0,
2227 api::VK_FORMAT_A2B10G10R10_UINT_PACK32 => api::VkFormatProperties {
2229 linearTilingFeatures: 0,
2230 optimalTilingFeatures: 0,
2233 api::VK_FORMAT_A2B10G10R10_SINT_PACK32 => api::VkFormatProperties {
2235 linearTilingFeatures: 0,
2236 optimalTilingFeatures: 0,
2239 api::VK_FORMAT_R16_UNORM => api::VkFormatProperties {
2241 linearTilingFeatures: 0,
2242 optimalTilingFeatures: 0,
2245 api::VK_FORMAT_R16_SNORM => api::VkFormatProperties {
2247 linearTilingFeatures: 0,
2248 optimalTilingFeatures: 0,
2251 api::VK_FORMAT_R16_USCALED => api::VkFormatProperties {
2253 linearTilingFeatures: 0,
2254 optimalTilingFeatures: 0,
2257 api::VK_FORMAT_R16_SSCALED => api::VkFormatProperties {
2259 linearTilingFeatures: 0,
2260 optimalTilingFeatures: 0,
2263 api::VK_FORMAT_R16_UINT => api::VkFormatProperties {
2265 linearTilingFeatures: 0,
2266 optimalTilingFeatures: 0,
2269 api::VK_FORMAT_R16_SINT => api::VkFormatProperties {
2271 linearTilingFeatures: 0,
2272 optimalTilingFeatures: 0,
2275 api::VK_FORMAT_R16_SFLOAT => api::VkFormatProperties {
2277 linearTilingFeatures: 0,
2278 optimalTilingFeatures: 0,
2281 api::VK_FORMAT_R16G16_UNORM => api::VkFormatProperties {
2283 linearTilingFeatures: 0,
2284 optimalTilingFeatures: 0,
2287 api::VK_FORMAT_R16G16_SNORM => api::VkFormatProperties {
2289 linearTilingFeatures: 0,
2290 optimalTilingFeatures: 0,
2293 api::VK_FORMAT_R16G16_USCALED => api::VkFormatProperties {
2295 linearTilingFeatures: 0,
2296 optimalTilingFeatures: 0,
2299 api::VK_FORMAT_R16G16_SSCALED => api::VkFormatProperties {
2301 linearTilingFeatures: 0,
2302 optimalTilingFeatures: 0,
2305 api::VK_FORMAT_R16G16_UINT => api::VkFormatProperties {
2307 linearTilingFeatures: 0,
2308 optimalTilingFeatures: 0,
2311 api::VK_FORMAT_R16G16_SINT => api::VkFormatProperties {
2313 linearTilingFeatures: 0,
2314 optimalTilingFeatures: 0,
2317 api::VK_FORMAT_R16G16_SFLOAT => api::VkFormatProperties {
2319 linearTilingFeatures: 0,
2320 optimalTilingFeatures: 0,
2323 api::VK_FORMAT_R16G16B16_UNORM => api::VkFormatProperties {
2325 linearTilingFeatures: 0,
2326 optimalTilingFeatures: 0,
2329 api::VK_FORMAT_R16G16B16_SNORM => api::VkFormatProperties {
2331 linearTilingFeatures: 0,
2332 optimalTilingFeatures: 0,
2335 api::VK_FORMAT_R16G16B16_USCALED => api::VkFormatProperties {
2337 linearTilingFeatures: 0,
2338 optimalTilingFeatures: 0,
2341 api::VK_FORMAT_R16G16B16_SSCALED => api::VkFormatProperties {
2343 linearTilingFeatures: 0,
2344 optimalTilingFeatures: 0,
2347 api::VK_FORMAT_R16G16B16_UINT => api::VkFormatProperties {
2349 linearTilingFeatures: 0,
2350 optimalTilingFeatures: 0,
2353 api::VK_FORMAT_R16G16B16_SINT => api::VkFormatProperties {
2355 linearTilingFeatures: 0,
2356 optimalTilingFeatures: 0,
2359 api::VK_FORMAT_R16G16B16_SFLOAT => api::VkFormatProperties {
2361 linearTilingFeatures: 0,
2362 optimalTilingFeatures: 0,
2365 api::VK_FORMAT_R16G16B16A16_UNORM => api::VkFormatProperties {
2367 linearTilingFeatures: 0,
2368 optimalTilingFeatures: 0,
2371 api::VK_FORMAT_R16G16B16A16_SNORM => api::VkFormatProperties {
2373 linearTilingFeatures: 0,
2374 optimalTilingFeatures: 0,
2377 api::VK_FORMAT_R16G16B16A16_USCALED => api::VkFormatProperties {
2379 linearTilingFeatures: 0,
2380 optimalTilingFeatures: 0,
2383 api::VK_FORMAT_R16G16B16A16_SSCALED => api::VkFormatProperties {
2385 linearTilingFeatures: 0,
2386 optimalTilingFeatures: 0,
2389 api::VK_FORMAT_R16G16B16A16_UINT => api::VkFormatProperties {
2391 linearTilingFeatures: 0,
2392 optimalTilingFeatures: 0,
2395 api::VK_FORMAT_R16G16B16A16_SINT => api::VkFormatProperties {
2397 linearTilingFeatures: 0,
2398 optimalTilingFeatures: 0,
2401 api::VK_FORMAT_R16G16B16A16_SFLOAT => api::VkFormatProperties {
2403 linearTilingFeatures: 0,
2404 optimalTilingFeatures: 0,
2407 api::VK_FORMAT_R32_UINT => api::VkFormatProperties {
2409 linearTilingFeatures: 0,
2410 optimalTilingFeatures: 0,
2413 api::VK_FORMAT_R32_SINT => api::VkFormatProperties {
2415 linearTilingFeatures: 0,
2416 optimalTilingFeatures: 0,
2419 api::VK_FORMAT_R32_SFLOAT => api::VkFormatProperties {
2421 linearTilingFeatures: 0,
2422 optimalTilingFeatures: 0,
2425 api::VK_FORMAT_R32G32_UINT => api::VkFormatProperties {
2427 linearTilingFeatures: 0,
2428 optimalTilingFeatures: 0,
2431 api::VK_FORMAT_R32G32_SINT => api::VkFormatProperties {
2433 linearTilingFeatures: 0,
2434 optimalTilingFeatures: 0,
2437 api::VK_FORMAT_R32G32_SFLOAT => api::VkFormatProperties {
2439 linearTilingFeatures: 0,
2440 optimalTilingFeatures: 0,
2443 api::VK_FORMAT_R32G32B32_UINT => api::VkFormatProperties {
2445 linearTilingFeatures: 0,
2446 optimalTilingFeatures: 0,
2449 api::VK_FORMAT_R32G32B32_SINT => api::VkFormatProperties {
2451 linearTilingFeatures: 0,
2452 optimalTilingFeatures: 0,
2455 api::VK_FORMAT_R32G32B32_SFLOAT => api::VkFormatProperties {
2457 linearTilingFeatures: 0,
2458 optimalTilingFeatures: 0,
2461 api::VK_FORMAT_R32G32B32A32_UINT => api::VkFormatProperties {
2463 linearTilingFeatures: 0,
2464 optimalTilingFeatures: 0,
2467 api::VK_FORMAT_R32G32B32A32_SINT => api::VkFormatProperties {
2469 linearTilingFeatures: 0,
2470 optimalTilingFeatures: 0,
2473 api::VK_FORMAT_R32G32B32A32_SFLOAT => api::VkFormatProperties {
2475 linearTilingFeatures: 0,
2476 optimalTilingFeatures: 0,
2479 api::VK_FORMAT_R64_UINT => api::VkFormatProperties {
2481 linearTilingFeatures: 0,
2482 optimalTilingFeatures: 0,
2485 api::VK_FORMAT_R64_SINT => api::VkFormatProperties {
2487 linearTilingFeatures: 0,
2488 optimalTilingFeatures: 0,
2491 api::VK_FORMAT_R64_SFLOAT => api::VkFormatProperties {
2493 linearTilingFeatures: 0,
2494 optimalTilingFeatures: 0,
2497 api::VK_FORMAT_R64G64_UINT => api::VkFormatProperties {
2499 linearTilingFeatures: 0,
2500 optimalTilingFeatures: 0,
2503 api::VK_FORMAT_R64G64_SINT => api::VkFormatProperties {
2505 linearTilingFeatures: 0,
2506 optimalTilingFeatures: 0,
2509 api::VK_FORMAT_R64G64_SFLOAT => api::VkFormatProperties {
2511 linearTilingFeatures: 0,
2512 optimalTilingFeatures: 0,
2515 api::VK_FORMAT_R64G64B64_UINT => api::VkFormatProperties {
2517 linearTilingFeatures: 0,
2518 optimalTilingFeatures: 0,
2521 api::VK_FORMAT_R64G64B64_SINT => api::VkFormatProperties {
2523 linearTilingFeatures: 0,
2524 optimalTilingFeatures: 0,
2527 api::VK_FORMAT_R64G64B64_SFLOAT => api::VkFormatProperties {
2529 linearTilingFeatures: 0,
2530 optimalTilingFeatures: 0,
2533 api::VK_FORMAT_R64G64B64A64_UINT => api::VkFormatProperties {
2535 linearTilingFeatures: 0,
2536 optimalTilingFeatures: 0,
2539 api::VK_FORMAT_R64G64B64A64_SINT => api::VkFormatProperties {
2541 linearTilingFeatures: 0,
2542 optimalTilingFeatures: 0,
2545 api::VK_FORMAT_R64G64B64A64_SFLOAT => api::VkFormatProperties {
2547 linearTilingFeatures: 0,
2548 optimalTilingFeatures: 0,
2551 api::VK_FORMAT_B10G11R11_UFLOAT_PACK32 => api::VkFormatProperties {
2553 linearTilingFeatures: 0,
2554 optimalTilingFeatures: 0,
2557 api::VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 => api::VkFormatProperties {
2559 linearTilingFeatures: 0,
2560 optimalTilingFeatures: 0,
2563 api::VK_FORMAT_D16_UNORM => api::VkFormatProperties {
2565 linearTilingFeatures: 0,
2566 optimalTilingFeatures: 0,
2569 api::VK_FORMAT_X8_D24_UNORM_PACK32 => api::VkFormatProperties {
2571 linearTilingFeatures: 0,
2572 optimalTilingFeatures: 0,
2575 api::VK_FORMAT_D32_SFLOAT => api::VkFormatProperties {
2577 linearTilingFeatures: 0,
2578 optimalTilingFeatures: 0,
2581 api::VK_FORMAT_S8_UINT => api::VkFormatProperties {
2583 linearTilingFeatures: 0,
2584 optimalTilingFeatures: 0,
2587 api::VK_FORMAT_D16_UNORM_S8_UINT => api::VkFormatProperties {
2589 linearTilingFeatures: 0,
2590 optimalTilingFeatures: 0,
2593 api::VK_FORMAT_D24_UNORM_S8_UINT => api::VkFormatProperties {
2595 linearTilingFeatures: 0,
2596 optimalTilingFeatures: 0,
2599 api::VK_FORMAT_D32_SFLOAT_S8_UINT => api::VkFormatProperties {
2601 linearTilingFeatures: 0,
2602 optimalTilingFeatures: 0,
2605 api::VK_FORMAT_BC1_RGB_UNORM_BLOCK => api::VkFormatProperties {
2607 linearTilingFeatures: 0,
2608 optimalTilingFeatures: 0,
2611 api::VK_FORMAT_BC1_RGB_SRGB_BLOCK => api::VkFormatProperties {
2613 linearTilingFeatures: 0,
2614 optimalTilingFeatures: 0,
2617 api::VK_FORMAT_BC1_RGBA_UNORM_BLOCK => api::VkFormatProperties {
2619 linearTilingFeatures: 0,
2620 optimalTilingFeatures: 0,
2623 api::VK_FORMAT_BC1_RGBA_SRGB_BLOCK => api::VkFormatProperties {
2625 linearTilingFeatures: 0,
2626 optimalTilingFeatures: 0,
2629 api::VK_FORMAT_BC2_UNORM_BLOCK => api::VkFormatProperties {
2631 linearTilingFeatures: 0,
2632 optimalTilingFeatures: 0,
2635 api::VK_FORMAT_BC2_SRGB_BLOCK => api::VkFormatProperties {
2637 linearTilingFeatures: 0,
2638 optimalTilingFeatures: 0,
2641 api::VK_FORMAT_BC3_UNORM_BLOCK => api::VkFormatProperties {
2643 linearTilingFeatures: 0,
2644 optimalTilingFeatures: 0,
2647 api::VK_FORMAT_BC3_SRGB_BLOCK => api::VkFormatProperties {
2649 linearTilingFeatures: 0,
2650 optimalTilingFeatures: 0,
2653 api::VK_FORMAT_BC4_UNORM_BLOCK => api::VkFormatProperties {
2655 linearTilingFeatures: 0,
2656 optimalTilingFeatures: 0,
2659 api::VK_FORMAT_BC4_SNORM_BLOCK => api::VkFormatProperties {
2661 linearTilingFeatures: 0,
2662 optimalTilingFeatures: 0,
2665 api::VK_FORMAT_BC5_UNORM_BLOCK => api::VkFormatProperties {
2667 linearTilingFeatures: 0,
2668 optimalTilingFeatures: 0,
2671 api::VK_FORMAT_BC5_SNORM_BLOCK => api::VkFormatProperties {
2673 linearTilingFeatures: 0,
2674 optimalTilingFeatures: 0,
2677 api::VK_FORMAT_BC6H_UFLOAT_BLOCK => api::VkFormatProperties {
2679 linearTilingFeatures: 0,
2680 optimalTilingFeatures: 0,
2683 api::VK_FORMAT_BC6H_SFLOAT_BLOCK => api::VkFormatProperties {
2685 linearTilingFeatures: 0,
2686 optimalTilingFeatures: 0,
2689 api::VK_FORMAT_BC7_UNORM_BLOCK => api::VkFormatProperties {
2691 linearTilingFeatures: 0,
2692 optimalTilingFeatures: 0,
2695 api::VK_FORMAT_BC7_SRGB_BLOCK => api::VkFormatProperties {
2697 linearTilingFeatures: 0,
2698 optimalTilingFeatures: 0,
2701 api::VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK => api::VkFormatProperties {
2703 linearTilingFeatures: 0,
2704 optimalTilingFeatures: 0,
2707 api::VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK => api::VkFormatProperties {
2709 linearTilingFeatures: 0,
2710 optimalTilingFeatures: 0,
2713 api::VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK => api::VkFormatProperties {
2715 linearTilingFeatures: 0,
2716 optimalTilingFeatures: 0,
2719 api::VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK => api::VkFormatProperties {
2721 linearTilingFeatures: 0,
2722 optimalTilingFeatures: 0,
2725 api::VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK => api::VkFormatProperties {
2727 linearTilingFeatures: 0,
2728 optimalTilingFeatures: 0,
2731 api::VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK => api::VkFormatProperties {
2733 linearTilingFeatures: 0,
2734 optimalTilingFeatures: 0,
2737 api::VK_FORMAT_EAC_R11_UNORM_BLOCK => api::VkFormatProperties {
2739 linearTilingFeatures: 0,
2740 optimalTilingFeatures: 0,
2743 api::VK_FORMAT_EAC_R11_SNORM_BLOCK => api::VkFormatProperties {
2745 linearTilingFeatures: 0,
2746 optimalTilingFeatures: 0,
2749 api::VK_FORMAT_EAC_R11G11_UNORM_BLOCK => api::VkFormatProperties {
2751 linearTilingFeatures: 0,
2752 optimalTilingFeatures: 0,
2755 api::VK_FORMAT_EAC_R11G11_SNORM_BLOCK => api::VkFormatProperties {
2757 linearTilingFeatures: 0,
2758 optimalTilingFeatures: 0,
2761 api::VK_FORMAT_ASTC_4x4_UNORM_BLOCK => api::VkFormatProperties {
2763 linearTilingFeatures: 0,
2764 optimalTilingFeatures: 0,
2767 api::VK_FORMAT_ASTC_4x4_SRGB_BLOCK => api::VkFormatProperties {
2769 linearTilingFeatures: 0,
2770 optimalTilingFeatures: 0,
2773 api::VK_FORMAT_ASTC_5x4_UNORM_BLOCK => api::VkFormatProperties {
2775 linearTilingFeatures: 0,
2776 optimalTilingFeatures: 0,
2779 api::VK_FORMAT_ASTC_5x4_SRGB_BLOCK => api::VkFormatProperties {
2781 linearTilingFeatures: 0,
2782 optimalTilingFeatures: 0,
2785 api::VK_FORMAT_ASTC_5x5_UNORM_BLOCK => api::VkFormatProperties {
2787 linearTilingFeatures: 0,
2788 optimalTilingFeatures: 0,
2791 api::VK_FORMAT_ASTC_5x5_SRGB_BLOCK => api::VkFormatProperties {
2793 linearTilingFeatures: 0,
2794 optimalTilingFeatures: 0,
2797 api::VK_FORMAT_ASTC_6x5_UNORM_BLOCK => api::VkFormatProperties {
2799 linearTilingFeatures: 0,
2800 optimalTilingFeatures: 0,
2803 api::VK_FORMAT_ASTC_6x5_SRGB_BLOCK => api::VkFormatProperties {
2805 linearTilingFeatures: 0,
2806 optimalTilingFeatures: 0,
2809 api::VK_FORMAT_ASTC_6x6_UNORM_BLOCK => api::VkFormatProperties {
2811 linearTilingFeatures: 0,
2812 optimalTilingFeatures: 0,
2815 api::VK_FORMAT_ASTC_6x6_SRGB_BLOCK => api::VkFormatProperties {
2817 linearTilingFeatures: 0,
2818 optimalTilingFeatures: 0,
2821 api::VK_FORMAT_ASTC_8x5_UNORM_BLOCK => api::VkFormatProperties {
2823 linearTilingFeatures: 0,
2824 optimalTilingFeatures: 0,
2827 api::VK_FORMAT_ASTC_8x5_SRGB_BLOCK => api::VkFormatProperties {
2829 linearTilingFeatures: 0,
2830 optimalTilingFeatures: 0,
2833 api::VK_FORMAT_ASTC_8x6_UNORM_BLOCK => api::VkFormatProperties {
2835 linearTilingFeatures: 0,
2836 optimalTilingFeatures: 0,
2839 api::VK_FORMAT_ASTC_8x6_SRGB_BLOCK => api::VkFormatProperties {
2841 linearTilingFeatures: 0,
2842 optimalTilingFeatures: 0,
2845 api::VK_FORMAT_ASTC_8x8_UNORM_BLOCK => api::VkFormatProperties {
2847 linearTilingFeatures: 0,
2848 optimalTilingFeatures: 0,
2851 api::VK_FORMAT_ASTC_8x8_SRGB_BLOCK => api::VkFormatProperties {
2853 linearTilingFeatures: 0,
2854 optimalTilingFeatures: 0,
2857 api::VK_FORMAT_ASTC_10x5_UNORM_BLOCK => api::VkFormatProperties {
2859 linearTilingFeatures: 0,
2860 optimalTilingFeatures: 0,
2863 api::VK_FORMAT_ASTC_10x5_SRGB_BLOCK => api::VkFormatProperties {
2865 linearTilingFeatures: 0,
2866 optimalTilingFeatures: 0,
2869 api::VK_FORMAT_ASTC_10x6_UNORM_BLOCK => api::VkFormatProperties {
2871 linearTilingFeatures: 0,
2872 optimalTilingFeatures: 0,
2875 api::VK_FORMAT_ASTC_10x6_SRGB_BLOCK => api::VkFormatProperties {
2877 linearTilingFeatures: 0,
2878 optimalTilingFeatures: 0,
2881 api::VK_FORMAT_ASTC_10x8_UNORM_BLOCK => api::VkFormatProperties {
2883 linearTilingFeatures: 0,
2884 optimalTilingFeatures: 0,
2887 api::VK_FORMAT_ASTC_10x8_SRGB_BLOCK => api::VkFormatProperties {
2889 linearTilingFeatures: 0,
2890 optimalTilingFeatures: 0,
2893 api::VK_FORMAT_ASTC_10x10_UNORM_BLOCK => api::VkFormatProperties {
2895 linearTilingFeatures: 0,
2896 optimalTilingFeatures: 0,
2899 api::VK_FORMAT_ASTC_10x10_SRGB_BLOCK => api::VkFormatProperties {
2901 linearTilingFeatures: 0,
2902 optimalTilingFeatures: 0,
2905 api::VK_FORMAT_ASTC_12x10_UNORM_BLOCK => api::VkFormatProperties {
2907 linearTilingFeatures: 0,
2908 optimalTilingFeatures: 0,
2911 api::VK_FORMAT_ASTC_12x10_SRGB_BLOCK => api::VkFormatProperties {
2913 linearTilingFeatures: 0,
2914 optimalTilingFeatures: 0,
2917 api::VK_FORMAT_ASTC_12x12_UNORM_BLOCK => api::VkFormatProperties {
2919 linearTilingFeatures: 0,
2920 optimalTilingFeatures: 0,
2923 api::VK_FORMAT_ASTC_12x12_SRGB_BLOCK => api::VkFormatProperties {
2925 linearTilingFeatures: 0,
2926 optimalTilingFeatures: 0,
2929 api::VK_FORMAT_G8B8G8R8_422_UNORM => api::VkFormatProperties {
2931 linearTilingFeatures: 0,
2932 optimalTilingFeatures: 0,
2935 api::VK_FORMAT_B8G8R8G8_422_UNORM => api::VkFormatProperties {
2937 linearTilingFeatures: 0,
2938 optimalTilingFeatures: 0,
2941 api::VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM => api::VkFormatProperties {
2943 linearTilingFeatures: 0,
2944 optimalTilingFeatures: 0,
2947 api::VK_FORMAT_G8_B8R8_2PLANE_420_UNORM => api::VkFormatProperties {
2949 linearTilingFeatures: 0,
2950 optimalTilingFeatures: 0,
2953 api::VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM => api::VkFormatProperties {
2955 linearTilingFeatures: 0,
2956 optimalTilingFeatures: 0,
2959 api::VK_FORMAT_G8_B8R8_2PLANE_422_UNORM => api::VkFormatProperties {
2961 linearTilingFeatures: 0,
2962 optimalTilingFeatures: 0,
2965 api::VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM => api::VkFormatProperties {
2967 linearTilingFeatures: 0,
2968 optimalTilingFeatures: 0,
2971 api::VK_FORMAT_R10X6_UNORM_PACK16 => api::VkFormatProperties {
2973 linearTilingFeatures: 0,
2974 optimalTilingFeatures: 0,
2977 api::VK_FORMAT_R10X6G10X6_UNORM_2PACK16 => api::VkFormatProperties {
2979 linearTilingFeatures: 0,
2980 optimalTilingFeatures: 0,
2983 api::VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 => api::VkFormatProperties {
2985 linearTilingFeatures: 0,
2986 optimalTilingFeatures: 0,
2989 api::VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 => api::VkFormatProperties {
2991 linearTilingFeatures: 0,
2992 optimalTilingFeatures: 0,
2995 api::VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 => api::VkFormatProperties {
2997 linearTilingFeatures: 0,
2998 optimalTilingFeatures: 0,
3001 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3003 linearTilingFeatures: 0,
3004 optimalTilingFeatures: 0,
3007 api::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3009 linearTilingFeatures: 0,
3010 optimalTilingFeatures: 0,
3013 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3015 linearTilingFeatures: 0,
3016 optimalTilingFeatures: 0,
3019 api::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3021 linearTilingFeatures: 0,
3022 optimalTilingFeatures: 0,
3025 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 => api::VkFormatProperties {
3027 linearTilingFeatures: 0,
3028 optimalTilingFeatures: 0,
3031 api::VK_FORMAT_R12X4_UNORM_PACK16 => api::VkFormatProperties {
3033 linearTilingFeatures: 0,
3034 optimalTilingFeatures: 0,
3037 api::VK_FORMAT_R12X4G12X4_UNORM_2PACK16 => api::VkFormatProperties {
3039 linearTilingFeatures: 0,
3040 optimalTilingFeatures: 0,
3043 api::VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 => api::VkFormatProperties {
3045 linearTilingFeatures: 0,
3046 optimalTilingFeatures: 0,
3049 api::VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 => api::VkFormatProperties {
3051 linearTilingFeatures: 0,
3052 optimalTilingFeatures: 0,
3055 api::VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 => api::VkFormatProperties {
3057 linearTilingFeatures: 0,
3058 optimalTilingFeatures: 0,
3061 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3063 linearTilingFeatures: 0,
3064 optimalTilingFeatures: 0,
3067 api::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3069 linearTilingFeatures: 0,
3070 optimalTilingFeatures: 0,
3073 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3075 linearTilingFeatures: 0,
3076 optimalTilingFeatures: 0,
3079 api::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3081 linearTilingFeatures: 0,
3082 optimalTilingFeatures: 0,
3085 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 => api::VkFormatProperties {
3087 linearTilingFeatures: 0,
3088 optimalTilingFeatures: 0,
3091 api::VK_FORMAT_G16B16G16R16_422_UNORM => api::VkFormatProperties {
3093 linearTilingFeatures: 0,
3094 optimalTilingFeatures: 0,
3097 api::VK_FORMAT_B16G16R16G16_422_UNORM => api::VkFormatProperties {
3099 linearTilingFeatures: 0,
3100 optimalTilingFeatures: 0,
3103 api::VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM => api::VkFormatProperties {
3105 linearTilingFeatures: 0,
3106 optimalTilingFeatures: 0,
3109 api::VK_FORMAT_G16_B16R16_2PLANE_420_UNORM => api::VkFormatProperties {
3111 linearTilingFeatures: 0,
3112 optimalTilingFeatures: 0,
3115 api::VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM => api::VkFormatProperties {
3117 linearTilingFeatures: 0,
3118 optimalTilingFeatures: 0,
3121 api::VK_FORMAT_G16_B16R16_2PLANE_422_UNORM => api::VkFormatProperties {
3123 linearTilingFeatures: 0,
3124 optimalTilingFeatures: 0,
3127 api::VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM => api::VkFormatProperties {
3129 linearTilingFeatures: 0,
3130 optimalTilingFeatures: 0,
3133 _ => panic!("unknown format {}", format),
3138 pub struct Instance {
3139 physical_device: OwnedHandle<api::VkPhysicalDevice>,
3144 create_info: *const api::VkInstanceCreateInfo,
3145 ) -> Result<api::VkInstance, api::VkResult> {
3146 parse_next_chain_const!{
3148 root = api::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
3150 let ref create_info = *create_info;
3151 if create_info.enabledLayerCount != 0 {
3152 return Err(api::VK_ERROR_LAYER_NOT_PRESENT);
3154 let mut enabled_extensions = Extensions::create_empty();
3155 if create_info.enabledExtensionCount != 0 {
3156 for &extension_name in slice::from_raw_parts(
3157 create_info.ppEnabledExtensionNames,
3158 create_info.enabledExtensionCount as usize,
3160 let extension: Extension = CStr::from_ptr(extension_name)
3162 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?
3164 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?;
3165 assert_eq!(extension.get_scope(), ExtensionScope::Instance);
3166 enabled_extensions[extension] = true;
3169 for extension in enabled_extensions
3171 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
3173 let missing_extensions = extension.get_required_extensions() & !enabled_extensions;
3174 for missing_extension in missing_extensions
3176 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
3179 "extension {} enabled but required extension {} is not enabled",
3180 extension.get_name(),
3181 missing_extension.get_name()
3185 let system_memory_size;
3186 match sys_info::mem_info() {
3188 eprintln!("mem_info error: {}", error);
3189 return Err(api::VK_ERROR_INITIALIZATION_FAILED);
3191 Ok(info) => system_memory_size = info.total * 1024,
3193 let mut device_name = [0; api::VK_MAX_PHYSICAL_DEVICE_NAME_SIZE as usize];
3194 copy_str_to_char_array(&mut device_name, KAZAN_DEVICE_NAME);
3195 let retval = OwnedHandle::<api::VkInstance>::new(Instance {
3196 physical_device: OwnedHandle::new(PhysicalDevice {
3198 allowed_extensions: enabled_extensions.get_allowed_extensions_from_instance_scope(),
3199 properties: api::VkPhysicalDeviceProperties {
3200 apiVersion: make_api_version(1, 1, api::VK_HEADER_VERSION),
3201 driverVersion: make_api_version(
3202 env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
3203 env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
3204 env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
3206 vendorID: api::VK_VENDOR_ID_KAZAN,
3208 deviceType: api::VK_PHYSICAL_DEVICE_TYPE_CPU,
3209 deviceName: device_name,
3210 pipelineCacheUUID: *PhysicalDevice::get_pipeline_cache_uuid().as_bytes(),
3211 limits: PhysicalDevice::get_limits(),
3212 sparseProperties: api::VkPhysicalDeviceSparseProperties {
3213 residencyStandard2DBlockShape: api::VK_FALSE,
3214 residencyStandard2DMultisampleBlockShape: api::VK_FALSE,
3215 residencyStandard3DBlockShape: api::VK_FALSE,
3216 residencyAlignedMipSize: api::VK_FALSE,
3217 residencyNonResidentStrict: api::VK_FALSE,
3220 features: Features::new(),
3222 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties {
3223 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES,
3225 pointClippingBehavior: api::VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES,
3227 multiview_properties: api::VkPhysicalDeviceMultiviewProperties {
3228 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES,
3230 maxMultiviewViewCount: 6,
3231 maxMultiviewInstanceIndex: !0,
3233 id_properties: api::VkPhysicalDeviceIDProperties {
3234 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES,
3236 deviceUUID: *PhysicalDevice::get_device_uuid().as_bytes(),
3237 driverUUID: *PhysicalDevice::get_driver_uuid().as_bytes(),
3238 deviceLUID: [0; api::VK_LUID_SIZE as usize],
3240 deviceLUIDValid: api::VK_FALSE,
3242 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties {
3243 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES,
3245 maxPerSetDescriptors: !0,
3246 maxMemoryAllocationSize: isize::max_value() as u64,
3248 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties {
3249 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES,
3251 protectedNoFault: api::VK_FALSE,
3253 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties {
3254 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES,
3256 subgroupSize: 1, // FIXME fill in correct value
3257 supportedStages: api::VK_SHADER_STAGE_COMPUTE_BIT,
3258 supportedOperations: api::VK_SUBGROUP_FEATURE_BASIC_BIT,
3259 quadOperationsInAllStages: api::VK_FALSE,
3267 #[allow(non_snake_case)]
3268 pub unsafe extern "system" fn vkGetInstanceProcAddr(
3269 instance: api::VkInstance,
3270 name: *const c_char,
3271 ) -> api::PFN_vkVoidFunction {
3272 match instance.get() {
3273 Some(_) => get_proc_address(
3275 GetProcAddressScope::Instance,
3276 &SharedHandle::from(instance)
3279 .allowed_extensions,
3281 None => get_proc_address(
3283 GetProcAddressScope::Global,
3284 &Extensions::create_empty(),
3289 pub fn make_api_version(major: u32, minor: u32, patch: u32) -> u32 {
3290 assert!(major < (1 << 10));
3291 assert!(minor < (1 << 10));
3292 assert!(patch < (1 << 12));
3293 (major << 22) | (minor << 12) | patch
3296 #[allow(non_snake_case)]
3297 pub unsafe extern "system" fn vkEnumerateInstanceVersion(api_version: *mut u32) -> api::VkResult {
3298 *api_version = make_api_version(1, 1, api::VK_HEADER_VERSION);
3302 pub unsafe fn enumerate_helper<T, Item, I: IntoIterator<Item = Item>, AF: FnMut(&mut T, Item)>(
3303 api_value_count: *mut u32,
3306 mut assign_function: AF,
3307 ) -> api::VkResult {
3308 let mut retval = api::VK_SUCCESS;
3309 let mut api_values = if api_values.is_null() {
3312 Some(slice::from_raw_parts_mut(
3314 *api_value_count as usize,
3317 let mut final_count = 0;
3318 for value in values {
3319 if let Some(api_values) = &mut api_values {
3320 if final_count >= api_values.len() {
3321 retval = api::VK_INCOMPLETE;
3324 assign_function(&mut api_values[final_count], value);
3331 assert_eq!(final_count as u32 as usize, final_count);
3332 *api_value_count = final_count as u32;
3336 #[allow(non_snake_case)]
3337 pub unsafe extern "system" fn vkEnumerateInstanceLayerProperties(
3338 property_count: *mut u32,
3339 properties: *mut api::VkLayerProperties,
3340 ) -> api::VkResult {
3341 enumerate_helper(property_count, properties, &[], |l, r| *l = *r)
3344 #[allow(non_snake_case)]
3345 pub unsafe extern "system" fn vkEnumerateInstanceExtensionProperties(
3346 layer_name: *const c_char,
3347 property_count: *mut u32,
3348 properties: *mut api::VkExtensionProperties,
3349 ) -> api::VkResult {
3350 enumerate_extension_properties(
3354 ExtensionScope::Instance,
3358 #[allow(non_snake_case)]
3359 pub unsafe extern "system" fn vkCreateInstance(
3360 create_info: *const api::VkInstanceCreateInfo,
3361 _allocator: *const api::VkAllocationCallbacks,
3362 instance: *mut api::VkInstance,
3363 ) -> api::VkResult {
3364 *instance = Handle::null();
3365 match Instance::new(create_info) {
3370 Err(error) => error,
3374 #[allow(non_snake_case)]
3375 pub unsafe extern "system" fn vkDestroyInstance(
3376 instance: api::VkInstance,
3377 _allocator: *const api::VkAllocationCallbacks,
3379 if !instance.is_null() {
3380 OwnedHandle::from(instance);
3384 #[allow(non_snake_case)]
3385 pub unsafe extern "system" fn vkEnumeratePhysicalDevices(
3386 instance: api::VkInstance,
3387 physical_device_count: *mut u32,
3388 physical_devices: *mut api::VkPhysicalDevice,
3389 ) -> api::VkResult {
3390 let instance = SharedHandle::from(instance).unwrap();
3392 physical_device_count,
3394 iter::once(instance.physical_device.get_handle()),
3399 #[allow(non_snake_case)]
3400 pub unsafe extern "system" fn vkGetPhysicalDeviceFeatures(
3401 physical_device: api::VkPhysicalDevice,
3402 features: *mut api::VkPhysicalDeviceFeatures,
3404 let mut v = api::VkPhysicalDeviceFeatures2 {
3405 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
3407 features: mem::zeroed(),
3409 vkGetPhysicalDeviceFeatures2(physical_device, &mut v);
3410 *features = v.features;
3413 #[allow(non_snake_case)]
3414 pub unsafe extern "system" fn vkGetPhysicalDeviceFormatProperties(
3415 physical_device: api::VkPhysicalDevice,
3416 format: api::VkFormat,
3417 format_properties: *mut api::VkFormatProperties,
3419 let mut format_properties2 = api::VkFormatProperties2 {
3420 sType: api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
3422 formatProperties: mem::zeroed(),
3424 vkGetPhysicalDeviceFormatProperties2(physical_device, format, &mut format_properties2);
3425 *format_properties = format_properties2.formatProperties;
3428 #[allow(non_snake_case)]
3429 pub unsafe extern "system" fn vkGetPhysicalDeviceImageFormatProperties(
3430 _physicalDevice: api::VkPhysicalDevice,
3431 _format: api::VkFormat,
3432 _type_: api::VkImageType,
3433 _tiling: api::VkImageTiling,
3434 _usage: api::VkImageUsageFlags,
3435 _flags: api::VkImageCreateFlags,
3436 _pImageFormatProperties: *mut api::VkImageFormatProperties,
3437 ) -> api::VkResult {
3441 #[allow(non_snake_case)]
3442 pub unsafe extern "system" fn vkGetPhysicalDeviceProperties(
3443 physical_device: api::VkPhysicalDevice,
3444 properties: *mut api::VkPhysicalDeviceProperties,
3446 let physical_device = SharedHandle::from(physical_device).unwrap();
3447 *properties = physical_device.properties;
3450 unsafe fn get_physical_device_queue_family_properties(
3451 _physical_device: SharedHandle<api::VkPhysicalDevice>,
3452 queue_family_properties: &mut api::VkQueueFamilyProperties2,
3455 parse_next_chain_mut!{
3456 queue_family_properties as *mut api::VkQueueFamilyProperties2,
3457 root = api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2,
3459 queue_family_properties.queueFamilyProperties = api::VkQueueFamilyProperties {
3460 queueFlags: api::VK_QUEUE_GRAPHICS_BIT
3461 | api::VK_QUEUE_COMPUTE_BIT
3462 | api::VK_QUEUE_TRANSFER_BIT,
3463 queueCount: queue_count,
3464 timestampValidBits: 0,
3465 minImageTransferGranularity: api::VkExtent3D {
3473 #[allow(non_snake_case)]
3474 pub unsafe extern "system" fn vkGetPhysicalDeviceQueueFamilyProperties(
3475 physical_device: api::VkPhysicalDevice,
3476 queue_family_property_count: *mut u32,
3477 queue_family_properties: *mut api::VkQueueFamilyProperties,
3480 queue_family_property_count,
3481 queue_family_properties,
3482 QUEUE_COUNTS.iter(),
3483 |queue_family_properties, &count| {
3484 let mut queue_family_properties2 = api::VkQueueFamilyProperties2 {
3485 sType: api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2,
3487 queueFamilyProperties: mem::zeroed(),
3489 get_physical_device_queue_family_properties(
3490 SharedHandle::from(physical_device).unwrap(),
3491 &mut queue_family_properties2,
3494 *queue_family_properties = queue_family_properties2.queueFamilyProperties;
3499 #[allow(non_snake_case)]
3500 pub unsafe extern "system" fn vkGetPhysicalDeviceMemoryProperties(
3501 physical_device: api::VkPhysicalDevice,
3502 memory_properties: *mut api::VkPhysicalDeviceMemoryProperties,
3504 let mut memory_properties2 = api::VkPhysicalDeviceMemoryProperties2 {
3505 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2,
3507 memoryProperties: mem::zeroed(),
3509 vkGetPhysicalDeviceMemoryProperties2(physical_device, &mut memory_properties2);
3510 *memory_properties = memory_properties2.memoryProperties;
3513 #[allow(non_snake_case)]
3514 pub unsafe extern "system" fn vkGetDeviceProcAddr(
3515 device: api::VkDevice,
3516 name: *const c_char,
3517 ) -> api::PFN_vkVoidFunction {
3520 GetProcAddressScope::Device,
3521 &SharedHandle::from(device).unwrap().extensions,
3525 #[allow(non_snake_case)]
3526 pub unsafe extern "system" fn vkCreateDevice(
3527 physical_device: api::VkPhysicalDevice,
3528 create_info: *const api::VkDeviceCreateInfo,
3529 _allocator: *const api::VkAllocationCallbacks,
3530 device: *mut api::VkDevice,
3531 ) -> api::VkResult {
3532 *device = Handle::null();
3533 match Device::new(SharedHandle::from(physical_device).unwrap(), create_info) {
3538 Err(error) => error,
3542 #[allow(non_snake_case)]
3543 pub unsafe extern "system" fn vkDestroyDevice(
3544 device: api::VkDevice,
3545 _allocator: *const api::VkAllocationCallbacks,
3547 if !device.is_null() {
3548 OwnedHandle::from(device);
3552 unsafe fn enumerate_extension_properties(
3553 layer_name: *const c_char,
3554 property_count: *mut u32,
3555 properties: *mut api::VkExtensionProperties,
3556 extension_scope: ExtensionScope,
3557 ) -> api::VkResult {
3558 if !layer_name.is_null() {
3559 return api::VK_ERROR_LAYER_NOT_PRESENT;
3564 Extensions::default().iter().filter_map(
3565 |(extension, _): (Extension, _)| -> Option<api::VkExtensionProperties> {
3566 if extension.get_scope() == extension_scope {
3567 Some(extension.get_properties())
3577 #[allow(non_snake_case)]
3578 pub unsafe extern "system" fn vkEnumerateDeviceExtensionProperties(
3579 _physical_device: api::VkPhysicalDevice,
3580 layer_name: *const c_char,
3581 property_count: *mut u32,
3582 properties: *mut api::VkExtensionProperties,
3583 ) -> api::VkResult {
3584 enumerate_extension_properties(
3588 ExtensionScope::Device,
3592 #[allow(non_snake_case)]
3593 pub unsafe extern "system" fn vkEnumerateDeviceLayerProperties(
3594 _physicalDevice: api::VkPhysicalDevice,
3595 _pPropertyCount: *mut u32,
3596 _pProperties: *mut api::VkLayerProperties,
3597 ) -> api::VkResult {
3601 #[allow(non_snake_case)]
3602 pub unsafe extern "system" fn vkGetDeviceQueue(
3603 device: api::VkDevice,
3604 queue_family_index: u32,
3606 queue: *mut api::VkQueue,
3610 &api::VkDeviceQueueInfo2 {
3611 sType: api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2,
3614 queueFamilyIndex: queue_family_index,
3615 queueIndex: queue_index,
3621 #[allow(non_snake_case)]
3622 pub unsafe extern "system" fn vkQueueSubmit(
3623 _queue: api::VkQueue,
3625 _pSubmits: *const api::VkSubmitInfo,
3626 _fence: api::VkFence,
3627 ) -> api::VkResult {
3631 #[allow(non_snake_case)]
3632 pub unsafe extern "system" fn vkQueueWaitIdle(_queue: api::VkQueue) -> api::VkResult {
3636 #[allow(non_snake_case)]
3637 pub unsafe extern "system" fn vkDeviceWaitIdle(_device: api::VkDevice) -> api::VkResult {
3641 #[allow(non_snake_case)]
3642 pub unsafe extern "system" fn vkAllocateMemory(
3643 _device: api::VkDevice,
3644 allocate_info: *const api::VkMemoryAllocateInfo,
3645 _allocator: *const api::VkAllocationCallbacks,
3646 memory: *mut api::VkDeviceMemory,
3647 ) -> api::VkResult {
3648 parse_next_chain_const!{
3650 root = api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
3651 export_memory_allocate_info: api::VkExportMemoryAllocateInfo = api::VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO,
3652 memory_allocate_flags_info: api::VkMemoryAllocateFlagsInfo = api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO,
3653 memory_dedicated_allocate_info: api::VkMemoryDedicatedAllocateInfo = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
3655 let ref allocate_info = *allocate_info;
3656 if !export_memory_allocate_info.is_null() {
3659 if !memory_allocate_flags_info.is_null() {
3662 if !memory_dedicated_allocate_info.is_null() {
3665 match DeviceMemoryType::from_index(allocate_info.memoryTypeIndex).unwrap() {
3666 DeviceMemoryType::Main => {
3667 if allocate_info.allocationSize > isize::max_value() as u64 {
3668 return api::VK_ERROR_OUT_OF_DEVICE_MEMORY;
3670 match DeviceMemory::allocate_from_default_heap(DeviceMemoryLayout::calculate(
3671 allocate_info.allocationSize as usize,
3672 MIN_MEMORY_MAP_ALIGNMENT,
3675 *memory = OwnedHandle::<api::VkDeviceMemory>::new(new_memory).take();
3678 Err(_) => api::VK_ERROR_OUT_OF_DEVICE_MEMORY,
3684 #[allow(non_snake_case)]
3685 pub unsafe extern "system" fn vkFreeMemory(
3686 _device: api::VkDevice,
3687 memory: api::VkDeviceMemory,
3688 _allocator: *const api::VkAllocationCallbacks,
3690 if !memory.is_null() {
3691 OwnedHandle::from(memory);
3695 #[allow(non_snake_case)]
3696 pub unsafe extern "system" fn vkMapMemory(
3697 _device: api::VkDevice,
3698 memory: api::VkDeviceMemory,
3699 offset: api::VkDeviceSize,
3700 size: api::VkDeviceSize,
3701 flags: api::VkMemoryMapFlags,
3702 data: *mut *mut c_void,
3703 ) -> api::VkResult {
3704 let memory = SharedHandle::from(memory).unwrap();
3705 // remember to keep vkUnmapMemory up to date
3706 *data = memory.get().as_ptr().offset(offset as isize) as *mut c_void;
3710 #[allow(non_snake_case)]
3711 pub unsafe extern "system" fn vkUnmapMemory(_device: api::VkDevice, _memory: api::VkDeviceMemory) {}
3713 #[allow(non_snake_case)]
3714 pub unsafe extern "system" fn vkFlushMappedMemoryRanges(
3715 _device: api::VkDevice,
3716 _memoryRangeCount: u32,
3717 _pMemoryRanges: *const api::VkMappedMemoryRange,
3718 ) -> api::VkResult {
3722 #[allow(non_snake_case)]
3723 pub unsafe extern "system" fn vkInvalidateMappedMemoryRanges(
3724 _device: api::VkDevice,
3725 _memoryRangeCount: u32,
3726 _pMemoryRanges: *const api::VkMappedMemoryRange,
3727 ) -> api::VkResult {
3731 #[allow(non_snake_case)]
3732 pub unsafe extern "system" fn vkGetDeviceMemoryCommitment(
3733 _device: api::VkDevice,
3734 _memory: api::VkDeviceMemory,
3735 _pCommittedMemoryInBytes: *mut api::VkDeviceSize,
3740 #[allow(non_snake_case)]
3741 pub unsafe extern "system" fn vkBindBufferMemory(
3742 device: api::VkDevice,
3743 buffer: api::VkBuffer,
3744 memory: api::VkDeviceMemory,
3745 memory_offset: api::VkDeviceSize,
3746 ) -> api::VkResult {
3747 vkBindBufferMemory2(
3750 &api::VkBindBufferMemoryInfo {
3751 sType: api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO,
3755 memoryOffset: memory_offset,
3760 #[allow(non_snake_case)]
3761 pub unsafe extern "system" fn vkBindImageMemory(
3762 _device: api::VkDevice,
3763 _image: api::VkImage,
3764 _memory: api::VkDeviceMemory,
3765 _memoryOffset: api::VkDeviceSize,
3766 ) -> api::VkResult {
3770 #[allow(non_snake_case)]
3771 pub unsafe extern "system" fn vkGetBufferMemoryRequirements(
3772 device: api::VkDevice,
3773 buffer: api::VkBuffer,
3774 memory_requirements: *mut api::VkMemoryRequirements,
3776 let mut memory_requirements_2 = api::VkMemoryRequirements2 {
3777 sType: api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
3779 memoryRequirements: mem::zeroed(),
3781 vkGetBufferMemoryRequirements2(
3783 &api::VkBufferMemoryRequirementsInfo2 {
3784 sType: api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
3788 &mut memory_requirements_2,
3790 *memory_requirements = memory_requirements_2.memoryRequirements;
3793 #[allow(non_snake_case)]
3794 pub unsafe extern "system" fn vkGetImageMemoryRequirements(
3795 _device: api::VkDevice,
3796 _image: api::VkImage,
3797 _pMemoryRequirements: *mut api::VkMemoryRequirements,
3802 #[allow(non_snake_case)]
3803 pub unsafe extern "system" fn vkGetImageSparseMemoryRequirements(
3804 _device: api::VkDevice,
3805 _image: api::VkImage,
3806 _pSparseMemoryRequirementCount: *mut u32,
3807 _pSparseMemoryRequirements: *mut api::VkSparseImageMemoryRequirements,
3812 #[allow(non_snake_case)]
3813 pub unsafe extern "system" fn vkGetPhysicalDeviceSparseImageFormatProperties(
3814 _physicalDevice: api::VkPhysicalDevice,
3815 _format: api::VkFormat,
3816 _type_: api::VkImageType,
3817 _samples: api::VkSampleCountFlagBits,
3818 _usage: api::VkImageUsageFlags,
3819 _tiling: api::VkImageTiling,
3820 _pPropertyCount: *mut u32,
3821 _pProperties: *mut api::VkSparseImageFormatProperties,
3826 #[allow(non_snake_case)]
3827 pub unsafe extern "system" fn vkQueueBindSparse(
3828 _queue: api::VkQueue,
3829 _bindInfoCount: u32,
3830 _pBindInfo: *const api::VkBindSparseInfo,
3831 _fence: api::VkFence,
3832 ) -> api::VkResult {
3836 #[allow(non_snake_case)]
3837 pub unsafe extern "system" fn vkCreateFence(
3838 _device: api::VkDevice,
3839 _pCreateInfo: *const api::VkFenceCreateInfo,
3840 _pAllocator: *const api::VkAllocationCallbacks,
3841 _pFence: *mut api::VkFence,
3842 ) -> api::VkResult {
3846 #[allow(non_snake_case)]
3847 pub unsafe extern "system" fn vkDestroyFence(
3848 _device: api::VkDevice,
3849 _fence: api::VkFence,
3850 _pAllocator: *const api::VkAllocationCallbacks,
3855 #[allow(non_snake_case)]
3856 pub unsafe extern "system" fn vkResetFences(
3857 _device: api::VkDevice,
3859 _pFences: *const api::VkFence,
3860 ) -> api::VkResult {
3864 #[allow(non_snake_case)]
3865 pub unsafe extern "system" fn vkGetFenceStatus(
3866 _device: api::VkDevice,
3867 _fence: api::VkFence,
3868 ) -> api::VkResult {
3872 #[allow(non_snake_case)]
3873 pub unsafe extern "system" fn vkWaitForFences(
3874 _device: api::VkDevice,
3876 _pFences: *const api::VkFence,
3877 _waitAll: api::VkBool32,
3879 ) -> api::VkResult {
3883 #[allow(non_snake_case)]
3884 pub unsafe extern "system" fn vkCreateSemaphore(
3885 _device: api::VkDevice,
3886 _pCreateInfo: *const api::VkSemaphoreCreateInfo,
3887 _pAllocator: *const api::VkAllocationCallbacks,
3888 _pSemaphore: *mut api::VkSemaphore,
3889 ) -> api::VkResult {
3893 #[allow(non_snake_case)]
3894 pub unsafe extern "system" fn vkDestroySemaphore(
3895 _device: api::VkDevice,
3896 _semaphore: api::VkSemaphore,
3897 _pAllocator: *const api::VkAllocationCallbacks,
3902 #[allow(non_snake_case)]
3903 pub unsafe extern "system" fn vkCreateEvent(
3904 _device: api::VkDevice,
3905 _pCreateInfo: *const api::VkEventCreateInfo,
3906 _pAllocator: *const api::VkAllocationCallbacks,
3907 _pEvent: *mut api::VkEvent,
3908 ) -> api::VkResult {
3912 #[allow(non_snake_case)]
3913 pub unsafe extern "system" fn vkDestroyEvent(
3914 _device: api::VkDevice,
3915 _event: api::VkEvent,
3916 _pAllocator: *const api::VkAllocationCallbacks,
3921 #[allow(non_snake_case)]
3922 pub unsafe extern "system" fn vkGetEventStatus(
3923 _device: api::VkDevice,
3924 _event: api::VkEvent,
3925 ) -> api::VkResult {
3929 #[allow(non_snake_case)]
3930 pub unsafe extern "system" fn vkSetEvent(
3931 _device: api::VkDevice,
3932 _event: api::VkEvent,
3933 ) -> api::VkResult {
3937 #[allow(non_snake_case)]
3938 pub unsafe extern "system" fn vkResetEvent(
3939 _device: api::VkDevice,
3940 _event: api::VkEvent,
3941 ) -> api::VkResult {
3945 #[allow(non_snake_case)]
3946 pub unsafe extern "system" fn vkCreateQueryPool(
3947 _device: api::VkDevice,
3948 _pCreateInfo: *const api::VkQueryPoolCreateInfo,
3949 _pAllocator: *const api::VkAllocationCallbacks,
3950 _pQueryPool: *mut api::VkQueryPool,
3951 ) -> api::VkResult {
3955 #[allow(non_snake_case)]
3956 pub unsafe extern "system" fn vkDestroyQueryPool(
3957 _device: api::VkDevice,
3958 _queryPool: api::VkQueryPool,
3959 _pAllocator: *const api::VkAllocationCallbacks,
3964 #[allow(non_snake_case)]
3965 pub unsafe extern "system" fn vkGetQueryPoolResults(
3966 _device: api::VkDevice,
3967 _queryPool: api::VkQueryPool,
3971 _pData: *mut c_void,
3972 _stride: api::VkDeviceSize,
3973 _flags: api::VkQueryResultFlags,
3974 ) -> api::VkResult {
3978 #[allow(non_snake_case)]
3979 pub unsafe extern "system" fn vkCreateBuffer(
3980 _device: api::VkDevice,
3981 create_info: *const api::VkBufferCreateInfo,
3982 _allocator: *const api::VkAllocationCallbacks,
3983 buffer: *mut api::VkBuffer,
3984 ) -> api::VkResult {
3985 parse_next_chain_const!{
3987 root = api::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
3988 external_memory_buffer: api::VkExternalMemoryBufferCreateInfo = api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO,
3990 let ref create_info = *create_info;
3991 if !external_memory_buffer.is_null() {
3992 let ref external_memory_buffer = *external_memory_buffer;
3993 assert_eq!(external_memory_buffer.handleTypes, 0);
3995 if create_info.size > isize::max_value() as u64 {
3996 return api::VK_ERROR_OUT_OF_DEVICE_MEMORY;
3998 *buffer = OwnedHandle::<api::VkBuffer>::new(Buffer {
3999 size: create_info.size as usize,
4006 #[allow(non_snake_case)]
4007 pub unsafe extern "system" fn vkDestroyBuffer(
4008 _device: api::VkDevice,
4009 buffer: api::VkBuffer,
4010 _allocator: *const api::VkAllocationCallbacks,
4012 if !buffer.is_null() {
4013 OwnedHandle::from(buffer);
4017 #[allow(non_snake_case)]
4018 pub unsafe extern "system" fn vkCreateBufferView(
4019 _device: api::VkDevice,
4020 _pCreateInfo: *const api::VkBufferViewCreateInfo,
4021 _pAllocator: *const api::VkAllocationCallbacks,
4022 _pView: *mut api::VkBufferView,
4023 ) -> api::VkResult {
4027 #[allow(non_snake_case)]
4028 pub unsafe extern "system" fn vkDestroyBufferView(
4029 _device: api::VkDevice,
4030 _bufferView: api::VkBufferView,
4031 _pAllocator: *const api::VkAllocationCallbacks,
4036 #[allow(non_snake_case)]
4037 pub unsafe extern "system" fn vkCreateImage(
4038 _device: api::VkDevice,
4039 _pCreateInfo: *const api::VkImageCreateInfo,
4040 _pAllocator: *const api::VkAllocationCallbacks,
4041 _pImage: *mut api::VkImage,
4042 ) -> api::VkResult {
4046 #[allow(non_snake_case)]
4047 pub unsafe extern "system" fn vkDestroyImage(
4048 _device: api::VkDevice,
4049 _image: api::VkImage,
4050 _pAllocator: *const api::VkAllocationCallbacks,
4055 #[allow(non_snake_case)]
4056 pub unsafe extern "system" fn vkGetImageSubresourceLayout(
4057 _device: api::VkDevice,
4058 _image: api::VkImage,
4059 _pSubresource: *const api::VkImageSubresource,
4060 _pLayout: *mut api::VkSubresourceLayout,
4065 #[allow(non_snake_case)]
4066 pub unsafe extern "system" fn vkCreateImageView(
4067 _device: api::VkDevice,
4068 _pCreateInfo: *const api::VkImageViewCreateInfo,
4069 _pAllocator: *const api::VkAllocationCallbacks,
4070 _pView: *mut api::VkImageView,
4071 ) -> api::VkResult {
4075 #[allow(non_snake_case)]
4076 pub unsafe extern "system" fn vkDestroyImageView(
4077 _device: api::VkDevice,
4078 _imageView: api::VkImageView,
4079 _pAllocator: *const api::VkAllocationCallbacks,
4084 #[allow(non_snake_case)]
4085 pub unsafe extern "system" fn vkCreateShaderModule(
4086 _device: api::VkDevice,
4087 create_info: *const api::VkShaderModuleCreateInfo,
4088 _allocator: *const api::VkAllocationCallbacks,
4089 shader_module: *mut api::VkShaderModule,
4090 ) -> api::VkResult {
4091 parse_next_chain_const!{
4093 root = api::VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
4095 let ref create_info = *create_info;
4096 const U32_BYTE_COUNT: usize = 4;
4097 assert_eq!(U32_BYTE_COUNT, mem::size_of::<u32>());
4098 assert_eq!(create_info.codeSize % U32_BYTE_COUNT, 0);
4099 assert_ne!(create_info.codeSize, 0);
4100 let code = slice::from_raw_parts(create_info.pCode, create_info.codeSize / U32_BYTE_COUNT);
4101 *shader_module = OwnedHandle::<api::VkShaderModule>::new(ShaderModule {
4102 code: code.to_owned(),
4108 #[allow(non_snake_case)]
4109 pub unsafe extern "system" fn vkDestroyShaderModule(
4110 _device: api::VkDevice,
4111 shader_module: api::VkShaderModule,
4112 _allocator: *const api::VkAllocationCallbacks,
4114 if !shader_module.is_null() {
4115 OwnedHandle::from(shader_module);
4119 #[allow(non_snake_case)]
4120 pub unsafe extern "system" fn vkCreatePipelineCache(
4121 _device: api::VkDevice,
4122 _pCreateInfo: *const api::VkPipelineCacheCreateInfo,
4123 _pAllocator: *const api::VkAllocationCallbacks,
4124 _pPipelineCache: *mut api::VkPipelineCache,
4125 ) -> api::VkResult {
4129 #[allow(non_snake_case)]
4130 pub unsafe extern "system" fn vkDestroyPipelineCache(
4131 _device: api::VkDevice,
4132 _pipelineCache: api::VkPipelineCache,
4133 _pAllocator: *const api::VkAllocationCallbacks,
4138 #[allow(non_snake_case)]
4139 pub unsafe extern "system" fn vkGetPipelineCacheData(
4140 _device: api::VkDevice,
4141 _pipelineCache: api::VkPipelineCache,
4142 _pDataSize: *mut usize,
4143 _pData: *mut c_void,
4144 ) -> api::VkResult {
4148 #[allow(non_snake_case)]
4149 pub unsafe extern "system" fn vkMergePipelineCaches(
4150 _device: api::VkDevice,
4151 _dstCache: api::VkPipelineCache,
4152 _srcCacheCount: u32,
4153 _pSrcCaches: *const api::VkPipelineCache,
4154 ) -> api::VkResult {
4158 #[allow(non_snake_case)]
4159 pub unsafe extern "system" fn vkCreateGraphicsPipelines(
4160 _device: api::VkDevice,
4161 _pipelineCache: api::VkPipelineCache,
4162 _createInfoCount: u32,
4163 _pCreateInfos: *const api::VkGraphicsPipelineCreateInfo,
4164 _pAllocator: *const api::VkAllocationCallbacks,
4165 _pPipelines: *mut api::VkPipeline,
4166 ) -> api::VkResult {
4170 #[allow(non_snake_case)]
4171 pub unsafe extern "system" fn vkCreateComputePipelines(
4172 _device: api::VkDevice,
4173 _pipelineCache: api::VkPipelineCache,
4174 _createInfoCount: u32,
4175 _pCreateInfos: *const api::VkComputePipelineCreateInfo,
4176 _pAllocator: *const api::VkAllocationCallbacks,
4177 _pPipelines: *mut api::VkPipeline,
4178 ) -> api::VkResult {
4182 #[allow(non_snake_case)]
4183 pub unsafe extern "system" fn vkDestroyPipeline(
4184 _device: api::VkDevice,
4185 _pipeline: api::VkPipeline,
4186 _pAllocator: *const api::VkAllocationCallbacks,
4191 #[allow(non_snake_case)]
4192 pub unsafe extern "system" fn vkCreatePipelineLayout(
4193 _device: api::VkDevice,
4194 _pCreateInfo: *const api::VkPipelineLayoutCreateInfo,
4195 _pAllocator: *const api::VkAllocationCallbacks,
4196 _pPipelineLayout: *mut api::VkPipelineLayout,
4197 ) -> api::VkResult {
4201 #[allow(non_snake_case)]
4202 pub unsafe extern "system" fn vkDestroyPipelineLayout(
4203 _device: api::VkDevice,
4204 _pipelineLayout: api::VkPipelineLayout,
4205 _pAllocator: *const api::VkAllocationCallbacks,
4210 #[allow(non_snake_case)]
4211 pub unsafe extern "system" fn vkCreateSampler(
4212 _device: api::VkDevice,
4213 create_info: *const api::VkSamplerCreateInfo,
4214 _allocator: *const api::VkAllocationCallbacks,
4215 sampler: *mut api::VkSampler,
4216 ) -> api::VkResult {
4217 parse_next_chain_const!{
4219 root = api::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
4221 let ref create_info = *create_info;
4222 *sampler = OwnedHandle::<api::VkSampler>::new(Sampler {
4223 mag_filter: create_info.magFilter,
4224 min_filter: create_info.minFilter,
4225 mipmap_mode: create_info.mipmapMode,
4227 create_info.addressModeU,
4228 create_info.addressModeV,
4229 create_info.addressModeW,
4231 mip_lod_bias: create_info.mipLodBias,
4232 anisotropy: if create_info.anisotropyEnable != api::VK_FALSE {
4233 Some(sampler::AnisotropySettings {
4234 max: create_info.maxAnisotropy,
4239 compare_op: if create_info.compareEnable != api::VK_FALSE {
4240 Some(create_info.compareOp)
4244 min_lod: create_info.minLod,
4245 max_lod: create_info.maxLod,
4246 border_color: create_info.borderColor,
4247 unnormalized_coordinates: create_info.unnormalizedCoordinates != api::VK_FALSE,
4248 sampler_ycbcr_conversion: None,
4254 #[allow(non_snake_case)]
4255 pub unsafe extern "system" fn vkDestroySampler(
4256 _device: api::VkDevice,
4257 sampler: api::VkSampler,
4258 _allocator: *const api::VkAllocationCallbacks,
4260 if !sampler.is_null() {
4261 OwnedHandle::from(sampler);
4265 #[allow(non_snake_case)]
4266 pub unsafe extern "system" fn vkCreateDescriptorSetLayout(
4267 _device: api::VkDevice,
4268 _pCreateInfo: *const api::VkDescriptorSetLayoutCreateInfo,
4269 _pAllocator: *const api::VkAllocationCallbacks,
4270 _pSetLayout: *mut api::VkDescriptorSetLayout,
4271 ) -> api::VkResult {
4275 #[allow(non_snake_case)]
4276 pub unsafe extern "system" fn vkDestroyDescriptorSetLayout(
4277 _device: api::VkDevice,
4278 _descriptorSetLayout: api::VkDescriptorSetLayout,
4279 _pAllocator: *const api::VkAllocationCallbacks,
4284 #[allow(non_snake_case)]
4285 pub unsafe extern "system" fn vkCreateDescriptorPool(
4286 _device: api::VkDevice,
4287 _pCreateInfo: *const api::VkDescriptorPoolCreateInfo,
4288 _pAllocator: *const api::VkAllocationCallbacks,
4289 _pDescriptorPool: *mut api::VkDescriptorPool,
4290 ) -> api::VkResult {
4294 #[allow(non_snake_case)]
4295 pub unsafe extern "system" fn vkDestroyDescriptorPool(
4296 _device: api::VkDevice,
4297 _descriptorPool: api::VkDescriptorPool,
4298 _pAllocator: *const api::VkAllocationCallbacks,
4303 #[allow(non_snake_case)]
4304 pub unsafe extern "system" fn vkResetDescriptorPool(
4305 _device: api::VkDevice,
4306 _descriptorPool: api::VkDescriptorPool,
4307 _flags: api::VkDescriptorPoolResetFlags,
4308 ) -> api::VkResult {
4312 #[allow(non_snake_case)]
4313 pub unsafe extern "system" fn vkAllocateDescriptorSets(
4314 _device: api::VkDevice,
4315 _pAllocateInfo: *const api::VkDescriptorSetAllocateInfo,
4316 _pDescriptorSets: *mut api::VkDescriptorSet,
4317 ) -> api::VkResult {
4321 #[allow(non_snake_case)]
4322 pub unsafe extern "system" fn vkFreeDescriptorSets(
4323 _device: api::VkDevice,
4324 _descriptorPool: api::VkDescriptorPool,
4325 _descriptorSetCount: u32,
4326 _pDescriptorSets: *const api::VkDescriptorSet,
4327 ) -> api::VkResult {
4331 #[allow(non_snake_case)]
4332 pub unsafe extern "system" fn vkUpdateDescriptorSets(
4333 _device: api::VkDevice,
4334 _descriptorWriteCount: u32,
4335 _pDescriptorWrites: *const api::VkWriteDescriptorSet,
4336 _descriptorCopyCount: u32,
4337 _pDescriptorCopies: *const api::VkCopyDescriptorSet,
4342 #[allow(non_snake_case)]
4343 pub unsafe extern "system" fn vkCreateFramebuffer(
4344 _device: api::VkDevice,
4345 _pCreateInfo: *const api::VkFramebufferCreateInfo,
4346 _pAllocator: *const api::VkAllocationCallbacks,
4347 _pFramebuffer: *mut api::VkFramebuffer,
4348 ) -> api::VkResult {
4352 #[allow(non_snake_case)]
4353 pub unsafe extern "system" fn vkDestroyFramebuffer(
4354 _device: api::VkDevice,
4355 _framebuffer: api::VkFramebuffer,
4356 _pAllocator: *const api::VkAllocationCallbacks,
4361 #[allow(non_snake_case)]
4362 pub unsafe extern "system" fn vkCreateRenderPass(
4363 _device: api::VkDevice,
4364 _pCreateInfo: *const api::VkRenderPassCreateInfo,
4365 _pAllocator: *const api::VkAllocationCallbacks,
4366 _pRenderPass: *mut api::VkRenderPass,
4367 ) -> api::VkResult {
4371 #[allow(non_snake_case)]
4372 pub unsafe extern "system" fn vkDestroyRenderPass(
4373 _device: api::VkDevice,
4374 _renderPass: api::VkRenderPass,
4375 _pAllocator: *const api::VkAllocationCallbacks,
4380 #[allow(non_snake_case)]
4381 pub unsafe extern "system" fn vkGetRenderAreaGranularity(
4382 _device: api::VkDevice,
4383 _renderPass: api::VkRenderPass,
4384 _pGranularity: *mut api::VkExtent2D,
4389 #[allow(non_snake_case)]
4390 pub unsafe extern "system" fn vkCreateCommandPool(
4391 _device: api::VkDevice,
4392 _pCreateInfo: *const api::VkCommandPoolCreateInfo,
4393 _pAllocator: *const api::VkAllocationCallbacks,
4394 _pCommandPool: *mut api::VkCommandPool,
4395 ) -> api::VkResult {
4399 #[allow(non_snake_case)]
4400 pub unsafe extern "system" fn vkDestroyCommandPool(
4401 _device: api::VkDevice,
4402 _commandPool: api::VkCommandPool,
4403 _pAllocator: *const api::VkAllocationCallbacks,
4408 #[allow(non_snake_case)]
4409 pub unsafe extern "system" fn vkResetCommandPool(
4410 _device: api::VkDevice,
4411 _commandPool: api::VkCommandPool,
4412 _flags: api::VkCommandPoolResetFlags,
4413 ) -> api::VkResult {
4417 #[allow(non_snake_case)]
4418 pub unsafe extern "system" fn vkAllocateCommandBuffers(
4419 _device: api::VkDevice,
4420 _pAllocateInfo: *const api::VkCommandBufferAllocateInfo,
4421 _pCommandBuffers: *mut api::VkCommandBuffer,
4422 ) -> api::VkResult {
4426 #[allow(non_snake_case)]
4427 pub unsafe extern "system" fn vkFreeCommandBuffers(
4428 _device: api::VkDevice,
4429 _commandPool: api::VkCommandPool,
4430 _commandBufferCount: u32,
4431 _pCommandBuffers: *const api::VkCommandBuffer,
4436 #[allow(non_snake_case)]
4437 pub unsafe extern "system" fn vkBeginCommandBuffer(
4438 _commandBuffer: api::VkCommandBuffer,
4439 _pBeginInfo: *const api::VkCommandBufferBeginInfo,
4440 ) -> api::VkResult {
4444 #[allow(non_snake_case)]
4445 pub unsafe extern "system" fn vkEndCommandBuffer(
4446 _commandBuffer: api::VkCommandBuffer,
4447 ) -> api::VkResult {
4451 #[allow(non_snake_case)]
4452 pub unsafe extern "system" fn vkResetCommandBuffer(
4453 _commandBuffer: api::VkCommandBuffer,
4454 _flags: api::VkCommandBufferResetFlags,
4455 ) -> api::VkResult {
4459 #[allow(non_snake_case)]
4460 pub unsafe extern "system" fn vkCmdBindPipeline(
4461 _commandBuffer: api::VkCommandBuffer,
4462 _pipelineBindPoint: api::VkPipelineBindPoint,
4463 _pipeline: api::VkPipeline,
4468 #[allow(non_snake_case)]
4469 pub unsafe extern "system" fn vkCmdSetViewport(
4470 _commandBuffer: api::VkCommandBuffer,
4471 _firstViewport: u32,
4472 _viewportCount: u32,
4473 _pViewports: *const api::VkViewport,
4478 #[allow(non_snake_case)]
4479 pub unsafe extern "system" fn vkCmdSetScissor(
4480 _commandBuffer: api::VkCommandBuffer,
4483 _pScissors: *const api::VkRect2D,
4488 #[allow(non_snake_case)]
4489 pub unsafe extern "system" fn vkCmdSetLineWidth(
4490 _commandBuffer: api::VkCommandBuffer,
4496 #[allow(non_snake_case)]
4497 pub unsafe extern "system" fn vkCmdSetDepthBias(
4498 _commandBuffer: api::VkCommandBuffer,
4499 _depthBiasConstantFactor: f32,
4500 _depthBiasClamp: f32,
4501 _depthBiasSlopeFactor: f32,
4506 #[allow(non_snake_case)]
4507 pub unsafe extern "system" fn vkCmdSetBlendConstants(
4508 _commandBuffer: api::VkCommandBuffer,
4509 _blendConstants: *const f32,
4514 #[allow(non_snake_case)]
4515 pub unsafe extern "system" fn vkCmdSetDepthBounds(
4516 _commandBuffer: api::VkCommandBuffer,
4517 _minDepthBounds: f32,
4518 _maxDepthBounds: f32,
4523 #[allow(non_snake_case)]
4524 pub unsafe extern "system" fn vkCmdSetStencilCompareMask(
4525 _commandBuffer: api::VkCommandBuffer,
4526 _faceMask: api::VkStencilFaceFlags,
4532 #[allow(non_snake_case)]
4533 pub unsafe extern "system" fn vkCmdSetStencilWriteMask(
4534 _commandBuffer: api::VkCommandBuffer,
4535 _faceMask: api::VkStencilFaceFlags,
4541 #[allow(non_snake_case)]
4542 pub unsafe extern "system" fn vkCmdSetStencilReference(
4543 _commandBuffer: api::VkCommandBuffer,
4544 _faceMask: api::VkStencilFaceFlags,
4550 #[allow(non_snake_case)]
4551 pub unsafe extern "system" fn vkCmdBindDescriptorSets(
4552 _commandBuffer: api::VkCommandBuffer,
4553 _pipelineBindPoint: api::VkPipelineBindPoint,
4554 _layout: api::VkPipelineLayout,
4556 _descriptorSetCount: u32,
4557 _pDescriptorSets: *const api::VkDescriptorSet,
4558 _dynamicOffsetCount: u32,
4559 _pDynamicOffsets: *const u32,
4564 #[allow(non_snake_case)]
4565 pub unsafe extern "system" fn vkCmdBindIndexBuffer(
4566 _commandBuffer: api::VkCommandBuffer,
4567 _buffer: api::VkBuffer,
4568 _offset: api::VkDeviceSize,
4569 _indexType: api::VkIndexType,
4574 #[allow(non_snake_case)]
4575 pub unsafe extern "system" fn vkCmdBindVertexBuffers(
4576 _commandBuffer: api::VkCommandBuffer,
4579 _pBuffers: *const api::VkBuffer,
4580 _pOffsets: *const api::VkDeviceSize,
4585 #[allow(non_snake_case)]
4586 pub unsafe extern "system" fn vkCmdDraw(
4587 _commandBuffer: api::VkCommandBuffer,
4589 _instanceCount: u32,
4591 _firstInstance: u32,
4596 #[allow(non_snake_case)]
4597 pub unsafe extern "system" fn vkCmdDrawIndexed(
4598 _commandBuffer: api::VkCommandBuffer,
4600 _instanceCount: u32,
4603 _firstInstance: u32,
4608 #[allow(non_snake_case)]
4609 pub unsafe extern "system" fn vkCmdDrawIndirect(
4610 _commandBuffer: api::VkCommandBuffer,
4611 _buffer: api::VkBuffer,
4612 _offset: api::VkDeviceSize,
4619 #[allow(non_snake_case)]
4620 pub unsafe extern "system" fn vkCmdDrawIndexedIndirect(
4621 _commandBuffer: api::VkCommandBuffer,
4622 _buffer: api::VkBuffer,
4623 _offset: api::VkDeviceSize,
4630 #[allow(non_snake_case)]
4631 pub unsafe extern "system" fn vkCmdDispatch(
4632 _commandBuffer: api::VkCommandBuffer,
4640 #[allow(non_snake_case)]
4641 pub unsafe extern "system" fn vkCmdDispatchIndirect(
4642 _commandBuffer: api::VkCommandBuffer,
4643 _buffer: api::VkBuffer,
4644 _offset: api::VkDeviceSize,
4649 #[allow(non_snake_case)]
4650 pub unsafe extern "system" fn vkCmdCopyBuffer(
4651 _commandBuffer: api::VkCommandBuffer,
4652 _srcBuffer: api::VkBuffer,
4653 _dstBuffer: api::VkBuffer,
4655 _pRegions: *const api::VkBufferCopy,
4660 #[allow(non_snake_case)]
4661 pub unsafe extern "system" fn vkCmdCopyImage(
4662 _commandBuffer: api::VkCommandBuffer,
4663 _srcImage: api::VkImage,
4664 _srcImageLayout: api::VkImageLayout,
4665 _dstImage: api::VkImage,
4666 _dstImageLayout: api::VkImageLayout,
4668 _pRegions: *const api::VkImageCopy,
4673 #[allow(non_snake_case)]
4674 pub unsafe extern "system" fn vkCmdBlitImage(
4675 _commandBuffer: api::VkCommandBuffer,
4676 _srcImage: api::VkImage,
4677 _srcImageLayout: api::VkImageLayout,
4678 _dstImage: api::VkImage,
4679 _dstImageLayout: api::VkImageLayout,
4681 _pRegions: *const api::VkImageBlit,
4682 _filter: api::VkFilter,
4687 #[allow(non_snake_case)]
4688 pub unsafe extern "system" fn vkCmdCopyBufferToImage(
4689 _commandBuffer: api::VkCommandBuffer,
4690 _srcBuffer: api::VkBuffer,
4691 _dstImage: api::VkImage,
4692 _dstImageLayout: api::VkImageLayout,
4694 _pRegions: *const api::VkBufferImageCopy,
4699 #[allow(non_snake_case)]
4700 pub unsafe extern "system" fn vkCmdCopyImageToBuffer(
4701 _commandBuffer: api::VkCommandBuffer,
4702 _srcImage: api::VkImage,
4703 _srcImageLayout: api::VkImageLayout,
4704 _dstBuffer: api::VkBuffer,
4706 _pRegions: *const api::VkBufferImageCopy,
4711 #[allow(non_snake_case)]
4712 pub unsafe extern "system" fn vkCmdUpdateBuffer(
4713 _commandBuffer: api::VkCommandBuffer,
4714 _dstBuffer: api::VkBuffer,
4715 _dstOffset: api::VkDeviceSize,
4716 _dataSize: api::VkDeviceSize,
4717 _pData: *const c_void,
4722 #[allow(non_snake_case)]
4723 pub unsafe extern "system" fn vkCmdFillBuffer(
4724 _commandBuffer: api::VkCommandBuffer,
4725 _dstBuffer: api::VkBuffer,
4726 _dstOffset: api::VkDeviceSize,
4727 _size: api::VkDeviceSize,
4733 #[allow(non_snake_case)]
4734 pub unsafe extern "system" fn vkCmdClearColorImage(
4735 _commandBuffer: api::VkCommandBuffer,
4736 _image: api::VkImage,
4737 _imageLayout: api::VkImageLayout,
4738 _pColor: *const api::VkClearColorValue,
4740 _pRanges: *const api::VkImageSubresourceRange,
4745 #[allow(non_snake_case)]
4746 pub unsafe extern "system" fn vkCmdClearDepthStencilImage(
4747 _commandBuffer: api::VkCommandBuffer,
4748 _image: api::VkImage,
4749 _imageLayout: api::VkImageLayout,
4750 _pDepthStencil: *const api::VkClearDepthStencilValue,
4752 _pRanges: *const api::VkImageSubresourceRange,
4757 #[allow(non_snake_case)]
4758 pub unsafe extern "system" fn vkCmdClearAttachments(
4759 _commandBuffer: api::VkCommandBuffer,
4760 _attachmentCount: u32,
4761 _pAttachments: *const api::VkClearAttachment,
4763 _pRects: *const api::VkClearRect,
4768 #[allow(non_snake_case)]
4769 pub unsafe extern "system" fn vkCmdResolveImage(
4770 _commandBuffer: api::VkCommandBuffer,
4771 _srcImage: api::VkImage,
4772 _srcImageLayout: api::VkImageLayout,
4773 _dstImage: api::VkImage,
4774 _dstImageLayout: api::VkImageLayout,
4776 _pRegions: *const api::VkImageResolve,
4781 #[allow(non_snake_case)]
4782 pub unsafe extern "system" fn vkCmdSetEvent(
4783 _commandBuffer: api::VkCommandBuffer,
4784 _event: api::VkEvent,
4785 _stageMask: api::VkPipelineStageFlags,
4790 #[allow(non_snake_case)]
4791 pub unsafe extern "system" fn vkCmdResetEvent(
4792 _commandBuffer: api::VkCommandBuffer,
4793 _event: api::VkEvent,
4794 _stageMask: api::VkPipelineStageFlags,
4799 #[allow(non_snake_case)]
4800 pub unsafe extern "system" fn vkCmdWaitEvents(
4801 _commandBuffer: api::VkCommandBuffer,
4803 _pEvents: *const api::VkEvent,
4804 _srcStageMask: api::VkPipelineStageFlags,
4805 _dstStageMask: api::VkPipelineStageFlags,
4806 _memoryBarrierCount: u32,
4807 _pMemoryBarriers: *const api::VkMemoryBarrier,
4808 _bufferMemoryBarrierCount: u32,
4809 _pBufferMemoryBarriers: *const api::VkBufferMemoryBarrier,
4810 _imageMemoryBarrierCount: u32,
4811 _pImageMemoryBarriers: *const api::VkImageMemoryBarrier,
4816 #[allow(non_snake_case)]
4817 pub unsafe extern "system" fn vkCmdPipelineBarrier(
4818 _commandBuffer: api::VkCommandBuffer,
4819 _srcStageMask: api::VkPipelineStageFlags,
4820 _dstStageMask: api::VkPipelineStageFlags,
4821 _dependencyFlags: api::VkDependencyFlags,
4822 _memoryBarrierCount: u32,
4823 _pMemoryBarriers: *const api::VkMemoryBarrier,
4824 _bufferMemoryBarrierCount: u32,
4825 _pBufferMemoryBarriers: *const api::VkBufferMemoryBarrier,
4826 _imageMemoryBarrierCount: u32,
4827 _pImageMemoryBarriers: *const api::VkImageMemoryBarrier,
4832 #[allow(non_snake_case)]
4833 pub unsafe extern "system" fn vkCmdBeginQuery(
4834 _commandBuffer: api::VkCommandBuffer,
4835 _queryPool: api::VkQueryPool,
4837 _flags: api::VkQueryControlFlags,
4842 #[allow(non_snake_case)]
4843 pub unsafe extern "system" fn vkCmdEndQuery(
4844 _commandBuffer: api::VkCommandBuffer,
4845 _queryPool: api::VkQueryPool,
4851 #[allow(non_snake_case)]
4852 pub unsafe extern "system" fn vkCmdResetQueryPool(
4853 _commandBuffer: api::VkCommandBuffer,
4854 _queryPool: api::VkQueryPool,
4861 #[allow(non_snake_case)]
4862 pub unsafe extern "system" fn vkCmdWriteTimestamp(
4863 _commandBuffer: api::VkCommandBuffer,
4864 _pipelineStage: api::VkPipelineStageFlagBits,
4865 _queryPool: api::VkQueryPool,
4871 #[allow(non_snake_case)]
4872 pub unsafe extern "system" fn vkCmdCopyQueryPoolResults(
4873 _commandBuffer: api::VkCommandBuffer,
4874 _queryPool: api::VkQueryPool,
4877 _dstBuffer: api::VkBuffer,
4878 _dstOffset: api::VkDeviceSize,
4879 _stride: api::VkDeviceSize,
4880 _flags: api::VkQueryResultFlags,
4885 #[allow(non_snake_case)]
4886 pub unsafe extern "system" fn vkCmdPushConstants(
4887 _commandBuffer: api::VkCommandBuffer,
4888 _layout: api::VkPipelineLayout,
4889 _stageFlags: api::VkShaderStageFlags,
4892 _pValues: *const c_void,
4897 #[allow(non_snake_case)]
4898 pub unsafe extern "system" fn vkCmdBeginRenderPass(
4899 _commandBuffer: api::VkCommandBuffer,
4900 _pRenderPassBegin: *const api::VkRenderPassBeginInfo,
4901 _contents: api::VkSubpassContents,
4906 #[allow(non_snake_case)]
4907 pub unsafe extern "system" fn vkCmdNextSubpass(
4908 _commandBuffer: api::VkCommandBuffer,
4909 _contents: api::VkSubpassContents,
4914 #[allow(non_snake_case)]
4915 pub unsafe extern "system" fn vkCmdEndRenderPass(_commandBuffer: api::VkCommandBuffer) {
4919 #[allow(non_snake_case)]
4920 pub unsafe extern "system" fn vkCmdExecuteCommands(
4921 _commandBuffer: api::VkCommandBuffer,
4922 _commandBufferCount: u32,
4923 _pCommandBuffers: *const api::VkCommandBuffer,
4928 #[allow(non_snake_case)]
4929 pub unsafe extern "system" fn vkBindBufferMemory2(
4930 _device: api::VkDevice,
4931 _bindInfoCount: u32,
4932 _pBindInfos: *const api::VkBindBufferMemoryInfo,
4933 ) -> api::VkResult {
4937 #[allow(non_snake_case)]
4938 pub unsafe extern "system" fn vkBindImageMemory2(
4939 _device: api::VkDevice,
4940 _bindInfoCount: u32,
4941 _pBindInfos: *const api::VkBindImageMemoryInfo,
4942 ) -> api::VkResult {
4946 #[allow(non_snake_case)]
4947 pub unsafe extern "system" fn vkGetDeviceGroupPeerMemoryFeatures(
4948 _device: api::VkDevice,
4950 _localDeviceIndex: u32,
4951 _remoteDeviceIndex: u32,
4952 _pPeerMemoryFeatures: *mut api::VkPeerMemoryFeatureFlags,
4957 #[allow(non_snake_case)]
4958 pub unsafe extern "system" fn vkCmdSetDeviceMask(
4959 _commandBuffer: api::VkCommandBuffer,
4965 #[allow(non_snake_case)]
4966 pub unsafe extern "system" fn vkCmdDispatchBase(
4967 _commandBuffer: api::VkCommandBuffer,
4978 #[allow(non_snake_case)]
4979 pub unsafe extern "system" fn vkEnumeratePhysicalDeviceGroups(
4980 instance: api::VkInstance,
4981 physical_device_group_count: *mut u32,
4982 physical_device_group_properties: *mut api::VkPhysicalDeviceGroupProperties,
4983 ) -> api::VkResult {
4985 physical_device_group_count,
4986 physical_device_group_properties,
4988 |physical_device_group_properties, _| {
4989 parse_next_chain_mut!{
4990 physical_device_group_properties as *mut api::VkPhysicalDeviceGroupProperties,
4991 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES,
4993 let mut physical_devices = [Handle::null(); api::VK_MAX_DEVICE_GROUP_SIZE as usize];
4994 physical_devices[0] = SharedHandle::from(instance)
4998 *physical_device_group_properties = api::VkPhysicalDeviceGroupProperties {
4999 sType: physical_device_group_properties.sType,
5000 pNext: physical_device_group_properties.pNext,
5001 physicalDeviceCount: 1,
5002 physicalDevices: physical_devices,
5003 subsetAllocation: api::VK_TRUE,
5009 #[allow(non_snake_case)]
5010 pub unsafe extern "system" fn vkGetImageMemoryRequirements2(
5011 _device: api::VkDevice,
5012 _pInfo: *const api::VkImageMemoryRequirementsInfo2,
5013 _pMemoryRequirements: *mut api::VkMemoryRequirements2,
5018 #[allow(non_snake_case)]
5019 pub unsafe extern "system" fn vkGetBufferMemoryRequirements2(
5020 _device: api::VkDevice,
5021 info: *const api::VkBufferMemoryRequirementsInfo2,
5022 memory_requirements: *mut api::VkMemoryRequirements2,
5024 parse_next_chain_const!{
5026 root = api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
5028 parse_next_chain_mut!{
5029 memory_requirements,
5030 root = api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
5031 dedicated_requirements: api::VkMemoryDedicatedRequirements = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS,
5033 let ref mut memory_requirements = *memory_requirements;
5034 let ref info = *info;
5035 let buffer = SharedHandle::from(info.buffer).unwrap();
5036 let layout = DeviceMemoryLayout::calculate(buffer.size, BUFFER_ALIGNMENT);
5037 memory_requirements.memoryRequirements = api::VkMemoryRequirements {
5038 size: layout.size as u64,
5039 alignment: layout.alignment as u64,
5040 memoryTypeBits: DeviceMemoryType::Main.to_bits(),
5042 if !dedicated_requirements.is_null() {
5043 let ref mut dedicated_requirements = *dedicated_requirements;
5044 dedicated_requirements.prefersDedicatedAllocation = api::VK_FALSE;
5045 dedicated_requirements.requiresDedicatedAllocation = api::VK_FALSE;
5049 #[allow(non_snake_case)]
5050 pub unsafe extern "system" fn vkGetImageSparseMemoryRequirements2(
5051 _device: api::VkDevice,
5052 _pInfo: *const api::VkImageSparseMemoryRequirementsInfo2,
5053 _pSparseMemoryRequirementCount: *mut u32,
5054 _pSparseMemoryRequirements: *mut api::VkSparseImageMemoryRequirements2,
5059 #[allow(non_snake_case)]
5060 pub unsafe extern "system" fn vkGetPhysicalDeviceFeatures2(
5061 physical_device: api::VkPhysicalDevice,
5062 features: *mut api::VkPhysicalDeviceFeatures2,
5064 parse_next_chain_mut!{
5066 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
5067 sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
5068 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
5069 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
5070 physical_device_shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
5071 physical_device_protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
5072 physical_device_multiview_features: api::VkPhysicalDeviceMultiviewFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
5074 let physical_device = SharedHandle::from(physical_device).unwrap();
5075 physical_device.features.export_feature_set(&mut *features);
5076 if !sampler_ycbcr_conversion_features.is_null() {
5079 .export_feature_set(&mut *sampler_ycbcr_conversion_features);
5081 if !physical_device_16bit_storage_features.is_null() {
5084 .export_feature_set(&mut *physical_device_16bit_storage_features);
5086 if !variable_pointer_features.is_null() {
5089 .export_feature_set(&mut *variable_pointer_features);
5091 if !physical_device_shader_draw_parameter_features.is_null() {
5094 .export_feature_set(&mut *physical_device_shader_draw_parameter_features);
5096 if !physical_device_protected_memory_features.is_null() {
5099 .export_feature_set(&mut *physical_device_protected_memory_features);
5101 if !physical_device_multiview_features.is_null() {
5104 .export_feature_set(&mut *physical_device_multiview_features);
5108 #[allow(non_snake_case)]
5109 pub unsafe extern "system" fn vkGetPhysicalDeviceProperties2(
5110 physical_device: api::VkPhysicalDevice,
5111 properties: *mut api::VkPhysicalDeviceProperties2,
5113 parse_next_chain_mut!{
5115 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
5116 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES,
5117 multiview_properties: api::VkPhysicalDeviceMultiviewProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES,
5118 id_properties: api::VkPhysicalDeviceIDProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES,
5119 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES,
5120 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES,
5121 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES,
5123 let ref mut properties = *properties;
5124 let physical_device = SharedHandle::from(physical_device).unwrap();
5125 properties.properties = physical_device.properties;
5126 if !point_clipping_properties.is_null() {
5127 let ref mut point_clipping_properties = *point_clipping_properties;
5128 *point_clipping_properties = api::VkPhysicalDevicePointClippingProperties {
5129 sType: point_clipping_properties.sType,
5130 pNext: point_clipping_properties.pNext,
5131 ..physical_device.point_clipping_properties
5134 if !multiview_properties.is_null() {
5135 let ref mut multiview_properties = *multiview_properties;
5136 *multiview_properties = api::VkPhysicalDeviceMultiviewProperties {
5137 sType: multiview_properties.sType,
5138 pNext: multiview_properties.pNext,
5139 ..physical_device.multiview_properties
5142 if !id_properties.is_null() {
5143 let ref mut id_properties = *id_properties;
5144 *id_properties = api::VkPhysicalDeviceIDProperties {
5145 sType: id_properties.sType,
5146 pNext: id_properties.pNext,
5147 ..physical_device.id_properties
5150 if !maintenance_3_properties.is_null() {
5151 let ref mut maintenance_3_properties = *maintenance_3_properties;
5152 *maintenance_3_properties = api::VkPhysicalDeviceMaintenance3Properties {
5153 sType: maintenance_3_properties.sType,
5154 pNext: maintenance_3_properties.pNext,
5155 ..physical_device.maintenance_3_properties
5158 if !protected_memory_properties.is_null() {
5159 let ref mut protected_memory_properties = *protected_memory_properties;
5160 *protected_memory_properties = api::VkPhysicalDeviceProtectedMemoryProperties {
5161 sType: protected_memory_properties.sType,
5162 pNext: protected_memory_properties.pNext,
5163 ..physical_device.protected_memory_properties
5166 if !subgroup_properties.is_null() {
5167 let ref mut subgroup_properties = *subgroup_properties;
5168 *subgroup_properties = api::VkPhysicalDeviceSubgroupProperties {
5169 sType: subgroup_properties.sType,
5170 pNext: subgroup_properties.pNext,
5171 ..physical_device.subgroup_properties
5176 #[allow(non_snake_case)]
5177 pub unsafe extern "system" fn vkGetPhysicalDeviceFormatProperties2(
5178 _physical_device: api::VkPhysicalDevice,
5179 format: api::VkFormat,
5180 format_properties: *mut api::VkFormatProperties2,
5182 parse_next_chain_mut!{
5184 root = api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
5186 let ref mut format_properties = *format_properties;
5187 format_properties.formatProperties = PhysicalDevice::get_format_properties(format);
5190 #[allow(non_snake_case)]
5191 pub unsafe extern "system" fn vkGetPhysicalDeviceImageFormatProperties2(
5192 _physicalDevice: api::VkPhysicalDevice,
5193 _pImageFormatInfo: *const api::VkPhysicalDeviceImageFormatInfo2,
5194 _pImageFormatProperties: *mut api::VkImageFormatProperties2,
5195 ) -> api::VkResult {
5199 #[allow(non_snake_case)]
5200 pub unsafe extern "system" fn vkGetPhysicalDeviceQueueFamilyProperties2(
5201 physical_device: api::VkPhysicalDevice,
5202 queue_family_property_count: *mut u32,
5203 queue_family_properties: *mut api::VkQueueFamilyProperties2,
5206 queue_family_property_count,
5207 queue_family_properties,
5208 QUEUE_COUNTS.iter(),
5209 |queue_family_properties, &count| {
5210 get_physical_device_queue_family_properties(
5211 SharedHandle::from(physical_device).unwrap(),
5212 queue_family_properties,
5219 #[allow(non_snake_case)]
5220 pub unsafe extern "system" fn vkGetPhysicalDeviceMemoryProperties2(
5221 physical_device: api::VkPhysicalDevice,
5222 memory_properties: *mut api::VkPhysicalDeviceMemoryProperties2,
5224 let physical_device = SharedHandle::from(physical_device).unwrap();
5225 parse_next_chain_mut!{
5227 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2,
5229 let ref mut memory_properties = *memory_properties;
5230 let mut properties: api::VkPhysicalDeviceMemoryProperties = mem::zeroed();
5231 properties.memoryTypeCount = DeviceMemoryTypes::default().len() as u32;
5232 for (memory_type, _) in DeviceMemoryTypes::default().iter() {
5233 properties.memoryTypes[memory_type as usize] = api::VkMemoryType {
5234 propertyFlags: memory_type.flags(),
5235 heapIndex: memory_type.heap() as u32,
5238 properties.memoryHeapCount = DeviceMemoryHeaps::default().len() as u32;
5239 for (memory_heap, _) in DeviceMemoryHeaps::default().iter() {
5240 properties.memoryHeaps[memory_heap as usize] = api::VkMemoryHeap {
5241 size: match memory_heap {
5242 DeviceMemoryHeap::Main => physical_device.system_memory_size * 7 / 8,
5244 flags: memory_heap.flags(),
5247 memory_properties.memoryProperties = properties;
5250 #[allow(non_snake_case)]
5251 pub unsafe extern "system" fn vkGetPhysicalDeviceSparseImageFormatProperties2(
5252 _physicalDevice: api::VkPhysicalDevice,
5253 _pFormatInfo: *const api::VkPhysicalDeviceSparseImageFormatInfo2,
5254 _pPropertyCount: *mut u32,
5255 _pProperties: *mut api::VkSparseImageFormatProperties2,
5260 #[allow(non_snake_case)]
5261 pub unsafe extern "system" fn vkTrimCommandPool(
5262 _device: api::VkDevice,
5263 _commandPool: api::VkCommandPool,
5264 _flags: api::VkCommandPoolTrimFlags,
5269 #[allow(non_snake_case)]
5270 pub unsafe extern "system" fn vkGetDeviceQueue2(
5271 device: api::VkDevice,
5272 queue_info: *const api::VkDeviceQueueInfo2,
5273 queue: *mut api::VkQueue,
5275 parse_next_chain_const!{
5277 root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2,
5279 let ref queue_info = *queue_info;
5280 assert_eq!(queue_info.flags, 0);
5281 let device = SharedHandle::from(device).unwrap();
5282 *queue = device.queues[queue_info.queueFamilyIndex as usize][queue_info.queueIndex as usize]
5286 #[allow(non_snake_case)]
5287 pub unsafe extern "system" fn vkCreateSamplerYcbcrConversion(
5288 _device: api::VkDevice,
5289 _pCreateInfo: *const api::VkSamplerYcbcrConversionCreateInfo,
5290 _pAllocator: *const api::VkAllocationCallbacks,
5291 _pYcbcrConversion: *mut api::VkSamplerYcbcrConversion,
5292 ) -> api::VkResult {
5296 #[allow(non_snake_case)]
5297 pub unsafe extern "system" fn vkDestroySamplerYcbcrConversion(
5298 _device: api::VkDevice,
5299 _ycbcrConversion: api::VkSamplerYcbcrConversion,
5300 _pAllocator: *const api::VkAllocationCallbacks,
5305 #[allow(non_snake_case)]
5306 pub unsafe extern "system" fn vkCreateDescriptorUpdateTemplate(
5307 _device: api::VkDevice,
5308 _pCreateInfo: *const api::VkDescriptorUpdateTemplateCreateInfo,
5309 _pAllocator: *const api::VkAllocationCallbacks,
5310 _pDescriptorUpdateTemplate: *mut api::VkDescriptorUpdateTemplate,
5311 ) -> api::VkResult {
5315 #[allow(non_snake_case)]
5316 pub unsafe extern "system" fn vkDestroyDescriptorUpdateTemplate(
5317 _device: api::VkDevice,
5318 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5319 _pAllocator: *const api::VkAllocationCallbacks,
5324 #[allow(non_snake_case)]
5325 pub unsafe extern "system" fn vkUpdateDescriptorSetWithTemplate(
5326 _device: api::VkDevice,
5327 _descriptorSet: api::VkDescriptorSet,
5328 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5329 _pData: *const c_void,
5334 #[allow(non_snake_case)]
5335 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalBufferProperties(
5336 _physicalDevice: api::VkPhysicalDevice,
5337 _pExternalBufferInfo: *const api::VkPhysicalDeviceExternalBufferInfo,
5338 _pExternalBufferProperties: *mut api::VkExternalBufferProperties,
5343 #[allow(non_snake_case)]
5344 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalFenceProperties(
5345 _physicalDevice: api::VkPhysicalDevice,
5346 _pExternalFenceInfo: *const api::VkPhysicalDeviceExternalFenceInfo,
5347 _pExternalFenceProperties: *mut api::VkExternalFenceProperties,
5352 #[allow(non_snake_case)]
5353 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalSemaphoreProperties(
5354 _physicalDevice: api::VkPhysicalDevice,
5355 _pExternalSemaphoreInfo: *const api::VkPhysicalDeviceExternalSemaphoreInfo,
5356 _pExternalSemaphoreProperties: *mut api::VkExternalSemaphoreProperties,
5361 #[allow(non_snake_case)]
5362 pub unsafe extern "system" fn vkGetDescriptorSetLayoutSupport(
5363 _device: api::VkDevice,
5364 _pCreateInfo: *const api::VkDescriptorSetLayoutCreateInfo,
5365 _pSupport: *mut api::VkDescriptorSetLayoutSupport,
5370 #[allow(non_snake_case)]
5371 pub unsafe extern "system" fn vkDestroySurfaceKHR(
5372 _instance: api::VkInstance,
5373 surface: api::VkSurfaceKHR,
5374 _allocator: *const api::VkAllocationCallbacks,
5376 if !surface.is_null() {
5377 let surface = SharedHandle::from(surface).unwrap();
5378 match surface.platform {
5379 api::VK_ICD_WSI_PLATFORM_MIR => {
5380 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_MIR")
5382 api::VK_ICD_WSI_PLATFORM_WAYLAND => {
5383 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_WAYLAND")
5385 api::VK_ICD_WSI_PLATFORM_WIN32 => {
5386 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_WIN32")
5388 api::VK_ICD_WSI_PLATFORM_XCB => {
5389 Box::from_raw(surface.take().get().unwrap().as_ptr() as *mut api::VkIcdSurfaceXcb);
5391 api::VK_ICD_WSI_PLATFORM_XLIB => {
5392 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_XLIB")
5394 api::VK_ICD_WSI_PLATFORM_ANDROID => {
5395 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_ANDROID")
5397 api::VK_ICD_WSI_PLATFORM_MACOS => {
5398 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_MACOS")
5400 api::VK_ICD_WSI_PLATFORM_IOS => {
5401 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_IOS")
5403 api::VK_ICD_WSI_PLATFORM_DISPLAY => {
5404 panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_DISPLAY")
5406 platform => panic!("unknown VkSurfaceKHR platform: {:?}", platform),
5411 #[allow(non_snake_case)]
5412 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceSupportKHR(
5413 _physicalDevice: api::VkPhysicalDevice,
5414 _queueFamilyIndex: u32,
5415 _surface: api::VkSurfaceKHR,
5416 _pSupported: *mut api::VkBool32,
5417 ) -> api::VkResult {
5421 #[allow(non_snake_case)]
5422 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
5423 physical_device: api::VkPhysicalDevice,
5424 surface: api::VkSurfaceKHR,
5425 surface_capabilities: *mut api::VkSurfaceCapabilitiesKHR,
5426 ) -> api::VkResult {
5427 let mut surface_capabilities_2 = api::VkSurfaceCapabilities2KHR {
5428 sType: api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
5430 surfaceCapabilities: mem::zeroed(),
5432 match vkGetPhysicalDeviceSurfaceCapabilities2KHR(
5434 &api::VkPhysicalDeviceSurfaceInfo2KHR {
5435 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR,
5439 &mut surface_capabilities_2,
5441 api::VK_SUCCESS => {
5442 *surface_capabilities = surface_capabilities_2.surfaceCapabilities;
5449 #[allow(non_snake_case)]
5450 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceFormatsKHR(
5451 _physical_device: api::VkPhysicalDevice,
5452 surface: api::VkSurfaceKHR,
5453 surface_format_count: *mut u32,
5454 surface_formats: *mut api::VkSurfaceFormatKHR,
5455 ) -> api::VkResult {
5456 let surface_implementation =
5457 SurfacePlatform::from(SharedHandle::from(surface).unwrap().platform)
5459 .get_surface_implementation();
5460 let returned_surface_formats = match surface_implementation.get_surface_formats(surface) {
5461 Ok(returned_surface_formats) => returned_surface_formats,
5462 Err(result) => return result,
5465 surface_format_count,
5467 returned_surface_formats.iter(),
5472 #[allow(non_snake_case)]
5473 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfacePresentModesKHR(
5474 _physical_device: api::VkPhysicalDevice,
5475 surface: api::VkSurfaceKHR,
5476 present_mode_count: *mut u32,
5477 present_modes: *mut api::VkPresentModeKHR,
5478 ) -> api::VkResult {
5479 let surface_implementation =
5480 SurfacePlatform::from(SharedHandle::from(surface).unwrap().platform)
5482 .get_surface_implementation();
5483 let returned_present_modes = match surface_implementation.get_present_modes(surface) {
5484 Ok(returned_present_modes) => returned_present_modes,
5485 Err(result) => return result,
5490 returned_present_modes.iter(),
5495 #[allow(non_snake_case)]
5496 pub unsafe extern "system" fn vkCreateSwapchainKHR(
5497 device: api::VkDevice,
5498 create_info: *const api::VkSwapchainCreateInfoKHR,
5499 _allocator: *const api::VkAllocationCallbacks,
5500 swapchain: *mut api::VkSwapchainKHR,
5501 ) -> api::VkResult {
5502 parse_next_chain_const!{
5504 root = api::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
5505 device_group_swapchain_create_info: api::VkDeviceGroupSwapchainCreateInfoKHR = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR,
5507 let ref create_info = *create_info;
5508 let device_group_swapchain_create_info = if device_group_swapchain_create_info.is_null() {
5511 Some(&*device_group_swapchain_create_info)
5513 *swapchain = Handle::null();
5515 SurfacePlatform::from(SharedHandle::from(create_info.surface).unwrap().platform).unwrap();
5517 .get_surface_implementation()
5518 .build(create_info, device_group_swapchain_create_info)
5520 Ok(new_swapchain) => {
5521 *swapchain = OwnedHandle::<api::VkSwapchainKHR>::new(new_swapchain).take();
5524 Err(error) => error,
5528 #[allow(non_snake_case)]
5529 pub unsafe extern "system" fn vkDestroySwapchainKHR(
5530 _device: api::VkDevice,
5531 swapchain: api::VkSwapchainKHR,
5532 _allocator: *const api::VkAllocationCallbacks,
5534 if !swapchain.is_null() {
5535 OwnedHandle::from(swapchain);
5539 #[allow(non_snake_case)]
5540 pub unsafe extern "system" fn vkGetSwapchainImagesKHR(
5541 _device: api::VkDevice,
5542 _swapchain: api::VkSwapchainKHR,
5543 _pSwapchainImageCount: *mut u32,
5544 _pSwapchainImages: *mut api::VkImage,
5545 ) -> api::VkResult {
5549 #[allow(non_snake_case)]
5550 pub unsafe extern "system" fn vkAcquireNextImageKHR(
5551 _device: api::VkDevice,
5552 _swapchain: api::VkSwapchainKHR,
5554 _semaphore: api::VkSemaphore,
5555 _fence: api::VkFence,
5556 _pImageIndex: *mut u32,
5557 ) -> api::VkResult {
5561 #[allow(non_snake_case)]
5562 pub unsafe extern "system" fn vkQueuePresentKHR(
5563 _queue: api::VkQueue,
5564 _pPresentInfo: *const api::VkPresentInfoKHR,
5565 ) -> api::VkResult {
5569 #[allow(non_snake_case)]
5570 pub unsafe extern "system" fn vkGetDeviceGroupPresentCapabilitiesKHR(
5571 _device: api::VkDevice,
5572 _pDeviceGroupPresentCapabilities: *mut api::VkDeviceGroupPresentCapabilitiesKHR,
5573 ) -> api::VkResult {
5577 #[allow(non_snake_case)]
5578 pub unsafe extern "system" fn vkGetDeviceGroupSurfacePresentModesKHR(
5579 _device: api::VkDevice,
5580 _surface: api::VkSurfaceKHR,
5581 _pModes: *mut api::VkDeviceGroupPresentModeFlagsKHR,
5582 ) -> api::VkResult {
5586 #[allow(non_snake_case)]
5587 pub unsafe extern "system" fn vkGetPhysicalDevicePresentRectanglesKHR(
5588 _physicalDevice: api::VkPhysicalDevice,
5589 _surface: api::VkSurfaceKHR,
5590 _pRectCount: *mut u32,
5591 _pRects: *mut api::VkRect2D,
5592 ) -> api::VkResult {
5596 #[allow(non_snake_case)]
5597 pub unsafe extern "system" fn vkAcquireNextImage2KHR(
5598 _device: api::VkDevice,
5599 _pAcquireInfo: *const api::VkAcquireNextImageInfoKHR,
5600 _pImageIndex: *mut u32,
5601 ) -> api::VkResult {
5605 #[allow(non_snake_case)]
5606 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPropertiesKHR(
5607 _physicalDevice: api::VkPhysicalDevice,
5608 _pPropertyCount: *mut u32,
5609 _pProperties: *mut api::VkDisplayPropertiesKHR,
5610 ) -> api::VkResult {
5614 #[allow(non_snake_case)]
5615 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
5616 _physicalDevice: api::VkPhysicalDevice,
5617 _pPropertyCount: *mut u32,
5618 _pProperties: *mut api::VkDisplayPlanePropertiesKHR,
5619 ) -> api::VkResult {
5623 #[allow(non_snake_case)]
5624 pub unsafe extern "system" fn vkGetDisplayPlaneSupportedDisplaysKHR(
5625 _physicalDevice: api::VkPhysicalDevice,
5627 _pDisplayCount: *mut u32,
5628 _pDisplays: *mut api::VkDisplayKHR,
5629 ) -> api::VkResult {
5633 #[allow(non_snake_case)]
5634 pub unsafe extern "system" fn vkGetDisplayModePropertiesKHR(
5635 _physicalDevice: api::VkPhysicalDevice,
5636 _display: api::VkDisplayKHR,
5637 _pPropertyCount: *mut u32,
5638 _pProperties: *mut api::VkDisplayModePropertiesKHR,
5639 ) -> api::VkResult {
5643 #[allow(non_snake_case)]
5644 pub unsafe extern "system" fn vkCreateDisplayModeKHR(
5645 _physicalDevice: api::VkPhysicalDevice,
5646 _display: api::VkDisplayKHR,
5647 _pCreateInfo: *const api::VkDisplayModeCreateInfoKHR,
5648 _pAllocator: *const api::VkAllocationCallbacks,
5649 _pMode: *mut api::VkDisplayModeKHR,
5650 ) -> api::VkResult {
5654 #[allow(non_snake_case)]
5655 pub unsafe extern "system" fn vkGetDisplayPlaneCapabilitiesKHR(
5656 _physicalDevice: api::VkPhysicalDevice,
5657 _mode: api::VkDisplayModeKHR,
5659 _pCapabilities: *mut api::VkDisplayPlaneCapabilitiesKHR,
5660 ) -> api::VkResult {
5664 #[allow(non_snake_case)]
5665 pub unsafe extern "system" fn vkCreateDisplayPlaneSurfaceKHR(
5666 _instance: api::VkInstance,
5667 _pCreateInfo: *const api::VkDisplaySurfaceCreateInfoKHR,
5668 _pAllocator: *const api::VkAllocationCallbacks,
5669 _pSurface: *mut api::VkSurfaceKHR,
5670 ) -> api::VkResult {
5674 #[allow(non_snake_case)]
5675 pub unsafe extern "system" fn vkCreateSharedSwapchainsKHR(
5676 _device: api::VkDevice,
5677 _swapchainCount: u32,
5678 _pCreateInfos: *const api::VkSwapchainCreateInfoKHR,
5679 _pAllocator: *const api::VkAllocationCallbacks,
5680 _pSwapchains: *mut api::VkSwapchainKHR,
5681 ) -> api::VkResult {
5685 #[allow(non_snake_case)]
5686 pub unsafe extern "system" fn vkGetMemoryFdKHR(
5687 _device: api::VkDevice,
5688 _pGetFdInfo: *const api::VkMemoryGetFdInfoKHR,
5690 ) -> api::VkResult {
5694 #[allow(non_snake_case)]
5695 pub unsafe extern "system" fn vkGetMemoryFdPropertiesKHR(
5696 _device: api::VkDevice,
5697 _handleType: api::VkExternalMemoryHandleTypeFlagBits,
5699 _pMemoryFdProperties: *mut api::VkMemoryFdPropertiesKHR,
5700 ) -> api::VkResult {
5704 #[allow(non_snake_case)]
5705 pub unsafe extern "system" fn vkImportSemaphoreFdKHR(
5706 _device: api::VkDevice,
5707 _pImportSemaphoreFdInfo: *const api::VkImportSemaphoreFdInfoKHR,
5708 ) -> api::VkResult {
5712 #[allow(non_snake_case)]
5713 pub unsafe extern "system" fn vkGetSemaphoreFdKHR(
5714 _device: api::VkDevice,
5715 _pGetFdInfo: *const api::VkSemaphoreGetFdInfoKHR,
5717 ) -> api::VkResult {
5721 #[allow(non_snake_case)]
5722 pub unsafe extern "system" fn vkCmdPushDescriptorSetKHR(
5723 _commandBuffer: api::VkCommandBuffer,
5724 _pipelineBindPoint: api::VkPipelineBindPoint,
5725 _layout: api::VkPipelineLayout,
5727 _descriptorWriteCount: u32,
5728 _pDescriptorWrites: *const api::VkWriteDescriptorSet,
5733 #[allow(non_snake_case)]
5734 pub unsafe extern "system" fn vkCmdPushDescriptorSetWithTemplateKHR(
5735 _commandBuffer: api::VkCommandBuffer,
5736 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5737 _layout: api::VkPipelineLayout,
5739 _pData: *const c_void,
5744 #[allow(non_snake_case)]
5745 pub unsafe extern "system" fn vkCreateRenderPass2KHR(
5746 _device: api::VkDevice,
5747 _pCreateInfo: *const api::VkRenderPassCreateInfo2KHR,
5748 _pAllocator: *const api::VkAllocationCallbacks,
5749 _pRenderPass: *mut api::VkRenderPass,
5750 ) -> api::VkResult {
5754 #[allow(non_snake_case)]
5755 pub unsafe extern "system" fn vkCmdBeginRenderPass2KHR(
5756 _commandBuffer: api::VkCommandBuffer,
5757 _pRenderPassBegin: *const api::VkRenderPassBeginInfo,
5758 _pSubpassBeginInfo: *const api::VkSubpassBeginInfoKHR,
5763 #[allow(non_snake_case)]
5764 pub unsafe extern "system" fn vkCmdNextSubpass2KHR(
5765 _commandBuffer: api::VkCommandBuffer,
5766 _pSubpassBeginInfo: *const api::VkSubpassBeginInfoKHR,
5767 _pSubpassEndInfo: *const api::VkSubpassEndInfoKHR,
5772 #[allow(non_snake_case)]
5773 pub unsafe extern "system" fn vkCmdEndRenderPass2KHR(
5774 _commandBuffer: api::VkCommandBuffer,
5775 _pSubpassEndInfo: *const api::VkSubpassEndInfoKHR,
5780 #[allow(non_snake_case)]
5781 pub unsafe extern "system" fn vkGetSwapchainStatusKHR(
5782 _device: api::VkDevice,
5783 _swapchain: api::VkSwapchainKHR,
5784 ) -> api::VkResult {
5788 #[allow(non_snake_case)]
5789 pub unsafe extern "system" fn vkImportFenceFdKHR(
5790 _device: api::VkDevice,
5791 _pImportFenceFdInfo: *const api::VkImportFenceFdInfoKHR,
5792 ) -> api::VkResult {
5796 #[allow(non_snake_case)]
5797 pub unsafe extern "system" fn vkGetFenceFdKHR(
5798 _device: api::VkDevice,
5799 _pGetFdInfo: *const api::VkFenceGetFdInfoKHR,
5801 ) -> api::VkResult {
5805 #[allow(non_snake_case)]
5806 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilities2KHR(
5807 _physical_device: api::VkPhysicalDevice,
5808 surface_info: *const api::VkPhysicalDeviceSurfaceInfo2KHR,
5809 surface_capabilities: *mut api::VkSurfaceCapabilities2KHR,
5810 ) -> api::VkResult {
5811 parse_next_chain_const!{
5813 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR,
5815 let ref surface_info = *surface_info;
5816 parse_next_chain_mut!{
5817 surface_capabilities,
5818 root = api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
5820 let ref mut surface_capabilities = *surface_capabilities;
5821 let surface_implementation =
5822 SurfacePlatform::from(SharedHandle::from(surface_info.surface).unwrap().platform)
5824 .get_surface_implementation();
5825 match surface_implementation.get_capabilities(surface_info.surface) {
5826 Ok(capabilities) => {
5827 surface_capabilities.surfaceCapabilities = capabilities;
5830 Err(result) => result,
5834 #[allow(non_snake_case)]
5835 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceFormats2KHR(
5836 _physicalDevice: api::VkPhysicalDevice,
5837 _pSurfaceInfo: *const api::VkPhysicalDeviceSurfaceInfo2KHR,
5838 _pSurfaceFormatCount: *mut u32,
5839 _pSurfaceFormats: *mut api::VkSurfaceFormat2KHR,
5840 ) -> api::VkResult {
5844 #[allow(non_snake_case)]
5845 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayProperties2KHR(
5846 _physicalDevice: api::VkPhysicalDevice,
5847 _pPropertyCount: *mut u32,
5848 _pProperties: *mut api::VkDisplayProperties2KHR,
5849 ) -> api::VkResult {
5853 #[allow(non_snake_case)]
5854 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPlaneProperties2KHR(
5855 _physicalDevice: api::VkPhysicalDevice,
5856 _pPropertyCount: *mut u32,
5857 _pProperties: *mut api::VkDisplayPlaneProperties2KHR,
5858 ) -> api::VkResult {
5862 #[allow(non_snake_case)]
5863 pub unsafe extern "system" fn vkGetDisplayModeProperties2KHR(
5864 _physicalDevice: api::VkPhysicalDevice,
5865 _display: api::VkDisplayKHR,
5866 _pPropertyCount: *mut u32,
5867 _pProperties: *mut api::VkDisplayModeProperties2KHR,
5868 ) -> api::VkResult {
5872 #[allow(non_snake_case)]
5873 pub unsafe extern "system" fn vkGetDisplayPlaneCapabilities2KHR(
5874 _physicalDevice: api::VkPhysicalDevice,
5875 _pDisplayPlaneInfo: *const api::VkDisplayPlaneInfo2KHR,
5876 _pCapabilities: *mut api::VkDisplayPlaneCapabilities2KHR,
5877 ) -> api::VkResult {
5881 #[allow(non_snake_case)]
5882 pub unsafe extern "system" fn vkCmdDrawIndirectCountKHR(
5883 _commandBuffer: api::VkCommandBuffer,
5884 _buffer: api::VkBuffer,
5885 _offset: api::VkDeviceSize,
5886 _countBuffer: api::VkBuffer,
5887 _countBufferOffset: api::VkDeviceSize,
5894 #[allow(non_snake_case)]
5895 pub unsafe extern "system" fn vkCmdDrawIndexedIndirectCountKHR(
5896 _commandBuffer: api::VkCommandBuffer,
5897 _buffer: api::VkBuffer,
5898 _offset: api::VkDeviceSize,
5899 _countBuffer: api::VkBuffer,
5900 _countBufferOffset: api::VkDeviceSize,
5907 #[allow(non_snake_case)]
5908 pub unsafe extern "system" fn vkCreateDebugReportCallbackEXT(
5909 _instance: api::VkInstance,
5910 _pCreateInfo: *const api::VkDebugReportCallbackCreateInfoEXT,
5911 _pAllocator: *const api::VkAllocationCallbacks,
5912 _pCallback: *mut api::VkDebugReportCallbackEXT,
5913 ) -> api::VkResult {
5917 #[allow(non_snake_case)]
5918 pub unsafe extern "system" fn vkDestroyDebugReportCallbackEXT(
5919 _instance: api::VkInstance,
5920 _callback: api::VkDebugReportCallbackEXT,
5921 _pAllocator: *const api::VkAllocationCallbacks,
5926 #[allow(non_snake_case)]
5927 pub unsafe extern "system" fn vkDebugReportMessageEXT(
5928 _instance: api::VkInstance,
5929 _flags: api::VkDebugReportFlagsEXT,
5930 _objectType: api::VkDebugReportObjectTypeEXT,
5934 _pLayerPrefix: *const c_char,
5935 _pMessage: *const c_char,
5940 #[allow(non_snake_case)]
5941 pub unsafe extern "system" fn vkDebugMarkerSetObjectTagEXT(
5942 _device: api::VkDevice,
5943 _pTagInfo: *const api::VkDebugMarkerObjectTagInfoEXT,
5944 ) -> api::VkResult {
5948 #[allow(non_snake_case)]
5949 pub unsafe extern "system" fn vkDebugMarkerSetObjectNameEXT(
5950 _device: api::VkDevice,
5951 _pNameInfo: *const api::VkDebugMarkerObjectNameInfoEXT,
5952 ) -> api::VkResult {
5956 #[allow(non_snake_case)]
5957 pub unsafe extern "system" fn vkCmdDebugMarkerBeginEXT(
5958 _commandBuffer: api::VkCommandBuffer,
5959 _pMarkerInfo: *const api::VkDebugMarkerMarkerInfoEXT,
5964 #[allow(non_snake_case)]
5965 pub unsafe extern "system" fn vkCmdDebugMarkerEndEXT(_commandBuffer: api::VkCommandBuffer) {
5969 #[allow(non_snake_case)]
5970 pub unsafe extern "system" fn vkCmdDebugMarkerInsertEXT(
5971 _commandBuffer: api::VkCommandBuffer,
5972 _pMarkerInfo: *const api::VkDebugMarkerMarkerInfoEXT,
5977 #[allow(non_snake_case)]
5978 pub unsafe extern "system" fn vkCmdDrawIndirectCountAMD(
5979 _commandBuffer: api::VkCommandBuffer,
5980 _buffer: api::VkBuffer,
5981 _offset: api::VkDeviceSize,
5982 _countBuffer: api::VkBuffer,
5983 _countBufferOffset: api::VkDeviceSize,
5990 #[allow(non_snake_case)]
5991 pub unsafe extern "system" fn vkCmdDrawIndexedIndirectCountAMD(
5992 _commandBuffer: api::VkCommandBuffer,
5993 _buffer: api::VkBuffer,
5994 _offset: api::VkDeviceSize,
5995 _countBuffer: api::VkBuffer,
5996 _countBufferOffset: api::VkDeviceSize,
6003 #[allow(non_snake_case)]
6004 pub unsafe extern "system" fn vkGetShaderInfoAMD(
6005 _device: api::VkDevice,
6006 _pipeline: api::VkPipeline,
6007 _shaderStage: api::VkShaderStageFlagBits,
6008 _infoType: api::VkShaderInfoTypeAMD,
6009 _pInfoSize: *mut usize,
6010 _pInfo: *mut c_void,
6011 ) -> api::VkResult {
6015 #[allow(non_snake_case)]
6016 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
6017 _physicalDevice: api::VkPhysicalDevice,
6018 _format: api::VkFormat,
6019 _type_: api::VkImageType,
6020 _tiling: api::VkImageTiling,
6021 _usage: api::VkImageUsageFlags,
6022 _flags: api::VkImageCreateFlags,
6023 _externalHandleType: api::VkExternalMemoryHandleTypeFlagsNV,
6024 _pExternalImageFormatProperties: *mut api::VkExternalImageFormatPropertiesNV,
6025 ) -> api::VkResult {
6029 #[allow(non_snake_case)]
6030 pub unsafe extern "system" fn vkCmdBeginConditionalRenderingEXT(
6031 _commandBuffer: api::VkCommandBuffer,
6032 _pConditionalRenderingBegin: *const api::VkConditionalRenderingBeginInfoEXT,
6037 #[allow(non_snake_case)]
6038 pub unsafe extern "system" fn vkCmdEndConditionalRenderingEXT(
6039 _commandBuffer: api::VkCommandBuffer,
6044 #[allow(non_snake_case)]
6045 pub unsafe extern "system" fn vkCmdSetViewportWScalingNV(
6046 _commandBuffer: api::VkCommandBuffer,
6047 _firstViewport: u32,
6048 _viewportCount: u32,
6049 _pViewportWScalings: *const api::VkViewportWScalingNV,
6054 #[allow(non_snake_case)]
6055 pub unsafe extern "system" fn vkReleaseDisplayEXT(
6056 _physicalDevice: api::VkPhysicalDevice,
6057 _display: api::VkDisplayKHR,
6058 ) -> api::VkResult {
6062 #[allow(non_snake_case)]
6063 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilities2EXT(
6064 _physicalDevice: api::VkPhysicalDevice,
6065 _surface: api::VkSurfaceKHR,
6066 _pSurfaceCapabilities: *mut api::VkSurfaceCapabilities2EXT,
6067 ) -> api::VkResult {
6071 #[allow(non_snake_case)]
6072 pub unsafe extern "system" fn vkDisplayPowerControlEXT(
6073 _device: api::VkDevice,
6074 _display: api::VkDisplayKHR,
6075 _pDisplayPowerInfo: *const api::VkDisplayPowerInfoEXT,
6076 ) -> api::VkResult {
6080 #[allow(non_snake_case)]
6081 pub unsafe extern "system" fn vkRegisterDeviceEventEXT(
6082 _device: api::VkDevice,
6083 _pDeviceEventInfo: *const api::VkDeviceEventInfoEXT,
6084 _pAllocator: *const api::VkAllocationCallbacks,
6085 _pFence: *mut api::VkFence,
6086 ) -> api::VkResult {
6090 #[allow(non_snake_case)]
6091 pub unsafe extern "system" fn vkRegisterDisplayEventEXT(
6092 _device: api::VkDevice,
6093 _display: api::VkDisplayKHR,
6094 _pDisplayEventInfo: *const api::VkDisplayEventInfoEXT,
6095 _pAllocator: *const api::VkAllocationCallbacks,
6096 _pFence: *mut api::VkFence,
6097 ) -> api::VkResult {
6101 #[allow(non_snake_case)]
6102 pub unsafe extern "system" fn vkGetSwapchainCounterEXT(
6103 _device: api::VkDevice,
6104 _swapchain: api::VkSwapchainKHR,
6105 _counter: api::VkSurfaceCounterFlagBitsEXT,
6106 _pCounterValue: *mut u64,
6107 ) -> api::VkResult {
6111 #[allow(non_snake_case)]
6112 pub unsafe extern "system" fn vkGetRefreshCycleDurationGOOGLE(
6113 _device: api::VkDevice,
6114 _swapchain: api::VkSwapchainKHR,
6115 _pDisplayTimingProperties: *mut api::VkRefreshCycleDurationGOOGLE,
6116 ) -> api::VkResult {
6120 #[allow(non_snake_case)]
6121 pub unsafe extern "system" fn vkGetPastPresentationTimingGOOGLE(
6122 _device: api::VkDevice,
6123 _swapchain: api::VkSwapchainKHR,
6124 _pPresentationTimingCount: *mut u32,
6125 _pPresentationTimings: *mut api::VkPastPresentationTimingGOOGLE,
6126 ) -> api::VkResult {
6130 #[allow(non_snake_case)]
6131 pub unsafe extern "system" fn vkCmdSetDiscardRectangleEXT(
6132 _commandBuffer: api::VkCommandBuffer,
6133 _firstDiscardRectangle: u32,
6134 _discardRectangleCount: u32,
6135 _pDiscardRectangles: *const api::VkRect2D,
6140 #[allow(non_snake_case)]
6141 pub unsafe extern "system" fn vkSetHdrMetadataEXT(
6142 _device: api::VkDevice,
6143 _swapchainCount: u32,
6144 _pSwapchains: *const api::VkSwapchainKHR,
6145 _pMetadata: *const api::VkHdrMetadataEXT,
6150 #[allow(non_snake_case)]
6151 pub unsafe extern "system" fn vkSetDebugUtilsObjectNameEXT(
6152 _device: api::VkDevice,
6153 _pNameInfo: *const api::VkDebugUtilsObjectNameInfoEXT,
6154 ) -> api::VkResult {
6158 #[allow(non_snake_case)]
6159 pub unsafe extern "system" fn vkSetDebugUtilsObjectTagEXT(
6160 _device: api::VkDevice,
6161 _pTagInfo: *const api::VkDebugUtilsObjectTagInfoEXT,
6162 ) -> api::VkResult {
6166 #[allow(non_snake_case)]
6167 pub unsafe extern "system" fn vkQueueBeginDebugUtilsLabelEXT(
6168 _queue: api::VkQueue,
6169 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6174 #[allow(non_snake_case)]
6175 pub unsafe extern "system" fn vkQueueEndDebugUtilsLabelEXT(_queue: api::VkQueue) {
6179 #[allow(non_snake_case)]
6180 pub unsafe extern "system" fn vkQueueInsertDebugUtilsLabelEXT(
6181 _queue: api::VkQueue,
6182 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6187 #[allow(non_snake_case)]
6188 pub unsafe extern "system" fn vkCmdBeginDebugUtilsLabelEXT(
6189 _commandBuffer: api::VkCommandBuffer,
6190 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6195 #[allow(non_snake_case)]
6196 pub unsafe extern "system" fn vkCmdEndDebugUtilsLabelEXT(_commandBuffer: api::VkCommandBuffer) {
6200 #[allow(non_snake_case)]
6201 pub unsafe extern "system" fn vkCmdInsertDebugUtilsLabelEXT(
6202 _commandBuffer: api::VkCommandBuffer,
6203 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6208 #[allow(non_snake_case)]
6209 pub unsafe extern "system" fn vkCreateDebugUtilsMessengerEXT(
6210 _instance: api::VkInstance,
6211 _pCreateInfo: *const api::VkDebugUtilsMessengerCreateInfoEXT,
6212 _pAllocator: *const api::VkAllocationCallbacks,
6213 _pMessenger: *mut api::VkDebugUtilsMessengerEXT,
6214 ) -> api::VkResult {
6218 #[allow(non_snake_case)]
6219 pub unsafe extern "system" fn vkDestroyDebugUtilsMessengerEXT(
6220 _instance: api::VkInstance,
6221 _messenger: api::VkDebugUtilsMessengerEXT,
6222 _pAllocator: *const api::VkAllocationCallbacks,
6227 #[allow(non_snake_case)]
6228 pub unsafe extern "system" fn vkSubmitDebugUtilsMessageEXT(
6229 _instance: api::VkInstance,
6230 _messageSeverity: api::VkDebugUtilsMessageSeverityFlagBitsEXT,
6231 _messageTypes: api::VkDebugUtilsMessageTypeFlagsEXT,
6232 _pCallbackData: *const api::VkDebugUtilsMessengerCallbackDataEXT,
6237 #[allow(non_snake_case)]
6238 pub unsafe extern "system" fn vkCmdSetSampleLocationsEXT(
6239 _commandBuffer: api::VkCommandBuffer,
6240 _pSampleLocationsInfo: *const api::VkSampleLocationsInfoEXT,
6245 #[allow(non_snake_case)]
6246 pub unsafe extern "system" fn vkGetPhysicalDeviceMultisamplePropertiesEXT(
6247 _physicalDevice: api::VkPhysicalDevice,
6248 _samples: api::VkSampleCountFlagBits,
6249 _pMultisampleProperties: *mut api::VkMultisamplePropertiesEXT,
6254 #[allow(non_snake_case)]
6255 pub unsafe extern "system" fn vkCreateValidationCacheEXT(
6256 _device: api::VkDevice,
6257 _pCreateInfo: *const api::VkValidationCacheCreateInfoEXT,
6258 _pAllocator: *const api::VkAllocationCallbacks,
6259 _pValidationCache: *mut api::VkValidationCacheEXT,
6260 ) -> api::VkResult {
6264 #[allow(non_snake_case)]
6265 pub unsafe extern "system" fn vkDestroyValidationCacheEXT(
6266 _device: api::VkDevice,
6267 _validationCache: api::VkValidationCacheEXT,
6268 _pAllocator: *const api::VkAllocationCallbacks,
6273 #[allow(non_snake_case)]
6274 pub unsafe extern "system" fn vkMergeValidationCachesEXT(
6275 _device: api::VkDevice,
6276 _dstCache: api::VkValidationCacheEXT,
6277 _srcCacheCount: u32,
6278 _pSrcCaches: *const api::VkValidationCacheEXT,
6279 ) -> api::VkResult {
6283 #[allow(non_snake_case)]
6284 pub unsafe extern "system" fn vkGetValidationCacheDataEXT(
6285 _device: api::VkDevice,
6286 _validationCache: api::VkValidationCacheEXT,
6287 _pDataSize: *mut usize,
6288 _pData: *mut c_void,
6289 ) -> api::VkResult {
6293 #[allow(non_snake_case)]
6294 pub unsafe extern "system" fn vkCmdBindShadingRateImageNV(
6295 _commandBuffer: api::VkCommandBuffer,
6296 _imageView: api::VkImageView,
6297 _imageLayout: api::VkImageLayout,
6302 #[allow(non_snake_case)]
6303 pub unsafe extern "system" fn vkCmdSetViewportShadingRatePaletteNV(
6304 _commandBuffer: api::VkCommandBuffer,
6305 _firstViewport: u32,
6306 _viewportCount: u32,
6307 _pShadingRatePalettes: *const api::VkShadingRatePaletteNV,
6312 #[allow(non_snake_case)]
6313 pub unsafe extern "system" fn vkCmdSetCoarseSampleOrderNV(
6314 _commandBuffer: api::VkCommandBuffer,
6315 _sampleOrderType: api::VkCoarseSampleOrderTypeNV,
6316 _customSampleOrderCount: u32,
6317 _pCustomSampleOrders: *const api::VkCoarseSampleOrderCustomNV,
6322 #[allow(non_snake_case)]
6323 pub unsafe extern "system" fn vkGetMemoryHostPointerPropertiesEXT(
6324 _device: api::VkDevice,
6325 _handleType: api::VkExternalMemoryHandleTypeFlagBits,
6326 _pHostPointer: *const c_void,
6327 _pMemoryHostPointerProperties: *mut api::VkMemoryHostPointerPropertiesEXT,
6328 ) -> api::VkResult {
6332 #[allow(non_snake_case)]
6333 pub unsafe extern "system" fn vkCmdWriteBufferMarkerAMD(
6334 _commandBuffer: api::VkCommandBuffer,
6335 _pipelineStage: api::VkPipelineStageFlagBits,
6336 _dstBuffer: api::VkBuffer,
6337 _dstOffset: api::VkDeviceSize,
6343 #[allow(non_snake_case)]
6344 pub unsafe extern "system" fn vkCmdDrawMeshTasksNV(
6345 _commandBuffer: api::VkCommandBuffer,
6352 #[allow(non_snake_case)]
6353 pub unsafe extern "system" fn vkCmdDrawMeshTasksIndirectNV(
6354 _commandBuffer: api::VkCommandBuffer,
6355 _buffer: api::VkBuffer,
6356 _offset: api::VkDeviceSize,
6363 #[allow(non_snake_case)]
6364 pub unsafe extern "system" fn vkCmdDrawMeshTasksIndirectCountNV(
6365 _commandBuffer: api::VkCommandBuffer,
6366 _buffer: api::VkBuffer,
6367 _offset: api::VkDeviceSize,
6368 _countBuffer: api::VkBuffer,
6369 _countBufferOffset: api::VkDeviceSize,
6376 #[allow(non_snake_case)]
6377 pub unsafe extern "system" fn vkCmdSetExclusiveScissorNV(
6378 _commandBuffer: api::VkCommandBuffer,
6379 _firstExclusiveScissor: u32,
6380 _exclusiveScissorCount: u32,
6381 _pExclusiveScissors: *const api::VkRect2D,
6386 #[allow(non_snake_case)]
6387 pub unsafe extern "system" fn vkCmdSetCheckpointNV(
6388 _commandBuffer: api::VkCommandBuffer,
6389 _pCheckpointMarker: *const c_void,
6394 #[allow(non_snake_case)]
6395 pub unsafe extern "system" fn vkGetQueueCheckpointDataNV(
6396 _queue: api::VkQueue,
6397 _pCheckpointDataCount: *mut u32,
6398 _pCheckpointData: *mut api::VkCheckpointDataNV,
6404 #[allow(non_snake_case)]
6405 pub unsafe extern "system" fn vkCreateXcbSurfaceKHR(
6406 _instance: api::VkInstance,
6407 create_info: *const api::VkXcbSurfaceCreateInfoKHR,
6408 _allocator: *const api::VkAllocationCallbacks,
6409 surface: *mut api::VkSurfaceKHR,
6410 ) -> api::VkResult {
6411 parse_next_chain_const!{
6413 root = api::VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR,
6415 let ref create_info = *create_info;
6416 let new_surface = Box::new(api::VkIcdSurfaceXcb {
6417 base: api::VkIcdSurfaceBase {
6418 platform: api::VK_ICD_WSI_PLATFORM_XCB,
6420 connection: create_info.connection,
6421 window: create_info.window,
6423 *surface = api::VkSurfaceKHR::new(NonNull::new(
6424 Box::into_raw(new_surface) as *mut api::VkIcdSurfaceBase
6430 #[allow(non_snake_case)]
6431 pub unsafe extern "system" fn vkGetPhysicalDeviceXcbPresentationSupportKHR(
6432 _physicalDevice: api::VkPhysicalDevice,
6433 _queueFamilyIndex: u32,
6434 _connection: *mut xcb::ffi::xcb_connection_t,
6435 _visual_id: xcb::ffi::xcb_visualid_t,
6436 ) -> api::VkBool32 {