1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 // Copyright 2018 Jacob Lifshay
5 use buffer::{Buffer, BufferMemory};
8 DeviceMemory, DeviceMemoryAllocation, DeviceMemoryHeap, DeviceMemoryHeaps, DeviceMemoryLayout,
9 DeviceMemoryType, DeviceMemoryTypes,
11 use enum_map::EnumMap;
12 use handle::{Handle, MutHandle, OwnedHandle, SharedHandle};
13 use image::{Image, ImageMemory, ImageMultisampleCount, ImageProperties, SupportedTilings};
16 use shader_module::ShaderModule;
19 use std::iter::FromIterator;
22 use std::os::raw::{c_char, c_int, c_void};
24 use std::ptr::null_mut;
26 use std::ptr::NonNull;
28 use std::str::FromStr;
29 use swapchain::{SurfaceImplementation, SurfacePlatform, Swapchain};
35 /// structure types the driver should know about
36 fn is_supported_structure_type(v: api::VkStructureType) -> bool {
40 api::VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR => return true,
45 api::VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR
46 | api::VK_STRUCTURE_TYPE_APPLICATION_INFO
47 | api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO
48 | api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO
49 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO
50 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO
51 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR
52 | api::VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO
53 | api::VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
54 | api::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
55 | api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
56 | api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2
57 | api::VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
58 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
59 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
60 | api::VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO
61 | api::VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
62 | api::VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
63 | api::VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
64 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
65 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
66 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
67 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT
68 | api::VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO
69 | api::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
70 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO
71 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO
72 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO
73 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR
74 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR
75 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO
76 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO
77 | api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR
78 | api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
79 | api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2
80 | api::VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
81 | api::VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO
82 | api::VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO
83 | api::VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO
84 | api::VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES
85 | api::VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES
86 | api::VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES
87 | api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO
88 | api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO
89 | api::VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES
90 | api::VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
91 | api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2
92 | api::VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
93 | api::VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
94 | api::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
95 | api::VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2
96 | api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
97 | api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2
98 | api::VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO
99 | api::VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2
100 | api::VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR
101 | api::VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
102 | api::VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO
103 | api::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
104 | api::VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
105 | api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO
106 | api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
107 | api::VK_STRUCTURE_TYPE_MEMORY_BARRIER
108 | api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO
109 | api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS
110 | api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2
111 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES
112 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO
113 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO
114 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO
115 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO
116 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2
117 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES
118 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES
119 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2
120 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES
121 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2
122 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES
123 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES
124 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES
125 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2
126 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES
127 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES
128 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES
129 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES
130 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2
131 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES
132 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR
133 | api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES
134 | api::VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
135 | api::VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
136 | api::VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
137 | api::VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
138 | api::VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
139 | api::VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
140 | api::VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
141 | api::VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
142 | api::VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
143 | api::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO
144 | api::VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
145 | api::VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
146 | api::VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
147 | api::VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
148 | api::VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO
149 | api::VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
150 | api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2
151 | api::VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
152 | api::VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
153 | api::VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO
154 | api::VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO
155 | api::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
156 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO
157 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES
158 | api::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO
159 | api::VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
160 | api::VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
161 | api::VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2
162 | api::VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2
163 | api::VK_STRUCTURE_TYPE_SUBMIT_INFO
164 | api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR
165 | api::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
166 | api::VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET => true,
171 fn verify_structure_type_is_supported(v: api::VkStructureType) {
173 is_supported_structure_type(v),
174 "missing structure type in is_supported_structure_type: {:?}",
179 unsafe fn parse_next_chain_const(
180 root: *const api::VkBaseInStructure,
181 expected_root_struct_type: api::VkStructureType,
182 expected_child_structs: &[(api::VkStructureType, *mut *const api::VkBaseInStructure)],
184 verify_structure_type_is_supported(expected_root_struct_type);
185 let ref root = *root;
186 assert_eq!(root.sType, expected_root_struct_type);
187 for &(child_struct_type, child_struct) in expected_child_structs.iter() {
188 verify_structure_type_is_supported(child_struct_type);
189 *child_struct = null();
191 let mut child = root.pNext as *const api::VkBaseInStructure;
192 while !child.is_null() {
193 let ref child_ref = *child;
194 let search_for_type = child_ref.sType;
195 let mut found = false;
196 for &(child_struct_type, child_struct) in expected_child_structs.iter() {
197 if child_struct_type == search_for_type {
199 (*child_struct).is_null(),
200 "duplicate struct type in pNext chain: {:?}",
203 *child_struct = child;
209 found || !is_supported_structure_type(search_for_type),
210 "unexpected struct type in pNext chain: {:?}",
213 child = child_ref.pNext as *const _;
217 unsafe fn parse_next_chain_mut(
218 root: *mut api::VkBaseOutStructure,
219 expected_root_struct_type: api::VkStructureType,
220 expected_child_structs: &[(api::VkStructureType, *mut *mut api::VkBaseOutStructure)],
222 parse_next_chain_const(
223 root as *const api::VkBaseInStructure,
224 expected_root_struct_type,
225 mem::transmute(expected_child_structs),
229 macro_rules! parse_next_chain_const {
232 root = $root_type:expr,
233 $($name:ident: $var_type:ty = $struct_type:expr,)*
235 $(let mut $name: *const $var_type = null();)*
236 parse_next_chain_const(
237 $root as *const api::VkBaseInStructure,
239 &[$(($struct_type, &mut $name as *mut *const $var_type as *mut *const api::VkBaseInStructure)),*]
244 macro_rules! parse_next_chain_mut {
247 root = $root_type:expr,
248 $($name:ident: $var_type:ty = $struct_type:expr,)*
250 $(let mut $name: *mut $var_type = null_mut();)*
251 parse_next_chain_mut(
252 $root as *mut api::VkBaseOutStructure,
254 &[$(($struct_type, &mut $name as *mut *mut $var_type as *mut *mut api::VkBaseOutStructure)),*]
259 fn copy_str_to_char_array(dest: &mut [c_char], src: &str) {
260 assert!(dest.len() >= src.len() + 1);
261 let src = src.as_bytes();
262 for i in 0..src.len() {
263 dest[i] = src[i] as c_char;
265 for i in src.len()..dest.len() {
270 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Enum)]
272 #[allow(non_camel_case_types)]
276 VK_KHR_device_group_creation,
278 VK_KHR_descriptor_update_template,
280 VK_KHR_get_memory_requirements2,
281 VK_KHR_get_physical_device_properties2,
282 VK_KHR_sampler_ycbcr_conversion,
285 VK_KHR_external_memory_capabilities,
286 VK_KHR_external_fence_capabilities,
287 VK_KHR_external_semaphore_capabilities,
288 VK_KHR_16bit_storage,
289 VK_KHR_storage_buffer_storage_class,
290 VK_KHR_dedicated_allocation,
291 VK_KHR_external_fence,
292 VK_KHR_external_memory,
293 VK_KHR_external_semaphore,
295 VK_KHR_relaxed_block_layout,
296 VK_KHR_shader_draw_parameters,
297 VK_KHR_variable_pointers,
303 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
304 pub enum ExtensionScope {
309 macro_rules! extensions {
310 [$($extension:expr),*] => {
312 let extensions: Extensions = [$($extension),*].iter().map(|v|*v).collect();
319 pub fn get_required_extensions(self) -> Extensions {
321 Extension::VK_KHR_surface
322 | Extension::VK_KHR_bind_memory2
323 | Extension::VK_KHR_device_group_creation
324 | Extension::VK_KHR_descriptor_update_template
325 | Extension::VK_KHR_maintenance1
326 | Extension::VK_KHR_get_memory_requirements2
327 | Extension::VK_KHR_get_physical_device_properties2
328 | Extension::VK_KHR_maintenance2
329 | Extension::VK_KHR_storage_buffer_storage_class
330 | Extension::VK_KHR_relaxed_block_layout
331 | Extension::VK_KHR_shader_draw_parameters => extensions![],
332 Extension::VK_KHR_device_group => extensions![Extension::VK_KHR_device_group_creation],
333 Extension::VK_KHR_sampler_ycbcr_conversion => extensions![
334 Extension::VK_KHR_maintenance1,
335 Extension::VK_KHR_bind_memory2,
336 Extension::VK_KHR_get_memory_requirements2,
337 Extension::VK_KHR_get_physical_device_properties2
339 Extension::VK_KHR_maintenance3
340 | Extension::VK_KHR_external_memory_capabilities
341 | Extension::VK_KHR_external_fence_capabilities
342 | Extension::VK_KHR_external_semaphore_capabilities
343 | Extension::VK_KHR_multiview => {
344 extensions![Extension::VK_KHR_get_physical_device_properties2]
346 Extension::VK_KHR_16bit_storage | Extension::VK_KHR_variable_pointers => extensions![
347 Extension::VK_KHR_get_physical_device_properties2,
348 Extension::VK_KHR_storage_buffer_storage_class
350 Extension::VK_KHR_dedicated_allocation => {
351 extensions![Extension::VK_KHR_get_memory_requirements2]
353 Extension::VK_KHR_external_fence => {
354 extensions![Extension::VK_KHR_external_fence_capabilities]
356 Extension::VK_KHR_external_memory => {
357 extensions![Extension::VK_KHR_external_memory_capabilities]
359 Extension::VK_KHR_external_semaphore => {
360 extensions![Extension::VK_KHR_external_semaphore_capabilities]
362 Extension::VK_KHR_swapchain => extensions![Extension::VK_KHR_surface],
364 Extension::VK_KHR_xcb_surface => extensions![Extension::VK_KHR_surface],
367 pub fn get_recursively_required_extensions(self) -> Extensions {
368 let mut retval = self.get_required_extensions();
369 let mut worklist: EnumMap<Extension, Extension> = enum_map!{_ => self};
370 let worklist = worklist.as_mut_slice();
371 let mut worklist_size = 1;
372 while worklist_size > 0 {
374 let extension = worklist[worklist_size];
375 retval[extension] = true;
376 for (extension, &v) in extension.get_required_extensions().iter() {
377 if v && !retval[extension] {
378 worklist[worklist_size] = extension;
385 pub fn get_name(self) -> &'static str {
387 ($($(#[$attributes:meta])* $name:ident,)*) => {
389 $($(#[$attributes])* Extension::$name => stringify!($name),)*
397 VK_KHR_device_group_creation,
398 VK_KHR_descriptor_update_template,
400 VK_KHR_get_memory_requirements2,
401 VK_KHR_get_physical_device_properties2,
402 VK_KHR_sampler_ycbcr_conversion,
405 VK_KHR_external_memory_capabilities,
406 VK_KHR_external_fence_capabilities,
407 VK_KHR_external_semaphore_capabilities,
408 VK_KHR_16bit_storage,
409 VK_KHR_storage_buffer_storage_class,
410 VK_KHR_dedicated_allocation,
411 VK_KHR_external_fence,
412 VK_KHR_external_memory,
413 VK_KHR_external_semaphore,
415 VK_KHR_relaxed_block_layout,
416 VK_KHR_shader_draw_parameters,
417 VK_KHR_variable_pointers,
423 pub fn get_spec_version(self) -> u32 {
425 Extension::VK_KHR_surface => api::VK_KHR_SURFACE_SPEC_VERSION,
426 Extension::VK_KHR_bind_memory2 => api::VK_KHR_BIND_MEMORY_2_SPEC_VERSION,
427 Extension::VK_KHR_device_group => api::VK_KHR_DEVICE_GROUP_SPEC_VERSION,
428 Extension::VK_KHR_device_group_creation => {
429 api::VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION
431 Extension::VK_KHR_descriptor_update_template => {
432 api::VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION
434 Extension::VK_KHR_maintenance1 => api::VK_KHR_MAINTENANCE1_SPEC_VERSION,
435 Extension::VK_KHR_get_memory_requirements2 => {
436 api::VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION
438 Extension::VK_KHR_get_physical_device_properties2 => {
439 api::VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION
441 Extension::VK_KHR_sampler_ycbcr_conversion => {
442 api::VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION
444 Extension::VK_KHR_maintenance2 => api::VK_KHR_MAINTENANCE2_SPEC_VERSION,
445 Extension::VK_KHR_maintenance3 => api::VK_KHR_MAINTENANCE3_SPEC_VERSION,
446 Extension::VK_KHR_external_memory_capabilities => {
447 api::VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION
449 Extension::VK_KHR_external_fence_capabilities => {
450 api::VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION
452 Extension::VK_KHR_external_semaphore_capabilities => {
453 api::VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION
455 Extension::VK_KHR_16bit_storage => api::VK_KHR_16BIT_STORAGE_SPEC_VERSION,
456 Extension::VK_KHR_storage_buffer_storage_class => {
457 api::VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION
459 Extension::VK_KHR_dedicated_allocation => api::VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION,
460 Extension::VK_KHR_external_fence => api::VK_KHR_EXTERNAL_FENCE_SPEC_VERSION,
461 Extension::VK_KHR_external_memory => api::VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION,
462 Extension::VK_KHR_external_semaphore => api::VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION,
463 Extension::VK_KHR_multiview => api::VK_KHR_MULTIVIEW_SPEC_VERSION,
464 Extension::VK_KHR_relaxed_block_layout => api::VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION,
465 Extension::VK_KHR_shader_draw_parameters => {
466 api::VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION
468 Extension::VK_KHR_variable_pointers => api::VK_KHR_VARIABLE_POINTERS_SPEC_VERSION,
469 Extension::VK_KHR_swapchain => api::VK_KHR_SWAPCHAIN_SPEC_VERSION,
471 Extension::VK_KHR_xcb_surface => api::VK_KHR_XCB_SURFACE_SPEC_VERSION,
474 pub fn get_properties(self) -> api::VkExtensionProperties {
475 let mut retval = api::VkExtensionProperties {
476 extensionName: [0; api::VK_MAX_EXTENSION_NAME_SIZE as usize],
477 specVersion: self.get_spec_version(),
479 copy_str_to_char_array(&mut retval.extensionName, self.get_name());
482 pub fn get_scope(self) -> ExtensionScope {
484 Extension::VK_KHR_surface
485 | Extension::VK_KHR_device_group_creation
486 | Extension::VK_KHR_get_physical_device_properties2
487 | Extension::VK_KHR_external_memory_capabilities
488 | Extension::VK_KHR_external_fence_capabilities
489 | Extension::VK_KHR_external_semaphore_capabilities => ExtensionScope::Instance,
490 Extension::VK_KHR_bind_memory2
491 | Extension::VK_KHR_device_group
492 | Extension::VK_KHR_descriptor_update_template
493 | Extension::VK_KHR_maintenance1
494 | Extension::VK_KHR_get_memory_requirements2
495 | Extension::VK_KHR_sampler_ycbcr_conversion
496 | Extension::VK_KHR_maintenance2
497 | Extension::VK_KHR_maintenance3
498 | Extension::VK_KHR_16bit_storage
499 | Extension::VK_KHR_storage_buffer_storage_class
500 | Extension::VK_KHR_dedicated_allocation
501 | Extension::VK_KHR_external_fence
502 | Extension::VK_KHR_external_memory
503 | Extension::VK_KHR_external_semaphore
504 | Extension::VK_KHR_multiview
505 | Extension::VK_KHR_relaxed_block_layout
506 | Extension::VK_KHR_shader_draw_parameters
507 | Extension::VK_KHR_variable_pointers
508 | Extension::VK_KHR_swapchain => ExtensionScope::Device,
510 Extension::VK_KHR_xcb_surface => ExtensionScope::Instance,
515 impl FromStr for Extension {
517 fn from_str(s: &str) -> Result<Self, Self::Err> {
518 for (i, _) in Extensions::default().iter() {
519 if s == i.get_name() {
527 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
528 pub struct Extensions(EnumMap<Extension, bool>);
531 pub fn create_empty() -> Self {
532 Extensions(enum_map!{_ => false})
534 pub fn is_empty(&self) -> bool {
535 self.iter().all(|(_, &v)| !v)
537 pub fn is_full(&self) -> bool {
538 self.iter().all(|(_, &v)| v)
540 pub fn get_allowed_extensions_from_instance_scope(&self) -> Self {
541 let mut retval = Extensions::default();
542 let instance_extensions = Self::instance_extensions();
543 for (extension, value) in retval.iter_mut() {
544 if extension.get_scope() == ExtensionScope::Instance {
545 *value = self[extension];
548 let required_extensions =
549 instance_extensions & extension.get_recursively_required_extensions();
550 *value = (!*self & required_extensions).is_empty();
554 pub fn instance_extensions() -> Self {
556 (|extension: Extension| extension.get_scope() == ExtensionScope::Instance).into(),
559 pub fn device_extensions() -> Self {
560 !Self::instance_extensions()
564 impl FromIterator<Extension> for Extensions {
565 fn from_iter<T: IntoIterator<Item = Extension>>(v: T) -> Extensions {
566 let mut retval = Extensions::create_empty();
568 retval[extension] = true;
574 impl Default for Extensions {
575 fn default() -> Self {
580 impl Deref for Extensions {
581 type Target = EnumMap<Extension, bool>;
582 fn deref(&self) -> &Self::Target {
587 impl DerefMut for Extensions {
588 fn deref_mut(&mut self) -> &mut Self::Target {
593 impl BitAnd for Extensions {
595 fn bitand(self, rhs: Self) -> Self {
596 let mut retval = Self::default();
597 for (index, retval) in retval.iter_mut() {
598 *retval = self[index] & rhs[index];
604 impl BitOr for Extensions {
606 fn bitor(self, rhs: Self) -> Self {
607 let mut retval = Self::default();
608 for (index, retval) in retval.iter_mut() {
609 *retval = self[index] | rhs[index];
615 impl BitXor for Extensions {
617 fn bitxor(self, rhs: Self) -> Self {
618 let mut retval = Self::default();
619 for (index, retval) in retval.iter_mut() {
620 *retval = self[index] ^ rhs[index];
626 impl Not for Extensions {
628 fn not(mut self) -> Self {
629 for v in self.values_mut() {
636 #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
637 enum GetProcAddressScope {
645 scope: GetProcAddressScope,
646 extensions: &Extensions,
647 ) -> api::PFN_vkVoidFunction {
648 let mut name = unsafe { CStr::from_ptr(name) }.to_str().ok()?;
650 use std::mem::transmute;
657 global: scope != GetProcAddressScope::Device,
658 instance: scope == GetProcAddressScope::Instance,
659 device: scope != GetProcAddressScope::Global,
661 macro_rules! proc_alias_khr {
662 ($base_name:ident, $required_extension:expr) => {
663 if name == concat!(stringify!($base_name), "KHR") {
664 if scope.instance && $required_extension {
665 name = stringify!($base_name);
674 extensions[Extension::VK_KHR_bind_memory2]
678 extensions[Extension::VK_KHR_bind_memory2]
682 extensions[Extension::VK_KHR_device_group]
686 extensions[Extension::VK_KHR_device_group]
689 vkCreateDescriptorUpdateTemplate,
690 extensions[Extension::VK_KHR_descriptor_update_template]
693 vkCreateSamplerYcbcrConversion,
694 extensions[Extension::VK_KHR_sampler_ycbcr_conversion]
697 vkDestroyDescriptorUpdateTemplate,
698 extensions[Extension::VK_KHR_descriptor_update_template]
701 vkDestroySamplerYcbcrConversion,
702 extensions[Extension::VK_KHR_sampler_ycbcr_conversion]
705 vkEnumeratePhysicalDeviceGroups,
706 extensions[Extension::VK_KHR_device_group_creation]
709 vkGetBufferMemoryRequirements2,
710 extensions[Extension::VK_KHR_get_memory_requirements2]
713 vkGetDescriptorSetLayoutSupport,
714 extensions[Extension::VK_KHR_maintenance3]
717 vkGetDeviceGroupPeerMemoryFeatures,
718 extensions[Extension::VK_KHR_device_group]
721 vkGetImageMemoryRequirements2,
722 extensions[Extension::VK_KHR_get_memory_requirements2]
725 vkGetImageSparseMemoryRequirements2,
726 extensions[Extension::VK_KHR_get_memory_requirements2]
729 vkGetPhysicalDeviceExternalBufferProperties,
730 extensions[Extension::VK_KHR_external_memory_capabilities]
733 vkGetPhysicalDeviceExternalFenceProperties,
734 extensions[Extension::VK_KHR_external_fence_capabilities]
737 vkGetPhysicalDeviceExternalSemaphoreProperties,
738 extensions[Extension::VK_KHR_external_semaphore_capabilities]
741 vkGetPhysicalDeviceFeatures2,
742 extensions[Extension::VK_KHR_get_physical_device_properties2]
745 vkGetPhysicalDeviceFormatProperties2,
746 extensions[Extension::VK_KHR_get_physical_device_properties2]
749 vkGetPhysicalDeviceImageFormatProperties2,
750 extensions[Extension::VK_KHR_get_physical_device_properties2]
753 vkGetPhysicalDeviceMemoryProperties2,
754 extensions[Extension::VK_KHR_get_physical_device_properties2]
757 vkGetPhysicalDeviceProperties2,
758 extensions[Extension::VK_KHR_get_physical_device_properties2]
761 vkGetPhysicalDeviceQueueFamilyProperties2,
762 extensions[Extension::VK_KHR_get_physical_device_properties2]
765 vkGetPhysicalDeviceSparseImageFormatProperties2,
766 extensions[Extension::VK_KHR_get_physical_device_properties2]
770 extensions[Extension::VK_KHR_maintenance1]
773 vkUpdateDescriptorSetWithTemplate,
774 extensions[Extension::VK_KHR_descriptor_update_template]
776 macro_rules! proc_address {
777 ($name:ident, $pfn_name:ident, $required_scope:ident, $required_extension:expr) => {
778 if stringify!($name) == name {
779 if scope.$required_scope && $required_extension {
780 let f: $pfn_name = Some($name);
781 return unsafe { transmute(f) };
788 #[cfg_attr(rustfmt, rustfmt_skip)]
790 proc_address!(vkCreateInstance, PFN_vkCreateInstance, global, true);
791 proc_address!(vkEnumerateInstanceExtensionProperties, PFN_vkEnumerateInstanceExtensionProperties, global, true);
792 proc_address!(vkEnumerateInstanceLayerProperties, PFN_vkEnumerateInstanceLayerProperties, global, true);
793 proc_address!(vkEnumerateInstanceVersion, PFN_vkEnumerateInstanceVersion, global, true);
795 proc_address!(vkAllocateCommandBuffers, PFN_vkAllocateCommandBuffers, device, true);
796 proc_address!(vkAllocateDescriptorSets, PFN_vkAllocateDescriptorSets, device, true);
797 proc_address!(vkAllocateMemory, PFN_vkAllocateMemory, device, true);
798 proc_address!(vkBeginCommandBuffer, PFN_vkBeginCommandBuffer, device, true);
799 proc_address!(vkBindBufferMemory, PFN_vkBindBufferMemory, device, true);
800 proc_address!(vkBindBufferMemory2, PFN_vkBindBufferMemory2, device, true);
801 proc_address!(vkBindImageMemory, PFN_vkBindImageMemory, device, true);
802 proc_address!(vkBindImageMemory2, PFN_vkBindImageMemory2, device, true);
803 proc_address!(vkCmdBeginQuery, PFN_vkCmdBeginQuery, device, true);
804 proc_address!(vkCmdBeginRenderPass, PFN_vkCmdBeginRenderPass, device, true);
805 proc_address!(vkCmdBindDescriptorSets, PFN_vkCmdBindDescriptorSets, device, true);
806 proc_address!(vkCmdBindIndexBuffer, PFN_vkCmdBindIndexBuffer, device, true);
807 proc_address!(vkCmdBindPipeline, PFN_vkCmdBindPipeline, device, true);
808 proc_address!(vkCmdBindVertexBuffers, PFN_vkCmdBindVertexBuffers, device, true);
809 proc_address!(vkCmdBlitImage, PFN_vkCmdBlitImage, device, true);
810 proc_address!(vkCmdClearAttachments, PFN_vkCmdClearAttachments, device, true);
811 proc_address!(vkCmdClearColorImage, PFN_vkCmdClearColorImage, device, true);
812 proc_address!(vkCmdClearDepthStencilImage, PFN_vkCmdClearDepthStencilImage, device, true);
813 proc_address!(vkCmdCopyBuffer, PFN_vkCmdCopyBuffer, device, true);
814 proc_address!(vkCmdCopyBufferToImage, PFN_vkCmdCopyBufferToImage, device, true);
815 proc_address!(vkCmdCopyImage, PFN_vkCmdCopyImage, device, true);
816 proc_address!(vkCmdCopyImageToBuffer, PFN_vkCmdCopyImageToBuffer, device, true);
817 proc_address!(vkCmdCopyQueryPoolResults, PFN_vkCmdCopyQueryPoolResults, device, true);
818 proc_address!(vkCmdDispatch, PFN_vkCmdDispatch, device, true);
819 proc_address!(vkCmdDispatchBase, PFN_vkCmdDispatchBase, device, true);
820 proc_address!(vkCmdDispatchIndirect, PFN_vkCmdDispatchIndirect, device, true);
821 proc_address!(vkCmdDraw, PFN_vkCmdDraw, device, true);
822 proc_address!(vkCmdDrawIndexed, PFN_vkCmdDrawIndexed, device, true);
823 proc_address!(vkCmdDrawIndexedIndirect, PFN_vkCmdDrawIndexedIndirect, device, true);
824 proc_address!(vkCmdDrawIndirect, PFN_vkCmdDrawIndirect, device, true);
825 proc_address!(vkCmdEndQuery, PFN_vkCmdEndQuery, device, true);
826 proc_address!(vkCmdEndRenderPass, PFN_vkCmdEndRenderPass, device, true);
827 proc_address!(vkCmdExecuteCommands, PFN_vkCmdExecuteCommands, device, true);
828 proc_address!(vkCmdFillBuffer, PFN_vkCmdFillBuffer, device, true);
829 proc_address!(vkCmdNextSubpass, PFN_vkCmdNextSubpass, device, true);
830 proc_address!(vkCmdPipelineBarrier, PFN_vkCmdPipelineBarrier, device, true);
831 proc_address!(vkCmdPushConstants, PFN_vkCmdPushConstants, device, true);
832 proc_address!(vkCmdResetEvent, PFN_vkCmdResetEvent, device, true);
833 proc_address!(vkCmdResetQueryPool, PFN_vkCmdResetQueryPool, device, true);
834 proc_address!(vkCmdResolveImage, PFN_vkCmdResolveImage, device, true);
835 proc_address!(vkCmdSetBlendConstants, PFN_vkCmdSetBlendConstants, device, true);
836 proc_address!(vkCmdSetDepthBias, PFN_vkCmdSetDepthBias, device, true);
837 proc_address!(vkCmdSetDepthBounds, PFN_vkCmdSetDepthBounds, device, true);
838 proc_address!(vkCmdSetDeviceMask, PFN_vkCmdSetDeviceMask, device, true);
839 proc_address!(vkCmdSetEvent, PFN_vkCmdSetEvent, device, true);
840 proc_address!(vkCmdSetLineWidth, PFN_vkCmdSetLineWidth, device, true);
841 proc_address!(vkCmdSetScissor, PFN_vkCmdSetScissor, device, true);
842 proc_address!(vkCmdSetStencilCompareMask, PFN_vkCmdSetStencilCompareMask, device, true);
843 proc_address!(vkCmdSetStencilReference, PFN_vkCmdSetStencilReference, device, true);
844 proc_address!(vkCmdSetStencilWriteMask, PFN_vkCmdSetStencilWriteMask, device, true);
845 proc_address!(vkCmdSetViewport, PFN_vkCmdSetViewport, device, true);
846 proc_address!(vkCmdUpdateBuffer, PFN_vkCmdUpdateBuffer, device, true);
847 proc_address!(vkCmdWaitEvents, PFN_vkCmdWaitEvents, device, true);
848 proc_address!(vkCmdWriteTimestamp, PFN_vkCmdWriteTimestamp, device, true);
849 proc_address!(vkCreateBuffer, PFN_vkCreateBuffer, device, true);
850 proc_address!(vkCreateBufferView, PFN_vkCreateBufferView, device, true);
851 proc_address!(vkCreateCommandPool, PFN_vkCreateCommandPool, device, true);
852 proc_address!(vkCreateComputePipelines, PFN_vkCreateComputePipelines, device, true);
853 proc_address!(vkCreateDescriptorPool, PFN_vkCreateDescriptorPool, device, true);
854 proc_address!(vkCreateDescriptorSetLayout, PFN_vkCreateDescriptorSetLayout, device, true);
855 proc_address!(vkCreateDescriptorUpdateTemplate, PFN_vkCreateDescriptorUpdateTemplate, device, true);
856 proc_address!(vkCreateDevice, PFN_vkCreateDevice, instance, true);
857 proc_address!(vkCreateEvent, PFN_vkCreateEvent, device, true);
858 proc_address!(vkCreateFence, PFN_vkCreateFence, device, true);
859 proc_address!(vkCreateFramebuffer, PFN_vkCreateFramebuffer, device, true);
860 proc_address!(vkCreateGraphicsPipelines, PFN_vkCreateGraphicsPipelines, device, true);
861 proc_address!(vkCreateImage, PFN_vkCreateImage, device, true);
862 proc_address!(vkCreateImageView, PFN_vkCreateImageView, device, true);
863 proc_address!(vkCreatePipelineCache, PFN_vkCreatePipelineCache, device, true);
864 proc_address!(vkCreatePipelineLayout, PFN_vkCreatePipelineLayout, device, true);
865 proc_address!(vkCreateQueryPool, PFN_vkCreateQueryPool, device, true);
866 proc_address!(vkCreateRenderPass, PFN_vkCreateRenderPass, device, true);
867 proc_address!(vkCreateSampler, PFN_vkCreateSampler, device, true);
868 proc_address!(vkCreateSamplerYcbcrConversion, PFN_vkCreateSamplerYcbcrConversion, device, true);
869 proc_address!(vkCreateSemaphore, PFN_vkCreateSemaphore, device, true);
870 proc_address!(vkCreateShaderModule, PFN_vkCreateShaderModule, device, true);
871 proc_address!(vkDestroyBuffer, PFN_vkDestroyBuffer, device, true);
872 proc_address!(vkDestroyBufferView, PFN_vkDestroyBufferView, device, true);
873 proc_address!(vkDestroyCommandPool, PFN_vkDestroyCommandPool, device, true);
874 proc_address!(vkDestroyDescriptorPool, PFN_vkDestroyDescriptorPool, device, true);
875 proc_address!(vkDestroyDescriptorSetLayout, PFN_vkDestroyDescriptorSetLayout, device, true);
876 proc_address!(vkDestroyDescriptorUpdateTemplate, PFN_vkDestroyDescriptorUpdateTemplate, device, true);
877 proc_address!(vkDestroyDevice, PFN_vkDestroyDevice, device, true);
878 proc_address!(vkDestroyEvent, PFN_vkDestroyEvent, device, true);
879 proc_address!(vkDestroyFence, PFN_vkDestroyFence, device, true);
880 proc_address!(vkDestroyFramebuffer, PFN_vkDestroyFramebuffer, device, true);
881 proc_address!(vkDestroyImage, PFN_vkDestroyImage, device, true);
882 proc_address!(vkDestroyImageView, PFN_vkDestroyImageView, device, true);
883 proc_address!(vkDestroyInstance, PFN_vkDestroyInstance, instance, true);
884 proc_address!(vkDestroyPipeline, PFN_vkDestroyPipeline, device, true);
885 proc_address!(vkDestroyPipelineCache, PFN_vkDestroyPipelineCache, device, true);
886 proc_address!(vkDestroyPipelineLayout, PFN_vkDestroyPipelineLayout, device, true);
887 proc_address!(vkDestroyQueryPool, PFN_vkDestroyQueryPool, device, true);
888 proc_address!(vkDestroyRenderPass, PFN_vkDestroyRenderPass, device, true);
889 proc_address!(vkDestroySampler, PFN_vkDestroySampler, device, true);
890 proc_address!(vkDestroySamplerYcbcrConversion, PFN_vkDestroySamplerYcbcrConversion, device, true);
891 proc_address!(vkDestroySemaphore, PFN_vkDestroySemaphore, device, true);
892 proc_address!(vkDestroyShaderModule, PFN_vkDestroyShaderModule, device, true);
893 proc_address!(vkDeviceWaitIdle, PFN_vkDeviceWaitIdle, device, true);
894 proc_address!(vkEndCommandBuffer, PFN_vkEndCommandBuffer, device, true);
895 proc_address!(vkEnumerateDeviceExtensionProperties, PFN_vkEnumerateDeviceExtensionProperties, instance, true);
896 proc_address!(vkEnumerateDeviceLayerProperties, PFN_vkEnumerateDeviceLayerProperties, instance, true);
897 proc_address!(vkEnumeratePhysicalDeviceGroups, PFN_vkEnumeratePhysicalDeviceGroups, instance, true);
898 proc_address!(vkEnumeratePhysicalDevices, PFN_vkEnumeratePhysicalDevices, instance, true);
899 proc_address!(vkFlushMappedMemoryRanges, PFN_vkFlushMappedMemoryRanges, device, true);
900 proc_address!(vkFreeCommandBuffers, PFN_vkFreeCommandBuffers, device, true);
901 proc_address!(vkFreeDescriptorSets, PFN_vkFreeDescriptorSets, device, true);
902 proc_address!(vkFreeMemory, PFN_vkFreeMemory, device, true);
903 proc_address!(vkGetBufferMemoryRequirements, PFN_vkGetBufferMemoryRequirements, device, true);
904 proc_address!(vkGetBufferMemoryRequirements2, PFN_vkGetBufferMemoryRequirements2, device, true);
905 proc_address!(vkGetDescriptorSetLayoutSupport, PFN_vkGetDescriptorSetLayoutSupport, device, true);
906 proc_address!(vkGetDeviceGroupPeerMemoryFeatures, PFN_vkGetDeviceGroupPeerMemoryFeatures, device, true);
907 proc_address!(vkGetDeviceMemoryCommitment, PFN_vkGetDeviceMemoryCommitment, device, true);
908 proc_address!(vkGetDeviceProcAddr, PFN_vkGetDeviceProcAddr, device, true);
909 proc_address!(vkGetDeviceQueue, PFN_vkGetDeviceQueue, device, true);
910 proc_address!(vkGetDeviceQueue2, PFN_vkGetDeviceQueue2, device, true);
911 proc_address!(vkGetEventStatus, PFN_vkGetEventStatus, device, true);
912 proc_address!(vkGetFenceStatus, PFN_vkGetFenceStatus, device, true);
913 proc_address!(vkGetImageMemoryRequirements, PFN_vkGetImageMemoryRequirements, device, true);
914 proc_address!(vkGetImageMemoryRequirements2, PFN_vkGetImageMemoryRequirements2, device, true);
915 proc_address!(vkGetImageSparseMemoryRequirements, PFN_vkGetImageSparseMemoryRequirements, device, true);
916 proc_address!(vkGetImageSparseMemoryRequirements2, PFN_vkGetImageSparseMemoryRequirements2, device, true);
917 proc_address!(vkGetImageSubresourceLayout, PFN_vkGetImageSubresourceLayout, device, true);
918 proc_address!(vkGetInstanceProcAddr, PFN_vkGetInstanceProcAddr, device, true);
919 proc_address!(vkGetPhysicalDeviceExternalBufferProperties, PFN_vkGetPhysicalDeviceExternalBufferProperties, instance, true);
920 proc_address!(vkGetPhysicalDeviceExternalFenceProperties, PFN_vkGetPhysicalDeviceExternalFenceProperties, instance, true);
921 proc_address!(vkGetPhysicalDeviceExternalSemaphoreProperties, PFN_vkGetPhysicalDeviceExternalSemaphoreProperties, instance, true);
922 proc_address!(vkGetPhysicalDeviceFeatures, PFN_vkGetPhysicalDeviceFeatures, instance, true);
923 proc_address!(vkGetPhysicalDeviceFeatures2, PFN_vkGetPhysicalDeviceFeatures2, instance, true);
924 proc_address!(vkGetPhysicalDeviceFormatProperties, PFN_vkGetPhysicalDeviceFormatProperties, instance, true);
925 proc_address!(vkGetPhysicalDeviceFormatProperties2, PFN_vkGetPhysicalDeviceFormatProperties2, instance, true);
926 proc_address!(vkGetPhysicalDeviceImageFormatProperties, PFN_vkGetPhysicalDeviceImageFormatProperties, instance, true);
927 proc_address!(vkGetPhysicalDeviceImageFormatProperties2, PFN_vkGetPhysicalDeviceImageFormatProperties2, instance, true);
928 proc_address!(vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties, instance, true);
929 proc_address!(vkGetPhysicalDeviceMemoryProperties2, PFN_vkGetPhysicalDeviceMemoryProperties2, instance, true);
930 proc_address!(vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties, instance, true);
931 proc_address!(vkGetPhysicalDeviceProperties2, PFN_vkGetPhysicalDeviceProperties2, instance, true);
932 proc_address!(vkGetPhysicalDeviceQueueFamilyProperties, PFN_vkGetPhysicalDeviceQueueFamilyProperties, instance, true);
933 proc_address!(vkGetPhysicalDeviceQueueFamilyProperties2, PFN_vkGetPhysicalDeviceQueueFamilyProperties2, instance, true);
934 proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties, PFN_vkGetPhysicalDeviceSparseImageFormatProperties, instance, true);
935 proc_address!(vkGetPhysicalDeviceSparseImageFormatProperties2, PFN_vkGetPhysicalDeviceSparseImageFormatProperties2, instance, true);
936 proc_address!(vkGetPipelineCacheData, PFN_vkGetPipelineCacheData, device, true);
937 proc_address!(vkGetQueryPoolResults, PFN_vkGetQueryPoolResults, device, true);
938 proc_address!(vkGetRenderAreaGranularity, PFN_vkGetRenderAreaGranularity, device, true);
939 proc_address!(vkInvalidateMappedMemoryRanges, PFN_vkInvalidateMappedMemoryRanges, device, true);
940 proc_address!(vkMapMemory, PFN_vkMapMemory, device, true);
941 proc_address!(vkMergePipelineCaches, PFN_vkMergePipelineCaches, device, true);
942 proc_address!(vkQueueBindSparse, PFN_vkQueueBindSparse, device, true);
943 proc_address!(vkQueueSubmit, PFN_vkQueueSubmit, device, true);
944 proc_address!(vkQueueWaitIdle, PFN_vkQueueWaitIdle, device, true);
945 proc_address!(vkResetCommandBuffer, PFN_vkResetCommandBuffer, device, true);
946 proc_address!(vkResetCommandPool, PFN_vkResetCommandPool, device, true);
947 proc_address!(vkResetDescriptorPool, PFN_vkResetDescriptorPool, device, true);
948 proc_address!(vkResetEvent, PFN_vkResetEvent, device, true);
949 proc_address!(vkResetFences, PFN_vkResetFences, device, true);
950 proc_address!(vkSetEvent, PFN_vkSetEvent, device, true);
951 proc_address!(vkTrimCommandPool, PFN_vkTrimCommandPool, device, true);
952 proc_address!(vkUnmapMemory, PFN_vkUnmapMemory, device, true);
953 proc_address!(vkUpdateDescriptorSets, PFN_vkUpdateDescriptorSets, device, true);
954 proc_address!(vkUpdateDescriptorSetWithTemplate, PFN_vkUpdateDescriptorSetWithTemplate, device, true);
955 proc_address!(vkWaitForFences, PFN_vkWaitForFences, device, true);
957 proc_address!(vkDestroySurfaceKHR, PFN_vkDestroySurfaceKHR, device, extensions[Extension::VK_KHR_surface]);
958 proc_address!(vkGetPhysicalDeviceSurfaceSupportKHR, PFN_vkGetPhysicalDeviceSurfaceSupportKHR, device, extensions[Extension::VK_KHR_surface]);
959 proc_address!(vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR, device, extensions[Extension::VK_KHR_surface]);
960 proc_address!(vkGetPhysicalDeviceSurfaceFormatsKHR, PFN_vkGetPhysicalDeviceSurfaceFormatsKHR, device, extensions[Extension::VK_KHR_surface]);
961 proc_address!(vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR, device, extensions[Extension::VK_KHR_surface]);
963 proc_address!(vkCreateSwapchainKHR, PFN_vkCreateSwapchainKHR, device, extensions[Extension::VK_KHR_swapchain]);
964 proc_address!(vkDestroySwapchainKHR, PFN_vkDestroySwapchainKHR, device, extensions[Extension::VK_KHR_swapchain]);
965 proc_address!(vkGetSwapchainImagesKHR, PFN_vkGetSwapchainImagesKHR, device, extensions[Extension::VK_KHR_swapchain]);
966 proc_address!(vkAcquireNextImageKHR, PFN_vkAcquireNextImageKHR, device, extensions[Extension::VK_KHR_swapchain]);
967 proc_address!(vkQueuePresentKHR, PFN_vkQueuePresentKHR, device, extensions[Extension::VK_KHR_swapchain]);
968 proc_address!(vkGetDeviceGroupPresentCapabilitiesKHR, PFN_vkGetDeviceGroupPresentCapabilitiesKHR, device, extensions[Extension::VK_KHR_swapchain]);
969 proc_address!(vkGetDeviceGroupSurfacePresentModesKHR, PFN_vkGetDeviceGroupSurfacePresentModesKHR, device, extensions[Extension::VK_KHR_swapchain]);
970 proc_address!(vkGetPhysicalDevicePresentRectanglesKHR, PFN_vkGetPhysicalDevicePresentRectanglesKHR, device, extensions[Extension::VK_KHR_swapchain]);
971 proc_address!(vkAcquireNextImage2KHR, PFN_vkAcquireNextImage2KHR, device, extensions[Extension::VK_KHR_swapchain]);
974 proc_address!(vkCreateXcbSurfaceKHR, PFN_vkCreateXcbSurfaceKHR, device, extensions[Extension::VK_KHR_xcb_surface]);
976 proc_address!(vkGetPhysicalDeviceXcbPresentationSupportKHR, PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR, device, extensions[Extension::VK_KHR_xcb_surface]);
978 proc_address!(vkCmdBeginConditionalRenderingEXT, PFN_vkCmdBeginConditionalRenderingEXT, device, unknown);
979 proc_address!(vkCmdBeginDebugUtilsLabelEXT, PFN_vkCmdBeginDebugUtilsLabelEXT, device, unknown);
980 proc_address!(vkCmdBeginRenderPass2KHR, PFN_vkCmdBeginRenderPass2KHR, device, unknown);
981 proc_address!(vkCmdBindShadingRateImageNV, PFN_vkCmdBindShadingRateImageNV, device, unknown);
982 proc_address!(vkCmdDebugMarkerBeginEXT, PFN_vkCmdDebugMarkerBeginEXT, device, unknown);
983 proc_address!(vkCmdDebugMarkerEndEXT, PFN_vkCmdDebugMarkerEndEXT, device, unknown);
984 proc_address!(vkCmdDebugMarkerInsertEXT, PFN_vkCmdDebugMarkerInsertEXT, device, unknown);
985 proc_address!(vkCmdDrawIndexedIndirectCountAMD, PFN_vkCmdDrawIndexedIndirectCountAMD, device, unknown);
986 proc_address!(vkCmdDrawIndexedIndirectCountKHR, PFN_vkCmdDrawIndexedIndirectCountKHR, device, unknown);
987 proc_address!(vkCmdDrawIndirectCountAMD, PFN_vkCmdDrawIndirectCountAMD, device, unknown);
988 proc_address!(vkCmdDrawIndirectCountKHR, PFN_vkCmdDrawIndirectCountKHR, device, unknown);
989 proc_address!(vkCmdDrawMeshTasksIndirectCountNV, PFN_vkCmdDrawMeshTasksIndirectCountNV, device, unknown);
990 proc_address!(vkCmdDrawMeshTasksIndirectNV, PFN_vkCmdDrawMeshTasksIndirectNV, device, unknown);
991 proc_address!(vkCmdDrawMeshTasksNV, PFN_vkCmdDrawMeshTasksNV, device, unknown);
992 proc_address!(vkCmdEndConditionalRenderingEXT, PFN_vkCmdEndConditionalRenderingEXT, device, unknown);
993 proc_address!(vkCmdEndDebugUtilsLabelEXT, PFN_vkCmdEndDebugUtilsLabelEXT, device, unknown);
994 proc_address!(vkCmdEndRenderPass2KHR, PFN_vkCmdEndRenderPass2KHR, device, unknown);
995 proc_address!(vkCmdInsertDebugUtilsLabelEXT, PFN_vkCmdInsertDebugUtilsLabelEXT, device, unknown);
996 proc_address!(vkCmdNextSubpass2KHR, PFN_vkCmdNextSubpass2KHR, device, unknown);
997 proc_address!(vkCmdPushDescriptorSetKHR, PFN_vkCmdPushDescriptorSetKHR, device, unknown);
998 proc_address!(vkCmdPushDescriptorSetWithTemplateKHR, PFN_vkCmdPushDescriptorSetWithTemplateKHR, device, unknown);
999 proc_address!(vkCmdSetCheckpointNV, PFN_vkCmdSetCheckpointNV, device, unknown);
1000 proc_address!(vkCmdSetCoarseSampleOrderNV, PFN_vkCmdSetCoarseSampleOrderNV, device, unknown);
1001 proc_address!(vkCmdSetDiscardRectangleEXT, PFN_vkCmdSetDiscardRectangleEXT, device, unknown);
1002 proc_address!(vkCmdSetExclusiveScissorNV, PFN_vkCmdSetExclusiveScissorNV, device, unknown);
1003 proc_address!(vkCmdSetSampleLocationsEXT, PFN_vkCmdSetSampleLocationsEXT, device, unknown);
1004 proc_address!(vkCmdSetViewportShadingRatePaletteNV, PFN_vkCmdSetViewportShadingRatePaletteNV, device, unknown);
1005 proc_address!(vkCmdSetViewportWScalingNV, PFN_vkCmdSetViewportWScalingNV, device, unknown);
1006 proc_address!(vkCmdWriteBufferMarkerAMD, PFN_vkCmdWriteBufferMarkerAMD, device, unknown);
1007 proc_address!(vkCreateDebugReportCallbackEXT, PFN_vkCreateDebugReportCallbackEXT, device, unknown);
1008 proc_address!(vkCreateDebugUtilsMessengerEXT, PFN_vkCreateDebugUtilsMessengerEXT, device, unknown);
1009 proc_address!(vkCreateDisplayModeKHR, PFN_vkCreateDisplayModeKHR, device, unknown);
1010 proc_address!(vkCreateDisplayPlaneSurfaceKHR, PFN_vkCreateDisplayPlaneSurfaceKHR, device, unknown);
1011 proc_address!(vkCreateRenderPass2KHR, PFN_vkCreateRenderPass2KHR, device, unknown);
1012 proc_address!(vkCreateSharedSwapchainsKHR, PFN_vkCreateSharedSwapchainsKHR, device, unknown);
1013 proc_address!(vkCreateValidationCacheEXT, PFN_vkCreateValidationCacheEXT, device, unknown);
1014 proc_address!(vkDebugMarkerSetObjectNameEXT, PFN_vkDebugMarkerSetObjectNameEXT, device, unknown);
1015 proc_address!(vkDebugMarkerSetObjectTagEXT, PFN_vkDebugMarkerSetObjectTagEXT, device, unknown);
1016 proc_address!(vkDebugReportCallbackEXT, PFN_vkDebugReportCallbackEXT, device, unknown);
1017 proc_address!(vkDebugReportMessageEXT, PFN_vkDebugReportMessageEXT, device, unknown);
1018 proc_address!(vkDebugUtilsMessengerCallbackEXT, PFN_vkDebugUtilsMessengerCallbackEXT, device, unknown);
1019 proc_address!(vkDestroyDebugReportCallbackEXT, PFN_vkDestroyDebugReportCallbackEXT, device, unknown);
1020 proc_address!(vkDestroyDebugUtilsMessengerEXT, PFN_vkDestroyDebugUtilsMessengerEXT, device, unknown);
1021 proc_address!(vkDestroyValidationCacheEXT, PFN_vkDestroyValidationCacheEXT, device, unknown);
1022 proc_address!(vkDisplayPowerControlEXT, PFN_vkDisplayPowerControlEXT, device, unknown);
1023 proc_address!(vkGetDisplayModeProperties2KHR, PFN_vkGetDisplayModeProperties2KHR, device, unknown);
1024 proc_address!(vkGetDisplayModePropertiesKHR, PFN_vkGetDisplayModePropertiesKHR, device, unknown);
1025 proc_address!(vkGetDisplayPlaneCapabilities2KHR, PFN_vkGetDisplayPlaneCapabilities2KHR, device, unknown);
1026 proc_address!(vkGetDisplayPlaneCapabilitiesKHR, PFN_vkGetDisplayPlaneCapabilitiesKHR, device, unknown);
1027 proc_address!(vkGetDisplayPlaneSupportedDisplaysKHR, PFN_vkGetDisplayPlaneSupportedDisplaysKHR, device, unknown);
1028 proc_address!(vkGetFenceFdKHR, PFN_vkGetFenceFdKHR, device, unknown);
1029 proc_address!(vkGetMemoryFdKHR, PFN_vkGetMemoryFdKHR, device, unknown);
1030 proc_address!(vkGetMemoryFdPropertiesKHR, PFN_vkGetMemoryFdPropertiesKHR, device, unknown);
1031 proc_address!(vkGetMemoryHostPointerPropertiesEXT, PFN_vkGetMemoryHostPointerPropertiesEXT, device, unknown);
1032 proc_address!(vkGetPastPresentationTimingGOOGLE, PFN_vkGetPastPresentationTimingGOOGLE, device, unknown);
1033 proc_address!(vkGetPhysicalDeviceDisplayPlaneProperties2KHR, PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR, device, unknown);
1034 proc_address!(vkGetPhysicalDeviceDisplayPlanePropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR, device, unknown);
1035 proc_address!(vkGetPhysicalDeviceDisplayProperties2KHR, PFN_vkGetPhysicalDeviceDisplayProperties2KHR, device, unknown);
1036 proc_address!(vkGetPhysicalDeviceDisplayPropertiesKHR, PFN_vkGetPhysicalDeviceDisplayPropertiesKHR, device, unknown);
1037 proc_address!(vkGetPhysicalDeviceExternalImageFormatPropertiesNV, PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV, device, unknown);
1038 proc_address!(vkGetPhysicalDeviceMultisamplePropertiesEXT, PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT, device, unknown);
1039 proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2EXT, PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT, device, unknown);
1040 proc_address!(vkGetPhysicalDeviceSurfaceCapabilities2KHR, PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR, device, unknown);
1041 proc_address!(vkGetPhysicalDeviceSurfaceFormats2KHR, PFN_vkGetPhysicalDeviceSurfaceFormats2KHR, device, unknown);
1042 proc_address!(vkGetQueueCheckpointDataNV, PFN_vkGetQueueCheckpointDataNV, device, unknown);
1043 proc_address!(vkGetRefreshCycleDurationGOOGLE, PFN_vkGetRefreshCycleDurationGOOGLE, device, unknown);
1044 proc_address!(vkGetSemaphoreFdKHR, PFN_vkGetSemaphoreFdKHR, device, unknown);
1045 proc_address!(vkGetShaderInfoAMD, PFN_vkGetShaderInfoAMD, device, unknown);
1046 proc_address!(vkGetSwapchainCounterEXT, PFN_vkGetSwapchainCounterEXT, device, unknown);
1047 proc_address!(vkGetSwapchainStatusKHR, PFN_vkGetSwapchainStatusKHR, device, unknown);
1048 proc_address!(vkGetValidationCacheDataEXT, PFN_vkGetValidationCacheDataEXT, device, unknown);
1049 proc_address!(vkImportFenceFdKHR, PFN_vkImportFenceFdKHR, device, unknown);
1050 proc_address!(vkImportSemaphoreFdKHR, PFN_vkImportSemaphoreFdKHR, device, unknown);
1051 proc_address!(vkMergeValidationCachesEXT, PFN_vkMergeValidationCachesEXT, device, unknown);
1052 proc_address!(vkQueueBeginDebugUtilsLabelEXT, PFN_vkQueueBeginDebugUtilsLabelEXT, device, unknown);
1053 proc_address!(vkQueueEndDebugUtilsLabelEXT, PFN_vkQueueEndDebugUtilsLabelEXT, device, unknown);
1054 proc_address!(vkQueueInsertDebugUtilsLabelEXT, PFN_vkQueueInsertDebugUtilsLabelEXT, device, unknown);
1055 proc_address!(vkRegisterDeviceEventEXT, PFN_vkRegisterDeviceEventEXT, device, unknown);
1056 proc_address!(vkRegisterDisplayEventEXT, PFN_vkRegisterDisplayEventEXT, device, unknown);
1057 proc_address!(vkReleaseDisplayEXT, PFN_vkReleaseDisplayEXT, device, unknown);
1058 proc_address!(vkSetDebugUtilsObjectNameEXT, PFN_vkSetDebugUtilsObjectNameEXT, device, unknown);
1059 proc_address!(vkSetDebugUtilsObjectTagEXT, PFN_vkSetDebugUtilsObjectTagEXT, device, unknown);
1060 proc_address!(vkSetHdrMetadataEXT, PFN_vkSetHdrMetadataEXT, device, unknown);
1061 proc_address!(vkSubmitDebugUtilsMessageEXT, PFN_vkSubmitDebugUtilsMessageEXT, device, unknown);
1064 //eprintln!("unknown function: {:?}", name);
1068 #[derive(Debug, Copy, Clone)]
1069 pub struct Features {
1070 features: api::VkPhysicalDeviceFeatures,
1071 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures,
1072 sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures,
1073 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures,
1074 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures,
1075 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures,
1076 multiview_features: api::VkPhysicalDeviceMultiviewFeatures,
1082 features: api::VkPhysicalDeviceFeatures {
1083 robustBufferAccess: api::VK_TRUE,
1084 fullDrawIndexUint32: api::VK_TRUE,
1085 imageCubeArray: api::VK_TRUE,
1086 independentBlend: api::VK_FALSE,
1087 geometryShader: api::VK_FALSE,
1088 tessellationShader: api::VK_FALSE,
1089 sampleRateShading: api::VK_FALSE,
1090 dualSrcBlend: api::VK_FALSE,
1091 logicOp: api::VK_TRUE,
1092 multiDrawIndirect: api::VK_TRUE,
1093 drawIndirectFirstInstance: api::VK_TRUE,
1094 depthClamp: api::VK_FALSE,
1095 depthBiasClamp: api::VK_FALSE,
1096 fillModeNonSolid: api::VK_TRUE,
1097 depthBounds: api::VK_FALSE,
1098 wideLines: api::VK_FALSE,
1099 largePoints: api::VK_FALSE,
1100 alphaToOne: api::VK_TRUE,
1101 multiViewport: api::VK_TRUE,
1102 samplerAnisotropy: api::VK_FALSE,
1103 textureCompressionETC2: api::VK_FALSE, // FIXME: enable texture compression
1104 textureCompressionASTC_LDR: api::VK_FALSE, // FIXME: enable texture compression
1105 textureCompressionBC: api::VK_FALSE, // FIXME: enable texture compression
1106 occlusionQueryPrecise: api::VK_FALSE,
1107 pipelineStatisticsQuery: api::VK_FALSE,
1108 vertexPipelineStoresAndAtomics: api::VK_TRUE,
1109 fragmentStoresAndAtomics: api::VK_TRUE,
1110 shaderTessellationAndGeometryPointSize: api::VK_FALSE,
1111 shaderImageGatherExtended: api::VK_FALSE,
1112 shaderStorageImageExtendedFormats: api::VK_FALSE,
1113 shaderStorageImageMultisample: api::VK_FALSE,
1114 shaderStorageImageReadWithoutFormat: api::VK_FALSE,
1115 shaderStorageImageWriteWithoutFormat: api::VK_FALSE,
1116 shaderUniformBufferArrayDynamicIndexing: api::VK_TRUE,
1117 shaderSampledImageArrayDynamicIndexing: api::VK_TRUE,
1118 shaderStorageBufferArrayDynamicIndexing: api::VK_TRUE,
1119 shaderStorageImageArrayDynamicIndexing: api::VK_TRUE,
1120 shaderClipDistance: api::VK_FALSE,
1121 shaderCullDistance: api::VK_FALSE,
1122 shaderFloat64: api::VK_TRUE,
1123 shaderInt64: api::VK_TRUE,
1124 shaderInt16: api::VK_TRUE,
1125 shaderResourceResidency: api::VK_FALSE,
1126 shaderResourceMinLod: api::VK_FALSE,
1127 sparseBinding: api::VK_FALSE,
1128 sparseResidencyBuffer: api::VK_FALSE,
1129 sparseResidencyImage2D: api::VK_FALSE,
1130 sparseResidencyImage3D: api::VK_FALSE,
1131 sparseResidency2Samples: api::VK_FALSE,
1132 sparseResidency4Samples: api::VK_FALSE,
1133 sparseResidency8Samples: api::VK_FALSE,
1134 sparseResidency16Samples: api::VK_FALSE,
1135 sparseResidencyAliased: api::VK_FALSE,
1136 variableMultisampleRate: api::VK_FALSE,
1137 inheritedQueries: api::VK_FALSE,
1139 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures {
1140 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1142 storageBuffer16BitAccess: api::VK_TRUE,
1143 uniformAndStorageBuffer16BitAccess: api::VK_TRUE,
1144 storagePushConstant16: api::VK_TRUE,
1145 storageInputOutput16: api::VK_TRUE,
1147 sampler_ycbcr_conversion_features:
1148 api::VkPhysicalDeviceSamplerYcbcrConversionFeatures {
1149 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1151 samplerYcbcrConversion: api::VK_FALSE,
1153 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures {
1154 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1156 variablePointersStorageBuffer: api::VK_TRUE,
1157 variablePointers: api::VK_TRUE,
1159 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures {
1160 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1162 shaderDrawParameters: api::VK_TRUE,
1164 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures {
1165 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1167 protectedMemory: api::VK_FALSE,
1169 multiview_features: api::VkPhysicalDeviceMultiviewFeatures {
1170 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1172 multiview: api::VK_FALSE,
1173 multiviewGeometryShader: api::VK_FALSE,
1174 multiviewTessellationShader: api::VK_FALSE,
1178 fn splat(value: bool) -> Self {
1179 let value32 = if value { api::VK_TRUE } else { api::VK_FALSE };
1181 features: api::VkPhysicalDeviceFeatures {
1182 robustBufferAccess: value32,
1183 fullDrawIndexUint32: value32,
1184 imageCubeArray: value32,
1185 independentBlend: value32,
1186 geometryShader: value32,
1187 tessellationShader: value32,
1188 sampleRateShading: value32,
1189 dualSrcBlend: value32,
1191 multiDrawIndirect: value32,
1192 drawIndirectFirstInstance: value32,
1193 depthClamp: value32,
1194 depthBiasClamp: value32,
1195 fillModeNonSolid: value32,
1196 depthBounds: value32,
1198 largePoints: value32,
1199 alphaToOne: value32,
1200 multiViewport: value32,
1201 samplerAnisotropy: value32,
1202 textureCompressionETC2: value32,
1203 textureCompressionASTC_LDR: value32,
1204 textureCompressionBC: value32,
1205 occlusionQueryPrecise: value32,
1206 pipelineStatisticsQuery: value32,
1207 vertexPipelineStoresAndAtomics: value32,
1208 fragmentStoresAndAtomics: value32,
1209 shaderTessellationAndGeometryPointSize: value32,
1210 shaderImageGatherExtended: value32,
1211 shaderStorageImageExtendedFormats: value32,
1212 shaderStorageImageMultisample: value32,
1213 shaderStorageImageReadWithoutFormat: value32,
1214 shaderStorageImageWriteWithoutFormat: value32,
1215 shaderUniformBufferArrayDynamicIndexing: value32,
1216 shaderSampledImageArrayDynamicIndexing: value32,
1217 shaderStorageBufferArrayDynamicIndexing: value32,
1218 shaderStorageImageArrayDynamicIndexing: value32,
1219 shaderClipDistance: value32,
1220 shaderCullDistance: value32,
1221 shaderFloat64: value32,
1222 shaderInt64: value32,
1223 shaderInt16: value32,
1224 shaderResourceResidency: value32,
1225 shaderResourceMinLod: value32,
1226 sparseBinding: value32,
1227 sparseResidencyBuffer: value32,
1228 sparseResidencyImage2D: value32,
1229 sparseResidencyImage3D: value32,
1230 sparseResidency2Samples: value32,
1231 sparseResidency4Samples: value32,
1232 sparseResidency8Samples: value32,
1233 sparseResidency16Samples: value32,
1234 sparseResidencyAliased: value32,
1235 variableMultisampleRate: value32,
1236 inheritedQueries: value32,
1238 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures {
1239 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1241 storageBuffer16BitAccess: value32,
1242 uniformAndStorageBuffer16BitAccess: value32,
1243 storagePushConstant16: value32,
1244 storageInputOutput16: value32,
1246 sampler_ycbcr_conversion_features:
1247 api::VkPhysicalDeviceSamplerYcbcrConversionFeatures {
1248 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1250 samplerYcbcrConversion: value32,
1252 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures {
1253 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1255 variablePointersStorageBuffer: value32,
1256 variablePointers: value32,
1258 shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures {
1259 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1261 shaderDrawParameters: value32,
1263 protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures {
1264 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1266 protectedMemory: value32,
1268 multiview_features: api::VkPhysicalDeviceMultiviewFeatures {
1269 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1272 multiviewGeometryShader: value32,
1273 multiviewTessellationShader: value32,
1277 fn visit2_mut<F: FnMut(&mut bool, &mut bool)>(&mut self, rhs: &mut Self, f: F) {
1278 struct VisitorStruct<F: FnMut(&mut bool, &mut bool)>(F);
1280 fn visit(&mut self, v1: &mut T, v2: &mut T);
1282 impl<F: FnMut(&mut bool, &mut bool)> Visitor<bool> for VisitorStruct<F> {
1283 fn visit(&mut self, v1: &mut bool, v2: &mut bool) {
1287 impl<F: FnMut(&mut bool, &mut bool)> Visitor<api::VkBool32> for VisitorStruct<F> {
1288 fn visit(&mut self, value1: &mut api::VkBool32, value2: &mut api::VkBool32) {
1289 let mut temp1 = *value1 != api::VK_FALSE;
1290 let mut temp2 = *value2 != api::VK_FALSE;
1291 (self.0)(&mut temp1, &mut temp2);
1292 *value1 = if temp1 { api::VK_TRUE } else { api::VK_FALSE };
1293 *value2 = if temp2 { api::VK_TRUE } else { api::VK_FALSE };
1296 let mut visitor = VisitorStruct(f);
1297 macro_rules! visit {
1298 ($member1:ident.$member2:ident) => {
1299 visitor.visit(&mut self.$member1.$member2, &mut rhs.$member1.$member2)
1301 ($member:ident) => {
1302 visitor.visit(&mut self.$member1, &mut rhs.$member1)
1305 visit!(features.robustBufferAccess);
1306 visit!(features.fullDrawIndexUint32);
1307 visit!(features.imageCubeArray);
1308 visit!(features.independentBlend);
1309 visit!(features.geometryShader);
1310 visit!(features.tessellationShader);
1311 visit!(features.sampleRateShading);
1312 visit!(features.dualSrcBlend);
1313 visit!(features.logicOp);
1314 visit!(features.multiDrawIndirect);
1315 visit!(features.drawIndirectFirstInstance);
1316 visit!(features.depthClamp);
1317 visit!(features.depthBiasClamp);
1318 visit!(features.fillModeNonSolid);
1319 visit!(features.depthBounds);
1320 visit!(features.wideLines);
1321 visit!(features.largePoints);
1322 visit!(features.alphaToOne);
1323 visit!(features.multiViewport);
1324 visit!(features.samplerAnisotropy);
1325 visit!(features.textureCompressionETC2);
1326 visit!(features.textureCompressionASTC_LDR);
1327 visit!(features.textureCompressionBC);
1328 visit!(features.occlusionQueryPrecise);
1329 visit!(features.pipelineStatisticsQuery);
1330 visit!(features.vertexPipelineStoresAndAtomics);
1331 visit!(features.fragmentStoresAndAtomics);
1332 visit!(features.shaderTessellationAndGeometryPointSize);
1333 visit!(features.shaderImageGatherExtended);
1334 visit!(features.shaderStorageImageExtendedFormats);
1335 visit!(features.shaderStorageImageMultisample);
1336 visit!(features.shaderStorageImageReadWithoutFormat);
1337 visit!(features.shaderStorageImageWriteWithoutFormat);
1338 visit!(features.shaderUniformBufferArrayDynamicIndexing);
1339 visit!(features.shaderSampledImageArrayDynamicIndexing);
1340 visit!(features.shaderStorageBufferArrayDynamicIndexing);
1341 visit!(features.shaderStorageImageArrayDynamicIndexing);
1342 visit!(features.shaderClipDistance);
1343 visit!(features.shaderCullDistance);
1344 visit!(features.shaderFloat64);
1345 visit!(features.shaderInt64);
1346 visit!(features.shaderInt16);
1347 visit!(features.shaderResourceResidency);
1348 visit!(features.shaderResourceMinLod);
1349 visit!(features.sparseBinding);
1350 visit!(features.sparseResidencyBuffer);
1351 visit!(features.sparseResidencyImage2D);
1352 visit!(features.sparseResidencyImage3D);
1353 visit!(features.sparseResidency2Samples);
1354 visit!(features.sparseResidency4Samples);
1355 visit!(features.sparseResidency8Samples);
1356 visit!(features.sparseResidency16Samples);
1357 visit!(features.sparseResidencyAliased);
1358 visit!(features.variableMultisampleRate);
1359 visit!(features.inheritedQueries);
1360 visit!(physical_device_16bit_storage_features.storageBuffer16BitAccess);
1361 visit!(physical_device_16bit_storage_features.uniformAndStorageBuffer16BitAccess);
1362 visit!(physical_device_16bit_storage_features.storagePushConstant16);
1363 visit!(physical_device_16bit_storage_features.storageInputOutput16);
1364 visit!(sampler_ycbcr_conversion_features.samplerYcbcrConversion);
1365 visit!(variable_pointer_features.variablePointersStorageBuffer);
1366 visit!(variable_pointer_features.variablePointers);
1367 visit!(shader_draw_parameter_features.shaderDrawParameters);
1368 visit!(protected_memory_features.protectedMemory);
1369 visit!(multiview_features.multiview);
1370 visit!(multiview_features.multiviewGeometryShader);
1371 visit!(multiview_features.multiviewTessellationShader);
1373 fn visit2<F: FnMut(bool, bool)>(mut self, mut rhs: Self, mut f: F) {
1374 self.visit2_mut(&mut rhs, |v1, v2| f(*v1, *v2));
1376 fn visit_mut<F: FnMut(&mut bool)>(&mut self, mut f: F) {
1377 let mut rhs = *self;
1378 self.visit2_mut(&mut rhs, |v, _| f(v));
1380 fn visit<F: FnMut(bool)>(mut self, mut f: F) {
1381 self.visit_mut(|v| f(*v));
1385 trait ImportExportFeatureSet<T> {
1386 fn import_feature_set(&mut self, features: &T);
1387 fn export_feature_set(&self, features: &mut T);
1390 impl ImportExportFeatureSet<api::VkPhysicalDeviceFeatures> for Features {
1391 fn import_feature_set(&mut self, features: &api::VkPhysicalDeviceFeatures) {
1392 self.features = *features;
1394 fn export_feature_set(&self, features: &mut api::VkPhysicalDeviceFeatures) {
1395 *features = self.features;
1399 impl ImportExportFeatureSet<api::VkPhysicalDeviceFeatures2> for Features {
1400 fn import_feature_set(&mut self, features: &api::VkPhysicalDeviceFeatures2) {
1401 self.features = features.features;
1403 fn export_feature_set(&self, features: &mut api::VkPhysicalDeviceFeatures2) {
1404 features.features = self.features;
1408 macro_rules! impl_import_export_feature_set {
1409 ($type:ident, $member:ident) => {
1410 impl ImportExportFeatureSet<api::$type> for Features {
1411 fn import_feature_set(&mut self, features: &api::$type) {
1412 self.$member = api::$type {
1413 sType: self.$member.sType,
1414 pNext: self.$member.pNext,
1418 fn export_feature_set(&self, features: &mut api::$type) {
1419 *features = api::$type {
1420 sType: features.sType,
1421 pNext: features.pNext,
1429 impl_import_export_feature_set!(
1430 VkPhysicalDevice16BitStorageFeatures,
1431 physical_device_16bit_storage_features
1434 impl_import_export_feature_set!(
1435 VkPhysicalDeviceSamplerYcbcrConversionFeatures,
1436 sampler_ycbcr_conversion_features
1439 impl_import_export_feature_set!(
1440 VkPhysicalDeviceVariablePointerFeatures,
1441 variable_pointer_features
1444 impl_import_export_feature_set!(
1445 VkPhysicalDeviceShaderDrawParameterFeatures,
1446 shader_draw_parameter_features
1449 impl_import_export_feature_set!(
1450 VkPhysicalDeviceProtectedMemoryFeatures,
1451 protected_memory_features
1454 impl_import_export_feature_set!(VkPhysicalDeviceMultiviewFeatures, multiview_features);
1456 impl Eq for Features {}
1458 impl PartialEq for Features {
1459 fn eq(&self, rhs: &Self) -> bool {
1460 let mut equal = true;
1461 self.visit2(*rhs, |a, b| equal &= a == b);
1466 impl BitAndAssign for Features {
1467 fn bitand_assign(&mut self, mut rhs: Self) {
1468 self.visit2_mut(&mut rhs, |l, r| *l &= *r);
1472 impl BitOrAssign for Features {
1473 fn bitor_assign(&mut self, mut rhs: Self) {
1474 self.visit2_mut(&mut rhs, |l, r| *l |= *r);
1478 impl BitXorAssign for Features {
1479 fn bitxor_assign(&mut self, mut rhs: Self) {
1480 self.visit2_mut(&mut rhs, |l, r| *l ^= *r);
1484 impl BitAnd for Features {
1486 fn bitand(mut self, rhs: Self) -> Self {
1492 impl BitOr for Features {
1494 fn bitor(mut self, rhs: Self) -> Self {
1500 impl BitXor for Features {
1502 fn bitxor(mut self, rhs: Self) -> Self {
1508 impl Not for Features {
1510 fn not(mut self) -> Self {
1511 self.visit_mut(|v| *v = !*v);
1519 physical_device: SharedHandle<api::VkPhysicalDevice>,
1520 extensions: Extensions,
1522 queues: Vec<Vec<OwnedHandle<api::VkQueue>>>,
1527 physical_device: SharedHandle<api::VkPhysicalDevice>,
1528 create_info: *const api::VkDeviceCreateInfo,
1529 ) -> Result<OwnedHandle<api::VkDevice>, api::VkResult> {
1530 parse_next_chain_const!{
1532 root = api::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
1533 device_group_device_create_info: api::VkDeviceGroupDeviceCreateInfo = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO,
1534 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
1535 physical_device_features_2: api::VkPhysicalDeviceFeatures2 = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
1536 physical_device_multiview_features: api::VkPhysicalDeviceMultiviewFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
1537 physical_device_protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
1538 physical_device_sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
1539 physical_device_shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
1540 physical_device_variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
1542 let ref create_info = *create_info;
1543 if create_info.enabledLayerCount != 0 {
1544 return Err(api::VK_ERROR_LAYER_NOT_PRESENT);
1546 let mut enabled_extensions = physical_device.enabled_extensions;
1547 if create_info.enabledExtensionCount != 0 {
1548 for &extension_name in slice::from_raw_parts(
1549 create_info.ppEnabledExtensionNames,
1550 create_info.enabledExtensionCount as usize,
1552 let extension: Extension = CStr::from_ptr(extension_name)
1554 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?
1556 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?;
1557 assert_eq!(extension.get_scope(), ExtensionScope::Device);
1558 enabled_extensions[extension] = true;
1561 for extension in enabled_extensions
1563 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
1565 let missing_extensions = extension.get_required_extensions() & !enabled_extensions;
1566 for missing_extension in missing_extensions
1568 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
1571 "extension {} enabled but required extension {} is not enabled",
1572 extension.get_name(),
1573 missing_extension.get_name()
1577 let mut selected_features = Features::splat(false);
1578 if !device_group_device_create_info.is_null() {
1579 let api::VkDeviceGroupDeviceCreateInfo {
1582 physicalDeviceCount: physical_device_count,
1583 pPhysicalDevices: physical_devices,
1584 } = *device_group_device_create_info;
1586 physical_device_count, 1,
1587 "multiple devices in a group are not implemented"
1591 physical_device.get_handle(),
1592 "unknown physical_device"
1595 if !physical_device_16bit_storage_features.is_null() {
1596 selected_features.import_feature_set(&*physical_device_16bit_storage_features);
1598 if !physical_device_features_2.is_null() {
1599 selected_features.import_feature_set(&*physical_device_features_2);
1600 } else if !create_info.pEnabledFeatures.is_null() {
1601 selected_features.import_feature_set(&*create_info.pEnabledFeatures);
1603 if !physical_device_multiview_features.is_null() {
1604 selected_features.import_feature_set(&*physical_device_multiview_features);
1606 if !physical_device_protected_memory_features.is_null() {
1607 selected_features.import_feature_set(&*physical_device_protected_memory_features);
1609 if !physical_device_sampler_ycbcr_conversion_features.is_null() {
1611 .import_feature_set(&*physical_device_sampler_ycbcr_conversion_features);
1613 if !physical_device_shader_draw_parameter_features.is_null() {
1614 selected_features.import_feature_set(&*physical_device_shader_draw_parameter_features);
1615 } else if enabled_extensions[Extension::VK_KHR_shader_draw_parameters] {
1617 .shader_draw_parameter_features
1618 .shaderDrawParameters = api::VK_TRUE;
1620 if !physical_device_variable_pointer_features.is_null() {
1621 selected_features.import_feature_set(&*physical_device_variable_pointer_features);
1623 if (selected_features & !physical_device.features) != Features::splat(false) {
1624 return Err(api::VK_ERROR_FEATURE_NOT_PRESENT);
1626 assert_ne!(create_info.queueCreateInfoCount, 0);
1627 let queue_create_infos = slice::from_raw_parts(
1628 create_info.pQueueCreateInfos,
1629 create_info.queueCreateInfoCount as usize,
1631 assert!(queue_create_infos.len() <= QUEUE_FAMILY_COUNT as usize);
1632 let mut total_queue_count = 0;
1633 let mut queue_counts: Vec<_> = Vec::new();
1634 for queue_create_info in queue_create_infos {
1635 parse_next_chain_const!{
1636 queue_create_info as *const api::VkDeviceQueueCreateInfo,
1637 root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
1639 let api::VkDeviceQueueCreateInfo {
1643 queueFamilyIndex: queue_family_index,
1644 queueCount: queue_count,
1645 pQueuePriorities: queue_priorities,
1646 } = *queue_create_info;
1647 assert_eq!(flags & api::VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT, 0);
1648 assert!(queue_family_index < QUEUE_FAMILY_COUNT);
1649 assert!(queue_count <= QUEUE_COUNTS[queue_family_index as usize]);
1650 let queue_priorities = slice::from_raw_parts(queue_priorities, queue_count as usize);
1651 for &queue_priority in queue_priorities {
1652 assert!(queue_priority >= 0.0 && queue_priority <= 1.0);
1654 assert_eq!(QUEUE_FAMILY_COUNT, 1, "multiple queues are not implemented");
1656 QUEUE_COUNTS, [1; QUEUE_FAMILY_COUNT as usize],
1657 "multiple queues are not implemented"
1659 queue_counts.push(queue_count as usize);
1660 total_queue_count += queue_count as usize;
1662 assert!(total_queue_count <= TOTAL_QUEUE_COUNT);
1663 let mut queues = Vec::new();
1664 for queue_count in queue_counts {
1665 let mut queue_family_queues = Vec::new();
1666 for _queue_index in 0..queue_count {
1667 queue_family_queues.push(OwnedHandle::<api::VkQueue>::new(Queue {}));
1669 queues.push(queue_family_queues);
1671 Ok(OwnedHandle::<api::VkDevice>::new(Device {
1673 extensions: enabled_extensions,
1674 features: selected_features,
1680 pub struct PhysicalDevice {
1681 enabled_extensions: Extensions,
1682 allowed_extensions: Extensions,
1683 properties: api::VkPhysicalDeviceProperties,
1685 system_memory_size: u64,
1686 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties,
1687 multiview_properties: api::VkPhysicalDeviceMultiviewProperties,
1688 id_properties: api::VkPhysicalDeviceIDProperties,
1689 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties,
1690 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties,
1691 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties,
1694 impl PhysicalDevice {
1695 pub fn get_pipeline_cache_uuid() -> uuid::Uuid {
1696 // FIXME: return real uuid
1699 pub fn get_device_uuid() -> uuid::Uuid {
1700 // FIXME: return real uuid
1703 pub fn get_driver_uuid() -> uuid::Uuid {
1704 // FIXME: return real uuid
1707 pub fn get_limits() -> api::VkPhysicalDeviceLimits {
1708 api::VkPhysicalDeviceLimits {
1709 maxImageDimension1D: !0,
1710 maxImageDimension2D: !0,
1711 maxImageDimension3D: !0,
1712 maxImageDimensionCube: !0,
1713 maxImageArrayLayers: !0,
1714 maxTexelBufferElements: !0,
1715 maxUniformBufferRange: !0,
1716 maxStorageBufferRange: !0,
1717 maxPushConstantsSize: !0,
1718 maxMemoryAllocationCount: !0,
1719 maxSamplerAllocationCount: !0,
1720 bufferImageGranularity: 1,
1721 sparseAddressSpaceSize: 0,
1722 maxBoundDescriptorSets: !0,
1723 maxPerStageDescriptorSamplers: !0,
1724 maxPerStageDescriptorUniformBuffers: !0,
1725 maxPerStageDescriptorStorageBuffers: !0,
1726 maxPerStageDescriptorSampledImages: !0,
1727 maxPerStageDescriptorStorageImages: !0,
1728 maxPerStageDescriptorInputAttachments: !0,
1729 maxPerStageResources: !0,
1730 maxDescriptorSetSamplers: !0,
1731 maxDescriptorSetUniformBuffers: !0,
1732 maxDescriptorSetUniformBuffersDynamic: !0,
1733 maxDescriptorSetStorageBuffers: !0,
1734 maxDescriptorSetStorageBuffersDynamic: !0,
1735 maxDescriptorSetSampledImages: !0,
1736 maxDescriptorSetStorageImages: !0,
1737 maxDescriptorSetInputAttachments: !0,
1738 maxVertexInputAttributes: !0,
1739 maxVertexInputBindings: !0,
1740 maxVertexInputAttributeOffset: !0,
1741 maxVertexInputBindingStride: !0,
1742 maxVertexOutputComponents: !0,
1743 maxTessellationGenerationLevel: 0,
1744 maxTessellationPatchSize: 0,
1745 maxTessellationControlPerVertexInputComponents: 0,
1746 maxTessellationControlPerVertexOutputComponents: 0,
1747 maxTessellationControlPerPatchOutputComponents: 0,
1748 maxTessellationControlTotalOutputComponents: 0,
1749 maxTessellationEvaluationInputComponents: 0,
1750 maxTessellationEvaluationOutputComponents: 0,
1751 maxGeometryShaderInvocations: 0,
1752 maxGeometryInputComponents: 0,
1753 maxGeometryOutputComponents: 0,
1754 maxGeometryOutputVertices: 0,
1755 maxGeometryTotalOutputComponents: 0,
1756 maxFragmentInputComponents: !0,
1757 maxFragmentOutputAttachments: !0,
1758 maxFragmentDualSrcAttachments: 0,
1759 maxFragmentCombinedOutputResources: !0,
1760 maxComputeSharedMemorySize: !0,
1761 maxComputeWorkGroupCount: [!0; 3],
1762 maxComputeWorkGroupInvocations: !0,
1763 maxComputeWorkGroupSize: [!0; 3],
1764 subPixelPrecisionBits: 4, // FIXME: update to correct value
1765 subTexelPrecisionBits: 4, // FIXME: update to correct value
1766 mipmapPrecisionBits: 4, // FIXME: update to correct value
1767 maxDrawIndexedIndexValue: !0,
1768 maxDrawIndirectCount: !0,
1769 maxSamplerLodBias: 2.0, // FIXME: update to correct value
1770 maxSamplerAnisotropy: 1.0,
1772 maxViewportDimensions: [4096; 2], // FIXME: update to correct value
1773 viewportBoundsRange: [-8192.0, 8191.0], // FIXME: update to correct value
1774 viewportSubPixelBits: 0,
1775 minMemoryMapAlignment: MIN_MEMORY_MAP_ALIGNMENT,
1776 minTexelBufferOffsetAlignment: 64, // FIXME: update to correct value
1777 minUniformBufferOffsetAlignment: 64, // FIXME: update to correct value
1778 minStorageBufferOffsetAlignment: 64, // FIXME: update to correct value
1779 minTexelOffset: -8, // FIXME: update to correct value
1780 maxTexelOffset: 7, // FIXME: update to correct value
1781 minTexelGatherOffset: 0,
1782 maxTexelGatherOffset: 0,
1783 minInterpolationOffset: 0.0,
1784 maxInterpolationOffset: 0.0,
1785 subPixelInterpolationOffsetBits: 0,
1786 maxFramebufferWidth: 4096, // FIXME: update to correct value
1787 maxFramebufferHeight: 4096, // FIXME: update to correct value
1788 maxFramebufferLayers: 256, // FIXME: update to correct value
1789 framebufferColorSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1790 framebufferDepthSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1791 framebufferStencilSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1792 framebufferNoAttachmentsSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1793 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1794 maxColorAttachments: 4,
1795 sampledImageColorSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1796 sampledImageIntegerSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1797 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1798 sampledImageDepthSampleCounts: api::VK_SAMPLE_COUNT_1_BIT | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1799 sampledImageStencilSampleCounts: api::VK_SAMPLE_COUNT_1_BIT
1800 | api::VK_SAMPLE_COUNT_4_BIT, // FIXME: update to correct value
1801 storageImageSampleCounts: api::VK_SAMPLE_COUNT_1_BIT, // FIXME: update to correct value
1802 maxSampleMaskWords: 1,
1803 timestampComputeAndGraphics: api::VK_FALSE,
1804 timestampPeriod: 0.0,
1805 maxClipDistances: 0,
1806 maxCullDistances: 0,
1807 maxCombinedClipAndCullDistances: 0,
1808 discreteQueuePriorities: 2,
1809 pointSizeRange: [1.0; 2],
1810 lineWidthRange: [1.0; 2],
1811 pointSizeGranularity: 0.0,
1812 lineWidthGranularity: 0.0,
1813 strictLines: api::VK_FALSE,
1814 standardSampleLocations: api::VK_TRUE,
1815 optimalBufferCopyOffsetAlignment: 16,
1816 optimalBufferCopyRowPitchAlignment: 16,
1817 nonCoherentAtomSize: 1, //TODO: check if this is correct
1818 ..unsafe { mem::zeroed() } // for padding fields
1821 pub fn get_format_properties(format: api::VkFormat) -> api::VkFormatProperties {
1823 api::VK_FORMAT_UNDEFINED => api::VkFormatProperties {
1824 linearTilingFeatures: 0,
1825 optimalTilingFeatures: 0,
1828 api::VK_FORMAT_R4G4_UNORM_PACK8 => api::VkFormatProperties {
1830 linearTilingFeatures: 0,
1831 optimalTilingFeatures: 0,
1834 api::VK_FORMAT_R4G4B4A4_UNORM_PACK16 => api::VkFormatProperties {
1836 linearTilingFeatures: 0,
1837 optimalTilingFeatures: 0,
1840 api::VK_FORMAT_B4G4R4A4_UNORM_PACK16 => api::VkFormatProperties {
1842 linearTilingFeatures: 0,
1843 optimalTilingFeatures: 0,
1846 api::VK_FORMAT_R5G6B5_UNORM_PACK16 => api::VkFormatProperties {
1848 linearTilingFeatures: 0,
1849 optimalTilingFeatures: 0,
1852 api::VK_FORMAT_B5G6R5_UNORM_PACK16 => api::VkFormatProperties {
1854 linearTilingFeatures: 0,
1855 optimalTilingFeatures: 0,
1858 api::VK_FORMAT_R5G5B5A1_UNORM_PACK16 => api::VkFormatProperties {
1860 linearTilingFeatures: 0,
1861 optimalTilingFeatures: 0,
1864 api::VK_FORMAT_B5G5R5A1_UNORM_PACK16 => api::VkFormatProperties {
1866 linearTilingFeatures: 0,
1867 optimalTilingFeatures: 0,
1870 api::VK_FORMAT_A1R5G5B5_UNORM_PACK16 => api::VkFormatProperties {
1872 linearTilingFeatures: 0,
1873 optimalTilingFeatures: 0,
1876 api::VK_FORMAT_R8_UNORM => api::VkFormatProperties {
1878 linearTilingFeatures: 0,
1879 optimalTilingFeatures: 0,
1882 api::VK_FORMAT_R8_SNORM => api::VkFormatProperties {
1884 linearTilingFeatures: 0,
1885 optimalTilingFeatures: 0,
1888 api::VK_FORMAT_R8_USCALED => api::VkFormatProperties {
1890 linearTilingFeatures: 0,
1891 optimalTilingFeatures: 0,
1894 api::VK_FORMAT_R8_SSCALED => api::VkFormatProperties {
1896 linearTilingFeatures: 0,
1897 optimalTilingFeatures: 0,
1900 api::VK_FORMAT_R8_UINT => api::VkFormatProperties {
1902 linearTilingFeatures: 0,
1903 optimalTilingFeatures: 0,
1906 api::VK_FORMAT_R8_SINT => api::VkFormatProperties {
1908 linearTilingFeatures: 0,
1909 optimalTilingFeatures: 0,
1912 api::VK_FORMAT_R8_SRGB => api::VkFormatProperties {
1914 linearTilingFeatures: 0,
1915 optimalTilingFeatures: 0,
1918 api::VK_FORMAT_R8G8_UNORM => api::VkFormatProperties {
1920 linearTilingFeatures: 0,
1921 optimalTilingFeatures: 0,
1924 api::VK_FORMAT_R8G8_SNORM => api::VkFormatProperties {
1926 linearTilingFeatures: 0,
1927 optimalTilingFeatures: 0,
1930 api::VK_FORMAT_R8G8_USCALED => api::VkFormatProperties {
1932 linearTilingFeatures: 0,
1933 optimalTilingFeatures: 0,
1936 api::VK_FORMAT_R8G8_SSCALED => api::VkFormatProperties {
1938 linearTilingFeatures: 0,
1939 optimalTilingFeatures: 0,
1942 api::VK_FORMAT_R8G8_UINT => api::VkFormatProperties {
1944 linearTilingFeatures: 0,
1945 optimalTilingFeatures: 0,
1948 api::VK_FORMAT_R8G8_SINT => api::VkFormatProperties {
1950 linearTilingFeatures: 0,
1951 optimalTilingFeatures: 0,
1954 api::VK_FORMAT_R8G8_SRGB => api::VkFormatProperties {
1956 linearTilingFeatures: 0,
1957 optimalTilingFeatures: 0,
1960 api::VK_FORMAT_R8G8B8_UNORM => api::VkFormatProperties {
1962 linearTilingFeatures: 0,
1963 optimalTilingFeatures: 0,
1966 api::VK_FORMAT_R8G8B8_SNORM => api::VkFormatProperties {
1968 linearTilingFeatures: 0,
1969 optimalTilingFeatures: 0,
1972 api::VK_FORMAT_R8G8B8_USCALED => api::VkFormatProperties {
1974 linearTilingFeatures: 0,
1975 optimalTilingFeatures: 0,
1978 api::VK_FORMAT_R8G8B8_SSCALED => api::VkFormatProperties {
1980 linearTilingFeatures: 0,
1981 optimalTilingFeatures: 0,
1984 api::VK_FORMAT_R8G8B8_UINT => api::VkFormatProperties {
1986 linearTilingFeatures: 0,
1987 optimalTilingFeatures: 0,
1990 api::VK_FORMAT_R8G8B8_SINT => api::VkFormatProperties {
1992 linearTilingFeatures: 0,
1993 optimalTilingFeatures: 0,
1996 api::VK_FORMAT_R8G8B8_SRGB => api::VkFormatProperties {
1998 linearTilingFeatures: 0,
1999 optimalTilingFeatures: 0,
2002 api::VK_FORMAT_B8G8R8_UNORM => api::VkFormatProperties {
2004 linearTilingFeatures: 0,
2005 optimalTilingFeatures: 0,
2008 api::VK_FORMAT_B8G8R8_SNORM => api::VkFormatProperties {
2010 linearTilingFeatures: 0,
2011 optimalTilingFeatures: 0,
2014 api::VK_FORMAT_B8G8R8_USCALED => api::VkFormatProperties {
2016 linearTilingFeatures: 0,
2017 optimalTilingFeatures: 0,
2020 api::VK_FORMAT_B8G8R8_SSCALED => api::VkFormatProperties {
2022 linearTilingFeatures: 0,
2023 optimalTilingFeatures: 0,
2026 api::VK_FORMAT_B8G8R8_UINT => api::VkFormatProperties {
2028 linearTilingFeatures: 0,
2029 optimalTilingFeatures: 0,
2032 api::VK_FORMAT_B8G8R8_SINT => api::VkFormatProperties {
2034 linearTilingFeatures: 0,
2035 optimalTilingFeatures: 0,
2038 api::VK_FORMAT_B8G8R8_SRGB => api::VkFormatProperties {
2040 linearTilingFeatures: 0,
2041 optimalTilingFeatures: 0,
2044 api::VK_FORMAT_R8G8B8A8_UNORM => api::VkFormatProperties {
2046 linearTilingFeatures: 0,
2047 optimalTilingFeatures: 0,
2050 api::VK_FORMAT_R8G8B8A8_SNORM => api::VkFormatProperties {
2052 linearTilingFeatures: 0,
2053 optimalTilingFeatures: 0,
2056 api::VK_FORMAT_R8G8B8A8_USCALED => api::VkFormatProperties {
2058 linearTilingFeatures: 0,
2059 optimalTilingFeatures: 0,
2062 api::VK_FORMAT_R8G8B8A8_SSCALED => api::VkFormatProperties {
2064 linearTilingFeatures: 0,
2065 optimalTilingFeatures: 0,
2068 api::VK_FORMAT_R8G8B8A8_UINT => api::VkFormatProperties {
2070 linearTilingFeatures: 0,
2071 optimalTilingFeatures: 0,
2074 api::VK_FORMAT_R8G8B8A8_SINT => api::VkFormatProperties {
2076 linearTilingFeatures: 0,
2077 optimalTilingFeatures: 0,
2080 api::VK_FORMAT_R8G8B8A8_SRGB => api::VkFormatProperties {
2082 linearTilingFeatures: 0,
2083 optimalTilingFeatures: 0,
2086 api::VK_FORMAT_B8G8R8A8_UNORM => api::VkFormatProperties {
2088 linearTilingFeatures: 0,
2089 optimalTilingFeatures: 0,
2092 api::VK_FORMAT_B8G8R8A8_SNORM => api::VkFormatProperties {
2094 linearTilingFeatures: 0,
2095 optimalTilingFeatures: 0,
2098 api::VK_FORMAT_B8G8R8A8_USCALED => api::VkFormatProperties {
2100 linearTilingFeatures: 0,
2101 optimalTilingFeatures: 0,
2104 api::VK_FORMAT_B8G8R8A8_SSCALED => api::VkFormatProperties {
2106 linearTilingFeatures: 0,
2107 optimalTilingFeatures: 0,
2110 api::VK_FORMAT_B8G8R8A8_UINT => api::VkFormatProperties {
2112 linearTilingFeatures: 0,
2113 optimalTilingFeatures: 0,
2116 api::VK_FORMAT_B8G8R8A8_SINT => api::VkFormatProperties {
2118 linearTilingFeatures: 0,
2119 optimalTilingFeatures: 0,
2122 api::VK_FORMAT_B8G8R8A8_SRGB => api::VkFormatProperties {
2124 linearTilingFeatures: 0,
2125 optimalTilingFeatures: 0,
2128 api::VK_FORMAT_A8B8G8R8_UNORM_PACK32 => api::VkFormatProperties {
2130 linearTilingFeatures: 0,
2131 optimalTilingFeatures: 0,
2134 api::VK_FORMAT_A8B8G8R8_SNORM_PACK32 => api::VkFormatProperties {
2136 linearTilingFeatures: 0,
2137 optimalTilingFeatures: 0,
2140 api::VK_FORMAT_A8B8G8R8_USCALED_PACK32 => api::VkFormatProperties {
2142 linearTilingFeatures: 0,
2143 optimalTilingFeatures: 0,
2146 api::VK_FORMAT_A8B8G8R8_SSCALED_PACK32 => api::VkFormatProperties {
2148 linearTilingFeatures: 0,
2149 optimalTilingFeatures: 0,
2152 api::VK_FORMAT_A8B8G8R8_UINT_PACK32 => api::VkFormatProperties {
2154 linearTilingFeatures: 0,
2155 optimalTilingFeatures: 0,
2158 api::VK_FORMAT_A8B8G8R8_SINT_PACK32 => api::VkFormatProperties {
2160 linearTilingFeatures: 0,
2161 optimalTilingFeatures: 0,
2164 api::VK_FORMAT_A8B8G8R8_SRGB_PACK32 => api::VkFormatProperties {
2166 linearTilingFeatures: 0,
2167 optimalTilingFeatures: 0,
2170 api::VK_FORMAT_A2R10G10B10_UNORM_PACK32 => api::VkFormatProperties {
2172 linearTilingFeatures: 0,
2173 optimalTilingFeatures: 0,
2176 api::VK_FORMAT_A2R10G10B10_SNORM_PACK32 => api::VkFormatProperties {
2178 linearTilingFeatures: 0,
2179 optimalTilingFeatures: 0,
2182 api::VK_FORMAT_A2R10G10B10_USCALED_PACK32 => api::VkFormatProperties {
2184 linearTilingFeatures: 0,
2185 optimalTilingFeatures: 0,
2188 api::VK_FORMAT_A2R10G10B10_SSCALED_PACK32 => api::VkFormatProperties {
2190 linearTilingFeatures: 0,
2191 optimalTilingFeatures: 0,
2194 api::VK_FORMAT_A2R10G10B10_UINT_PACK32 => api::VkFormatProperties {
2196 linearTilingFeatures: 0,
2197 optimalTilingFeatures: 0,
2200 api::VK_FORMAT_A2R10G10B10_SINT_PACK32 => api::VkFormatProperties {
2202 linearTilingFeatures: 0,
2203 optimalTilingFeatures: 0,
2206 api::VK_FORMAT_A2B10G10R10_UNORM_PACK32 => api::VkFormatProperties {
2208 linearTilingFeatures: 0,
2209 optimalTilingFeatures: 0,
2212 api::VK_FORMAT_A2B10G10R10_SNORM_PACK32 => api::VkFormatProperties {
2214 linearTilingFeatures: 0,
2215 optimalTilingFeatures: 0,
2218 api::VK_FORMAT_A2B10G10R10_USCALED_PACK32 => api::VkFormatProperties {
2220 linearTilingFeatures: 0,
2221 optimalTilingFeatures: 0,
2224 api::VK_FORMAT_A2B10G10R10_SSCALED_PACK32 => api::VkFormatProperties {
2226 linearTilingFeatures: 0,
2227 optimalTilingFeatures: 0,
2230 api::VK_FORMAT_A2B10G10R10_UINT_PACK32 => api::VkFormatProperties {
2232 linearTilingFeatures: 0,
2233 optimalTilingFeatures: 0,
2236 api::VK_FORMAT_A2B10G10R10_SINT_PACK32 => api::VkFormatProperties {
2238 linearTilingFeatures: 0,
2239 optimalTilingFeatures: 0,
2242 api::VK_FORMAT_R16_UNORM => api::VkFormatProperties {
2244 linearTilingFeatures: 0,
2245 optimalTilingFeatures: 0,
2248 api::VK_FORMAT_R16_SNORM => api::VkFormatProperties {
2250 linearTilingFeatures: 0,
2251 optimalTilingFeatures: 0,
2254 api::VK_FORMAT_R16_USCALED => api::VkFormatProperties {
2256 linearTilingFeatures: 0,
2257 optimalTilingFeatures: 0,
2260 api::VK_FORMAT_R16_SSCALED => api::VkFormatProperties {
2262 linearTilingFeatures: 0,
2263 optimalTilingFeatures: 0,
2266 api::VK_FORMAT_R16_UINT => api::VkFormatProperties {
2268 linearTilingFeatures: 0,
2269 optimalTilingFeatures: 0,
2272 api::VK_FORMAT_R16_SINT => api::VkFormatProperties {
2274 linearTilingFeatures: 0,
2275 optimalTilingFeatures: 0,
2278 api::VK_FORMAT_R16_SFLOAT => api::VkFormatProperties {
2280 linearTilingFeatures: 0,
2281 optimalTilingFeatures: 0,
2284 api::VK_FORMAT_R16G16_UNORM => api::VkFormatProperties {
2286 linearTilingFeatures: 0,
2287 optimalTilingFeatures: 0,
2290 api::VK_FORMAT_R16G16_SNORM => api::VkFormatProperties {
2292 linearTilingFeatures: 0,
2293 optimalTilingFeatures: 0,
2296 api::VK_FORMAT_R16G16_USCALED => api::VkFormatProperties {
2298 linearTilingFeatures: 0,
2299 optimalTilingFeatures: 0,
2302 api::VK_FORMAT_R16G16_SSCALED => api::VkFormatProperties {
2304 linearTilingFeatures: 0,
2305 optimalTilingFeatures: 0,
2308 api::VK_FORMAT_R16G16_UINT => api::VkFormatProperties {
2310 linearTilingFeatures: 0,
2311 optimalTilingFeatures: 0,
2314 api::VK_FORMAT_R16G16_SINT => api::VkFormatProperties {
2316 linearTilingFeatures: 0,
2317 optimalTilingFeatures: 0,
2320 api::VK_FORMAT_R16G16_SFLOAT => api::VkFormatProperties {
2322 linearTilingFeatures: 0,
2323 optimalTilingFeatures: 0,
2326 api::VK_FORMAT_R16G16B16_UNORM => api::VkFormatProperties {
2328 linearTilingFeatures: 0,
2329 optimalTilingFeatures: 0,
2332 api::VK_FORMAT_R16G16B16_SNORM => api::VkFormatProperties {
2334 linearTilingFeatures: 0,
2335 optimalTilingFeatures: 0,
2338 api::VK_FORMAT_R16G16B16_USCALED => api::VkFormatProperties {
2340 linearTilingFeatures: 0,
2341 optimalTilingFeatures: 0,
2344 api::VK_FORMAT_R16G16B16_SSCALED => api::VkFormatProperties {
2346 linearTilingFeatures: 0,
2347 optimalTilingFeatures: 0,
2350 api::VK_FORMAT_R16G16B16_UINT => api::VkFormatProperties {
2352 linearTilingFeatures: 0,
2353 optimalTilingFeatures: 0,
2356 api::VK_FORMAT_R16G16B16_SINT => api::VkFormatProperties {
2358 linearTilingFeatures: 0,
2359 optimalTilingFeatures: 0,
2362 api::VK_FORMAT_R16G16B16_SFLOAT => api::VkFormatProperties {
2364 linearTilingFeatures: 0,
2365 optimalTilingFeatures: 0,
2368 api::VK_FORMAT_R16G16B16A16_UNORM => api::VkFormatProperties {
2370 linearTilingFeatures: 0,
2371 optimalTilingFeatures: 0,
2374 api::VK_FORMAT_R16G16B16A16_SNORM => api::VkFormatProperties {
2376 linearTilingFeatures: 0,
2377 optimalTilingFeatures: 0,
2380 api::VK_FORMAT_R16G16B16A16_USCALED => api::VkFormatProperties {
2382 linearTilingFeatures: 0,
2383 optimalTilingFeatures: 0,
2386 api::VK_FORMAT_R16G16B16A16_SSCALED => api::VkFormatProperties {
2388 linearTilingFeatures: 0,
2389 optimalTilingFeatures: 0,
2392 api::VK_FORMAT_R16G16B16A16_UINT => api::VkFormatProperties {
2394 linearTilingFeatures: 0,
2395 optimalTilingFeatures: 0,
2398 api::VK_FORMAT_R16G16B16A16_SINT => api::VkFormatProperties {
2400 linearTilingFeatures: 0,
2401 optimalTilingFeatures: 0,
2404 api::VK_FORMAT_R16G16B16A16_SFLOAT => api::VkFormatProperties {
2406 linearTilingFeatures: 0,
2407 optimalTilingFeatures: 0,
2410 api::VK_FORMAT_R32_UINT => api::VkFormatProperties {
2412 linearTilingFeatures: 0,
2413 optimalTilingFeatures: 0,
2416 api::VK_FORMAT_R32_SINT => api::VkFormatProperties {
2418 linearTilingFeatures: 0,
2419 optimalTilingFeatures: 0,
2422 api::VK_FORMAT_R32_SFLOAT => api::VkFormatProperties {
2424 linearTilingFeatures: 0,
2425 optimalTilingFeatures: 0,
2428 api::VK_FORMAT_R32G32_UINT => api::VkFormatProperties {
2430 linearTilingFeatures: 0,
2431 optimalTilingFeatures: 0,
2434 api::VK_FORMAT_R32G32_SINT => api::VkFormatProperties {
2436 linearTilingFeatures: 0,
2437 optimalTilingFeatures: 0,
2440 api::VK_FORMAT_R32G32_SFLOAT => api::VkFormatProperties {
2442 linearTilingFeatures: 0,
2443 optimalTilingFeatures: 0,
2446 api::VK_FORMAT_R32G32B32_UINT => api::VkFormatProperties {
2448 linearTilingFeatures: 0,
2449 optimalTilingFeatures: 0,
2452 api::VK_FORMAT_R32G32B32_SINT => api::VkFormatProperties {
2454 linearTilingFeatures: 0,
2455 optimalTilingFeatures: 0,
2458 api::VK_FORMAT_R32G32B32_SFLOAT => api::VkFormatProperties {
2460 linearTilingFeatures: 0,
2461 optimalTilingFeatures: 0,
2464 api::VK_FORMAT_R32G32B32A32_UINT => api::VkFormatProperties {
2466 linearTilingFeatures: 0,
2467 optimalTilingFeatures: 0,
2470 api::VK_FORMAT_R32G32B32A32_SINT => api::VkFormatProperties {
2472 linearTilingFeatures: 0,
2473 optimalTilingFeatures: 0,
2476 api::VK_FORMAT_R32G32B32A32_SFLOAT => api::VkFormatProperties {
2478 linearTilingFeatures: 0,
2479 optimalTilingFeatures: 0,
2482 api::VK_FORMAT_R64_UINT => api::VkFormatProperties {
2484 linearTilingFeatures: 0,
2485 optimalTilingFeatures: 0,
2488 api::VK_FORMAT_R64_SINT => api::VkFormatProperties {
2490 linearTilingFeatures: 0,
2491 optimalTilingFeatures: 0,
2494 api::VK_FORMAT_R64_SFLOAT => api::VkFormatProperties {
2496 linearTilingFeatures: 0,
2497 optimalTilingFeatures: 0,
2500 api::VK_FORMAT_R64G64_UINT => api::VkFormatProperties {
2502 linearTilingFeatures: 0,
2503 optimalTilingFeatures: 0,
2506 api::VK_FORMAT_R64G64_SINT => api::VkFormatProperties {
2508 linearTilingFeatures: 0,
2509 optimalTilingFeatures: 0,
2512 api::VK_FORMAT_R64G64_SFLOAT => api::VkFormatProperties {
2514 linearTilingFeatures: 0,
2515 optimalTilingFeatures: 0,
2518 api::VK_FORMAT_R64G64B64_UINT => api::VkFormatProperties {
2520 linearTilingFeatures: 0,
2521 optimalTilingFeatures: 0,
2524 api::VK_FORMAT_R64G64B64_SINT => api::VkFormatProperties {
2526 linearTilingFeatures: 0,
2527 optimalTilingFeatures: 0,
2530 api::VK_FORMAT_R64G64B64_SFLOAT => api::VkFormatProperties {
2532 linearTilingFeatures: 0,
2533 optimalTilingFeatures: 0,
2536 api::VK_FORMAT_R64G64B64A64_UINT => api::VkFormatProperties {
2538 linearTilingFeatures: 0,
2539 optimalTilingFeatures: 0,
2542 api::VK_FORMAT_R64G64B64A64_SINT => api::VkFormatProperties {
2544 linearTilingFeatures: 0,
2545 optimalTilingFeatures: 0,
2548 api::VK_FORMAT_R64G64B64A64_SFLOAT => api::VkFormatProperties {
2550 linearTilingFeatures: 0,
2551 optimalTilingFeatures: 0,
2554 api::VK_FORMAT_B10G11R11_UFLOAT_PACK32 => api::VkFormatProperties {
2556 linearTilingFeatures: 0,
2557 optimalTilingFeatures: 0,
2560 api::VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 => api::VkFormatProperties {
2562 linearTilingFeatures: 0,
2563 optimalTilingFeatures: 0,
2566 api::VK_FORMAT_D16_UNORM => api::VkFormatProperties {
2568 linearTilingFeatures: 0,
2569 optimalTilingFeatures: 0,
2572 api::VK_FORMAT_X8_D24_UNORM_PACK32 => api::VkFormatProperties {
2574 linearTilingFeatures: 0,
2575 optimalTilingFeatures: 0,
2578 api::VK_FORMAT_D32_SFLOAT => api::VkFormatProperties {
2580 linearTilingFeatures: 0,
2581 optimalTilingFeatures: 0,
2584 api::VK_FORMAT_S8_UINT => api::VkFormatProperties {
2586 linearTilingFeatures: 0,
2587 optimalTilingFeatures: 0,
2590 api::VK_FORMAT_D16_UNORM_S8_UINT => api::VkFormatProperties {
2592 linearTilingFeatures: 0,
2593 optimalTilingFeatures: 0,
2596 api::VK_FORMAT_D24_UNORM_S8_UINT => api::VkFormatProperties {
2598 linearTilingFeatures: 0,
2599 optimalTilingFeatures: 0,
2602 api::VK_FORMAT_D32_SFLOAT_S8_UINT => api::VkFormatProperties {
2604 linearTilingFeatures: 0,
2605 optimalTilingFeatures: 0,
2608 api::VK_FORMAT_BC1_RGB_UNORM_BLOCK => api::VkFormatProperties {
2610 linearTilingFeatures: 0,
2611 optimalTilingFeatures: 0,
2614 api::VK_FORMAT_BC1_RGB_SRGB_BLOCK => api::VkFormatProperties {
2616 linearTilingFeatures: 0,
2617 optimalTilingFeatures: 0,
2620 api::VK_FORMAT_BC1_RGBA_UNORM_BLOCK => api::VkFormatProperties {
2622 linearTilingFeatures: 0,
2623 optimalTilingFeatures: 0,
2626 api::VK_FORMAT_BC1_RGBA_SRGB_BLOCK => api::VkFormatProperties {
2628 linearTilingFeatures: 0,
2629 optimalTilingFeatures: 0,
2632 api::VK_FORMAT_BC2_UNORM_BLOCK => api::VkFormatProperties {
2634 linearTilingFeatures: 0,
2635 optimalTilingFeatures: 0,
2638 api::VK_FORMAT_BC2_SRGB_BLOCK => api::VkFormatProperties {
2640 linearTilingFeatures: 0,
2641 optimalTilingFeatures: 0,
2644 api::VK_FORMAT_BC3_UNORM_BLOCK => api::VkFormatProperties {
2646 linearTilingFeatures: 0,
2647 optimalTilingFeatures: 0,
2650 api::VK_FORMAT_BC3_SRGB_BLOCK => api::VkFormatProperties {
2652 linearTilingFeatures: 0,
2653 optimalTilingFeatures: 0,
2656 api::VK_FORMAT_BC4_UNORM_BLOCK => api::VkFormatProperties {
2658 linearTilingFeatures: 0,
2659 optimalTilingFeatures: 0,
2662 api::VK_FORMAT_BC4_SNORM_BLOCK => api::VkFormatProperties {
2664 linearTilingFeatures: 0,
2665 optimalTilingFeatures: 0,
2668 api::VK_FORMAT_BC5_UNORM_BLOCK => api::VkFormatProperties {
2670 linearTilingFeatures: 0,
2671 optimalTilingFeatures: 0,
2674 api::VK_FORMAT_BC5_SNORM_BLOCK => api::VkFormatProperties {
2676 linearTilingFeatures: 0,
2677 optimalTilingFeatures: 0,
2680 api::VK_FORMAT_BC6H_UFLOAT_BLOCK => api::VkFormatProperties {
2682 linearTilingFeatures: 0,
2683 optimalTilingFeatures: 0,
2686 api::VK_FORMAT_BC6H_SFLOAT_BLOCK => api::VkFormatProperties {
2688 linearTilingFeatures: 0,
2689 optimalTilingFeatures: 0,
2692 api::VK_FORMAT_BC7_UNORM_BLOCK => api::VkFormatProperties {
2694 linearTilingFeatures: 0,
2695 optimalTilingFeatures: 0,
2698 api::VK_FORMAT_BC7_SRGB_BLOCK => api::VkFormatProperties {
2700 linearTilingFeatures: 0,
2701 optimalTilingFeatures: 0,
2704 api::VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK => api::VkFormatProperties {
2706 linearTilingFeatures: 0,
2707 optimalTilingFeatures: 0,
2710 api::VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK => api::VkFormatProperties {
2712 linearTilingFeatures: 0,
2713 optimalTilingFeatures: 0,
2716 api::VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK => api::VkFormatProperties {
2718 linearTilingFeatures: 0,
2719 optimalTilingFeatures: 0,
2722 api::VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK => api::VkFormatProperties {
2724 linearTilingFeatures: 0,
2725 optimalTilingFeatures: 0,
2728 api::VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK => api::VkFormatProperties {
2730 linearTilingFeatures: 0,
2731 optimalTilingFeatures: 0,
2734 api::VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK => api::VkFormatProperties {
2736 linearTilingFeatures: 0,
2737 optimalTilingFeatures: 0,
2740 api::VK_FORMAT_EAC_R11_UNORM_BLOCK => api::VkFormatProperties {
2742 linearTilingFeatures: 0,
2743 optimalTilingFeatures: 0,
2746 api::VK_FORMAT_EAC_R11_SNORM_BLOCK => api::VkFormatProperties {
2748 linearTilingFeatures: 0,
2749 optimalTilingFeatures: 0,
2752 api::VK_FORMAT_EAC_R11G11_UNORM_BLOCK => api::VkFormatProperties {
2754 linearTilingFeatures: 0,
2755 optimalTilingFeatures: 0,
2758 api::VK_FORMAT_EAC_R11G11_SNORM_BLOCK => api::VkFormatProperties {
2760 linearTilingFeatures: 0,
2761 optimalTilingFeatures: 0,
2764 api::VK_FORMAT_ASTC_4x4_UNORM_BLOCK => api::VkFormatProperties {
2766 linearTilingFeatures: 0,
2767 optimalTilingFeatures: 0,
2770 api::VK_FORMAT_ASTC_4x4_SRGB_BLOCK => api::VkFormatProperties {
2772 linearTilingFeatures: 0,
2773 optimalTilingFeatures: 0,
2776 api::VK_FORMAT_ASTC_5x4_UNORM_BLOCK => api::VkFormatProperties {
2778 linearTilingFeatures: 0,
2779 optimalTilingFeatures: 0,
2782 api::VK_FORMAT_ASTC_5x4_SRGB_BLOCK => api::VkFormatProperties {
2784 linearTilingFeatures: 0,
2785 optimalTilingFeatures: 0,
2788 api::VK_FORMAT_ASTC_5x5_UNORM_BLOCK => api::VkFormatProperties {
2790 linearTilingFeatures: 0,
2791 optimalTilingFeatures: 0,
2794 api::VK_FORMAT_ASTC_5x5_SRGB_BLOCK => api::VkFormatProperties {
2796 linearTilingFeatures: 0,
2797 optimalTilingFeatures: 0,
2800 api::VK_FORMAT_ASTC_6x5_UNORM_BLOCK => api::VkFormatProperties {
2802 linearTilingFeatures: 0,
2803 optimalTilingFeatures: 0,
2806 api::VK_FORMAT_ASTC_6x5_SRGB_BLOCK => api::VkFormatProperties {
2808 linearTilingFeatures: 0,
2809 optimalTilingFeatures: 0,
2812 api::VK_FORMAT_ASTC_6x6_UNORM_BLOCK => api::VkFormatProperties {
2814 linearTilingFeatures: 0,
2815 optimalTilingFeatures: 0,
2818 api::VK_FORMAT_ASTC_6x6_SRGB_BLOCK => api::VkFormatProperties {
2820 linearTilingFeatures: 0,
2821 optimalTilingFeatures: 0,
2824 api::VK_FORMAT_ASTC_8x5_UNORM_BLOCK => api::VkFormatProperties {
2826 linearTilingFeatures: 0,
2827 optimalTilingFeatures: 0,
2830 api::VK_FORMAT_ASTC_8x5_SRGB_BLOCK => api::VkFormatProperties {
2832 linearTilingFeatures: 0,
2833 optimalTilingFeatures: 0,
2836 api::VK_FORMAT_ASTC_8x6_UNORM_BLOCK => api::VkFormatProperties {
2838 linearTilingFeatures: 0,
2839 optimalTilingFeatures: 0,
2842 api::VK_FORMAT_ASTC_8x6_SRGB_BLOCK => api::VkFormatProperties {
2844 linearTilingFeatures: 0,
2845 optimalTilingFeatures: 0,
2848 api::VK_FORMAT_ASTC_8x8_UNORM_BLOCK => api::VkFormatProperties {
2850 linearTilingFeatures: 0,
2851 optimalTilingFeatures: 0,
2854 api::VK_FORMAT_ASTC_8x8_SRGB_BLOCK => api::VkFormatProperties {
2856 linearTilingFeatures: 0,
2857 optimalTilingFeatures: 0,
2860 api::VK_FORMAT_ASTC_10x5_UNORM_BLOCK => api::VkFormatProperties {
2862 linearTilingFeatures: 0,
2863 optimalTilingFeatures: 0,
2866 api::VK_FORMAT_ASTC_10x5_SRGB_BLOCK => api::VkFormatProperties {
2868 linearTilingFeatures: 0,
2869 optimalTilingFeatures: 0,
2872 api::VK_FORMAT_ASTC_10x6_UNORM_BLOCK => api::VkFormatProperties {
2874 linearTilingFeatures: 0,
2875 optimalTilingFeatures: 0,
2878 api::VK_FORMAT_ASTC_10x6_SRGB_BLOCK => api::VkFormatProperties {
2880 linearTilingFeatures: 0,
2881 optimalTilingFeatures: 0,
2884 api::VK_FORMAT_ASTC_10x8_UNORM_BLOCK => api::VkFormatProperties {
2886 linearTilingFeatures: 0,
2887 optimalTilingFeatures: 0,
2890 api::VK_FORMAT_ASTC_10x8_SRGB_BLOCK => api::VkFormatProperties {
2892 linearTilingFeatures: 0,
2893 optimalTilingFeatures: 0,
2896 api::VK_FORMAT_ASTC_10x10_UNORM_BLOCK => api::VkFormatProperties {
2898 linearTilingFeatures: 0,
2899 optimalTilingFeatures: 0,
2902 api::VK_FORMAT_ASTC_10x10_SRGB_BLOCK => api::VkFormatProperties {
2904 linearTilingFeatures: 0,
2905 optimalTilingFeatures: 0,
2908 api::VK_FORMAT_ASTC_12x10_UNORM_BLOCK => api::VkFormatProperties {
2910 linearTilingFeatures: 0,
2911 optimalTilingFeatures: 0,
2914 api::VK_FORMAT_ASTC_12x10_SRGB_BLOCK => api::VkFormatProperties {
2916 linearTilingFeatures: 0,
2917 optimalTilingFeatures: 0,
2920 api::VK_FORMAT_ASTC_12x12_UNORM_BLOCK => api::VkFormatProperties {
2922 linearTilingFeatures: 0,
2923 optimalTilingFeatures: 0,
2926 api::VK_FORMAT_ASTC_12x12_SRGB_BLOCK => api::VkFormatProperties {
2928 linearTilingFeatures: 0,
2929 optimalTilingFeatures: 0,
2932 api::VK_FORMAT_G8B8G8R8_422_UNORM => api::VkFormatProperties {
2934 linearTilingFeatures: 0,
2935 optimalTilingFeatures: 0,
2938 api::VK_FORMAT_B8G8R8G8_422_UNORM => api::VkFormatProperties {
2940 linearTilingFeatures: 0,
2941 optimalTilingFeatures: 0,
2944 api::VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM => api::VkFormatProperties {
2946 linearTilingFeatures: 0,
2947 optimalTilingFeatures: 0,
2950 api::VK_FORMAT_G8_B8R8_2PLANE_420_UNORM => api::VkFormatProperties {
2952 linearTilingFeatures: 0,
2953 optimalTilingFeatures: 0,
2956 api::VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM => api::VkFormatProperties {
2958 linearTilingFeatures: 0,
2959 optimalTilingFeatures: 0,
2962 api::VK_FORMAT_G8_B8R8_2PLANE_422_UNORM => api::VkFormatProperties {
2964 linearTilingFeatures: 0,
2965 optimalTilingFeatures: 0,
2968 api::VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM => api::VkFormatProperties {
2970 linearTilingFeatures: 0,
2971 optimalTilingFeatures: 0,
2974 api::VK_FORMAT_R10X6_UNORM_PACK16 => api::VkFormatProperties {
2976 linearTilingFeatures: 0,
2977 optimalTilingFeatures: 0,
2980 api::VK_FORMAT_R10X6G10X6_UNORM_2PACK16 => api::VkFormatProperties {
2982 linearTilingFeatures: 0,
2983 optimalTilingFeatures: 0,
2986 api::VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 => api::VkFormatProperties {
2988 linearTilingFeatures: 0,
2989 optimalTilingFeatures: 0,
2992 api::VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 => api::VkFormatProperties {
2994 linearTilingFeatures: 0,
2995 optimalTilingFeatures: 0,
2998 api::VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 => api::VkFormatProperties {
3000 linearTilingFeatures: 0,
3001 optimalTilingFeatures: 0,
3004 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3006 linearTilingFeatures: 0,
3007 optimalTilingFeatures: 0,
3010 api::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3012 linearTilingFeatures: 0,
3013 optimalTilingFeatures: 0,
3016 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3018 linearTilingFeatures: 0,
3019 optimalTilingFeatures: 0,
3022 api::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3024 linearTilingFeatures: 0,
3025 optimalTilingFeatures: 0,
3028 api::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 => api::VkFormatProperties {
3030 linearTilingFeatures: 0,
3031 optimalTilingFeatures: 0,
3034 api::VK_FORMAT_R12X4_UNORM_PACK16 => api::VkFormatProperties {
3036 linearTilingFeatures: 0,
3037 optimalTilingFeatures: 0,
3040 api::VK_FORMAT_R12X4G12X4_UNORM_2PACK16 => api::VkFormatProperties {
3042 linearTilingFeatures: 0,
3043 optimalTilingFeatures: 0,
3046 api::VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 => api::VkFormatProperties {
3048 linearTilingFeatures: 0,
3049 optimalTilingFeatures: 0,
3052 api::VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 => api::VkFormatProperties {
3054 linearTilingFeatures: 0,
3055 optimalTilingFeatures: 0,
3058 api::VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 => api::VkFormatProperties {
3060 linearTilingFeatures: 0,
3061 optimalTilingFeatures: 0,
3064 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3066 linearTilingFeatures: 0,
3067 optimalTilingFeatures: 0,
3070 api::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 => api::VkFormatProperties {
3072 linearTilingFeatures: 0,
3073 optimalTilingFeatures: 0,
3076 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3078 linearTilingFeatures: 0,
3079 optimalTilingFeatures: 0,
3082 api::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 => api::VkFormatProperties {
3084 linearTilingFeatures: 0,
3085 optimalTilingFeatures: 0,
3088 api::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 => api::VkFormatProperties {
3090 linearTilingFeatures: 0,
3091 optimalTilingFeatures: 0,
3094 api::VK_FORMAT_G16B16G16R16_422_UNORM => api::VkFormatProperties {
3096 linearTilingFeatures: 0,
3097 optimalTilingFeatures: 0,
3100 api::VK_FORMAT_B16G16R16G16_422_UNORM => api::VkFormatProperties {
3102 linearTilingFeatures: 0,
3103 optimalTilingFeatures: 0,
3106 api::VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM => api::VkFormatProperties {
3108 linearTilingFeatures: 0,
3109 optimalTilingFeatures: 0,
3112 api::VK_FORMAT_G16_B16R16_2PLANE_420_UNORM => api::VkFormatProperties {
3114 linearTilingFeatures: 0,
3115 optimalTilingFeatures: 0,
3118 api::VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM => api::VkFormatProperties {
3120 linearTilingFeatures: 0,
3121 optimalTilingFeatures: 0,
3124 api::VK_FORMAT_G16_B16R16_2PLANE_422_UNORM => api::VkFormatProperties {
3126 linearTilingFeatures: 0,
3127 optimalTilingFeatures: 0,
3130 api::VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM => api::VkFormatProperties {
3132 linearTilingFeatures: 0,
3133 optimalTilingFeatures: 0,
3136 _ => panic!("unknown format {}", format),
3141 pub struct Instance {
3142 physical_device: OwnedHandle<api::VkPhysicalDevice>,
3147 create_info: *const api::VkInstanceCreateInfo,
3148 ) -> Result<api::VkInstance, api::VkResult> {
3149 parse_next_chain_const!{
3151 root = api::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
3153 let ref create_info = *create_info;
3154 if create_info.enabledLayerCount != 0 {
3155 return Err(api::VK_ERROR_LAYER_NOT_PRESENT);
3157 let mut enabled_extensions = Extensions::create_empty();
3158 if create_info.enabledExtensionCount != 0 {
3159 for &extension_name in slice::from_raw_parts(
3160 create_info.ppEnabledExtensionNames,
3161 create_info.enabledExtensionCount as usize,
3163 let extension: Extension = CStr::from_ptr(extension_name)
3165 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?
3167 .map_err(|_| api::VK_ERROR_EXTENSION_NOT_PRESENT)?;
3168 assert_eq!(extension.get_scope(), ExtensionScope::Instance);
3169 enabled_extensions[extension] = true;
3172 for extension in enabled_extensions
3174 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
3176 let missing_extensions = extension.get_required_extensions() & !enabled_extensions;
3177 for missing_extension in missing_extensions
3179 .filter_map(|(extension, &enabled)| if enabled { Some(extension) } else { None })
3182 "extension {} enabled but required extension {} is not enabled",
3183 extension.get_name(),
3184 missing_extension.get_name()
3188 let system_memory_size;
3189 match sys_info::mem_info() {
3191 eprintln!("mem_info error: {}", error);
3192 return Err(api::VK_ERROR_INITIALIZATION_FAILED);
3194 Ok(info) => system_memory_size = info.total * 1024,
3196 let mut device_name = [0; api::VK_MAX_PHYSICAL_DEVICE_NAME_SIZE as usize];
3197 copy_str_to_char_array(&mut device_name, KAZAN_DEVICE_NAME);
3198 let retval = OwnedHandle::<api::VkInstance>::new(Instance {
3199 physical_device: OwnedHandle::new(PhysicalDevice {
3201 allowed_extensions: enabled_extensions.get_allowed_extensions_from_instance_scope(),
3202 properties: api::VkPhysicalDeviceProperties {
3203 apiVersion: make_api_version(1, 1, api::VK_HEADER_VERSION),
3204 driverVersion: make_api_version(
3205 env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
3206 env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
3207 env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
3209 vendorID: api::VK_VENDOR_ID_KAZAN,
3211 deviceType: api::VK_PHYSICAL_DEVICE_TYPE_CPU,
3212 deviceName: device_name,
3213 pipelineCacheUUID: *PhysicalDevice::get_pipeline_cache_uuid().as_bytes(),
3214 limits: PhysicalDevice::get_limits(),
3215 sparseProperties: api::VkPhysicalDeviceSparseProperties {
3216 residencyStandard2DBlockShape: api::VK_FALSE,
3217 residencyStandard2DMultisampleBlockShape: api::VK_FALSE,
3218 residencyStandard3DBlockShape: api::VK_FALSE,
3219 residencyAlignedMipSize: api::VK_FALSE,
3220 residencyNonResidentStrict: api::VK_FALSE,
3222 ..mem::zeroed() // for padding fields
3224 features: Features::new(),
3226 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties {
3227 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES,
3229 pointClippingBehavior: api::VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES,
3231 multiview_properties: api::VkPhysicalDeviceMultiviewProperties {
3232 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES,
3234 maxMultiviewViewCount: 6,
3235 maxMultiviewInstanceIndex: !0,
3237 id_properties: api::VkPhysicalDeviceIDProperties {
3238 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES,
3240 deviceUUID: *PhysicalDevice::get_device_uuid().as_bytes(),
3241 driverUUID: *PhysicalDevice::get_driver_uuid().as_bytes(),
3242 deviceLUID: [0; api::VK_LUID_SIZE as usize],
3244 deviceLUIDValid: api::VK_FALSE,
3246 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties {
3247 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES,
3249 maxPerSetDescriptors: !0,
3250 maxMemoryAllocationSize: isize::max_value() as u64,
3251 ..mem::zeroed() // for padding fields
3253 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties {
3254 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES,
3256 protectedNoFault: api::VK_FALSE,
3258 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties {
3259 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES,
3261 subgroupSize: 1, // FIXME fill in correct value
3262 supportedStages: api::VK_SHADER_STAGE_COMPUTE_BIT,
3263 supportedOperations: api::VK_SUBGROUP_FEATURE_BASIC_BIT,
3264 quadOperationsInAllStages: api::VK_FALSE,
3272 #[allow(non_snake_case)]
3273 pub unsafe extern "system" fn vkGetInstanceProcAddr(
3274 instance: api::VkInstance,
3275 name: *const c_char,
3276 ) -> api::PFN_vkVoidFunction {
3277 match instance.get() {
3278 Some(_) => get_proc_address(
3280 GetProcAddressScope::Instance,
3281 &SharedHandle::from(instance)
3284 .allowed_extensions,
3286 None => get_proc_address(
3288 GetProcAddressScope::Global,
3289 &Extensions::create_empty(),
3294 pub fn make_api_version(major: u32, minor: u32, patch: u32) -> u32 {
3295 assert!(major < (1 << 10));
3296 assert!(minor < (1 << 10));
3297 assert!(patch < (1 << 12));
3298 (major << 22) | (minor << 12) | patch
3301 #[allow(non_snake_case)]
3302 pub unsafe extern "system" fn vkEnumerateInstanceVersion(api_version: *mut u32) -> api::VkResult {
3303 *api_version = make_api_version(1, 1, api::VK_HEADER_VERSION);
3307 pub unsafe fn enumerate_helper<T, Item, I: IntoIterator<Item = Item>, AF: FnMut(&mut T, Item)>(
3308 api_value_count: *mut u32,
3311 mut assign_function: AF,
3312 ) -> api::VkResult {
3313 let mut retval = api::VK_SUCCESS;
3314 let mut api_values = if api_values.is_null() {
3317 Some(slice::from_raw_parts_mut(
3319 *api_value_count as usize,
3322 let mut final_count = 0;
3323 for value in values {
3324 if let Some(api_values) = &mut api_values {
3325 if final_count >= api_values.len() {
3326 retval = api::VK_INCOMPLETE;
3329 assign_function(&mut api_values[final_count], value);
3336 assert_eq!(final_count as u32 as usize, final_count);
3337 *api_value_count = final_count as u32;
3341 #[allow(non_snake_case)]
3342 pub unsafe extern "system" fn vkEnumerateInstanceLayerProperties(
3343 property_count: *mut u32,
3344 properties: *mut api::VkLayerProperties,
3345 ) -> api::VkResult {
3346 enumerate_helper(property_count, properties, &[], |l, r| *l = *r)
3349 #[allow(non_snake_case)]
3350 pub unsafe extern "system" fn vkEnumerateInstanceExtensionProperties(
3351 layer_name: *const c_char,
3352 property_count: *mut u32,
3353 properties: *mut api::VkExtensionProperties,
3354 ) -> api::VkResult {
3355 enumerate_extension_properties(
3359 ExtensionScope::Instance,
3363 #[allow(non_snake_case)]
3364 pub unsafe extern "system" fn vkCreateInstance(
3365 create_info: *const api::VkInstanceCreateInfo,
3366 _allocator: *const api::VkAllocationCallbacks,
3367 instance: *mut api::VkInstance,
3368 ) -> api::VkResult {
3369 *instance = Handle::null();
3370 match Instance::new(create_info) {
3375 Err(error) => error,
3379 #[allow(non_snake_case)]
3380 pub unsafe extern "system" fn vkDestroyInstance(
3381 instance: api::VkInstance,
3382 _allocator: *const api::VkAllocationCallbacks,
3384 OwnedHandle::from(instance);
3387 #[allow(non_snake_case)]
3388 pub unsafe extern "system" fn vkEnumeratePhysicalDevices(
3389 instance: api::VkInstance,
3390 physical_device_count: *mut u32,
3391 physical_devices: *mut api::VkPhysicalDevice,
3392 ) -> api::VkResult {
3393 let instance = SharedHandle::from(instance).unwrap();
3395 physical_device_count,
3397 iter::once(instance.physical_device.get_handle()),
3402 #[allow(non_snake_case)]
3403 pub unsafe extern "system" fn vkGetPhysicalDeviceFeatures(
3404 physical_device: api::VkPhysicalDevice,
3405 features: *mut api::VkPhysicalDeviceFeatures,
3407 let mut v = api::VkPhysicalDeviceFeatures2 {
3408 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
3410 features: mem::zeroed(),
3412 vkGetPhysicalDeviceFeatures2(physical_device, &mut v);
3413 *features = v.features;
3416 #[allow(non_snake_case)]
3417 pub unsafe extern "system" fn vkGetPhysicalDeviceFormatProperties(
3418 physical_device: api::VkPhysicalDevice,
3419 format: api::VkFormat,
3420 format_properties: *mut api::VkFormatProperties,
3422 let mut format_properties2 = api::VkFormatProperties2 {
3423 sType: api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
3425 formatProperties: mem::zeroed(),
3427 vkGetPhysicalDeviceFormatProperties2(physical_device, format, &mut format_properties2);
3428 *format_properties = format_properties2.formatProperties;
3431 #[allow(non_snake_case)]
3432 pub unsafe extern "system" fn vkGetPhysicalDeviceImageFormatProperties(
3433 _physicalDevice: api::VkPhysicalDevice,
3434 _format: api::VkFormat,
3435 _type_: api::VkImageType,
3436 _tiling: api::VkImageTiling,
3437 _usage: api::VkImageUsageFlags,
3438 _flags: api::VkImageCreateFlags,
3439 _pImageFormatProperties: *mut api::VkImageFormatProperties,
3440 ) -> api::VkResult {
3444 #[allow(non_snake_case)]
3445 pub unsafe extern "system" fn vkGetPhysicalDeviceProperties(
3446 physical_device: api::VkPhysicalDevice,
3447 properties: *mut api::VkPhysicalDeviceProperties,
3449 let physical_device = SharedHandle::from(physical_device).unwrap();
3450 *properties = physical_device.properties;
3453 unsafe fn get_physical_device_queue_family_properties(
3454 _physical_device: SharedHandle<api::VkPhysicalDevice>,
3455 queue_family_properties: &mut api::VkQueueFamilyProperties2,
3458 parse_next_chain_mut!{
3459 queue_family_properties as *mut api::VkQueueFamilyProperties2,
3460 root = api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2,
3462 queue_family_properties.queueFamilyProperties = api::VkQueueFamilyProperties {
3463 queueFlags: api::VK_QUEUE_GRAPHICS_BIT
3464 | api::VK_QUEUE_COMPUTE_BIT
3465 | api::VK_QUEUE_TRANSFER_BIT,
3466 queueCount: queue_count,
3467 timestampValidBits: 0,
3468 minImageTransferGranularity: api::VkExtent3D {
3476 #[allow(non_snake_case)]
3477 pub unsafe extern "system" fn vkGetPhysicalDeviceQueueFamilyProperties(
3478 physical_device: api::VkPhysicalDevice,
3479 queue_family_property_count: *mut u32,
3480 queue_family_properties: *mut api::VkQueueFamilyProperties,
3483 queue_family_property_count,
3484 queue_family_properties,
3485 QUEUE_COUNTS.iter(),
3486 |queue_family_properties, &count| {
3487 let mut queue_family_properties2 = api::VkQueueFamilyProperties2 {
3488 sType: api::VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2,
3490 queueFamilyProperties: mem::zeroed(),
3492 get_physical_device_queue_family_properties(
3493 SharedHandle::from(physical_device).unwrap(),
3494 &mut queue_family_properties2,
3497 *queue_family_properties = queue_family_properties2.queueFamilyProperties;
3502 #[allow(non_snake_case)]
3503 pub unsafe extern "system" fn vkGetPhysicalDeviceMemoryProperties(
3504 physical_device: api::VkPhysicalDevice,
3505 memory_properties: *mut api::VkPhysicalDeviceMemoryProperties,
3507 let mut memory_properties2 = api::VkPhysicalDeviceMemoryProperties2 {
3508 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2,
3510 memoryProperties: mem::zeroed(),
3512 vkGetPhysicalDeviceMemoryProperties2(physical_device, &mut memory_properties2);
3513 *memory_properties = memory_properties2.memoryProperties;
3516 #[allow(non_snake_case)]
3517 pub unsafe extern "system" fn vkGetDeviceProcAddr(
3518 device: api::VkDevice,
3519 name: *const c_char,
3520 ) -> api::PFN_vkVoidFunction {
3523 GetProcAddressScope::Device,
3524 &SharedHandle::from(device).unwrap().extensions,
3528 #[allow(non_snake_case)]
3529 pub unsafe extern "system" fn vkCreateDevice(
3530 physical_device: api::VkPhysicalDevice,
3531 create_info: *const api::VkDeviceCreateInfo,
3532 _allocator: *const api::VkAllocationCallbacks,
3533 device: *mut api::VkDevice,
3534 ) -> api::VkResult {
3535 *device = Handle::null();
3536 match Device::new(SharedHandle::from(physical_device).unwrap(), create_info) {
3541 Err(error) => error,
3545 #[allow(non_snake_case)]
3546 pub unsafe extern "system" fn vkDestroyDevice(
3547 device: api::VkDevice,
3548 _allocator: *const api::VkAllocationCallbacks,
3550 OwnedHandle::from(device);
3553 unsafe fn enumerate_extension_properties(
3554 layer_name: *const c_char,
3555 property_count: *mut u32,
3556 properties: *mut api::VkExtensionProperties,
3557 extension_scope: ExtensionScope,
3558 ) -> api::VkResult {
3559 if !layer_name.is_null() {
3560 return api::VK_ERROR_LAYER_NOT_PRESENT;
3565 Extensions::default().iter().filter_map(
3566 |(extension, _): (Extension, _)| -> Option<api::VkExtensionProperties> {
3567 if extension.get_scope() == extension_scope {
3568 Some(extension.get_properties())
3578 #[allow(non_snake_case)]
3579 pub unsafe extern "system" fn vkEnumerateDeviceExtensionProperties(
3580 _physical_device: api::VkPhysicalDevice,
3581 layer_name: *const c_char,
3582 property_count: *mut u32,
3583 properties: *mut api::VkExtensionProperties,
3584 ) -> api::VkResult {
3585 enumerate_extension_properties(
3589 ExtensionScope::Device,
3593 #[allow(non_snake_case)]
3594 pub unsafe extern "system" fn vkEnumerateDeviceLayerProperties(
3595 _physicalDevice: api::VkPhysicalDevice,
3596 _pPropertyCount: *mut u32,
3597 _pProperties: *mut api::VkLayerProperties,
3598 ) -> api::VkResult {
3602 #[allow(non_snake_case)]
3603 pub unsafe extern "system" fn vkGetDeviceQueue(
3604 device: api::VkDevice,
3605 queue_family_index: u32,
3607 queue: *mut api::VkQueue,
3611 &api::VkDeviceQueueInfo2 {
3612 sType: api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2,
3615 queueFamilyIndex: queue_family_index,
3616 queueIndex: queue_index,
3622 #[allow(non_snake_case)]
3623 pub unsafe extern "system" fn vkQueueSubmit(
3624 _queue: api::VkQueue,
3626 _pSubmits: *const api::VkSubmitInfo,
3627 _fence: api::VkFence,
3628 ) -> api::VkResult {
3632 #[allow(non_snake_case)]
3633 pub unsafe extern "system" fn vkQueueWaitIdle(_queue: api::VkQueue) -> api::VkResult {
3637 #[allow(non_snake_case)]
3638 pub unsafe extern "system" fn vkDeviceWaitIdle(_device: api::VkDevice) -> api::VkResult {
3642 #[allow(non_snake_case)]
3643 pub unsafe extern "system" fn vkAllocateMemory(
3644 _device: api::VkDevice,
3645 allocate_info: *const api::VkMemoryAllocateInfo,
3646 _allocator: *const api::VkAllocationCallbacks,
3647 memory: *mut api::VkDeviceMemory,
3648 ) -> api::VkResult {
3649 parse_next_chain_const!{
3651 root = api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
3652 export_memory_allocate_info: api::VkExportMemoryAllocateInfo = api::VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO,
3653 memory_allocate_flags_info: api::VkMemoryAllocateFlagsInfo = api::VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO,
3654 memory_dedicated_allocate_info: api::VkMemoryDedicatedAllocateInfo = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
3656 let ref allocate_info = *allocate_info;
3657 if !export_memory_allocate_info.is_null() {
3660 if !memory_allocate_flags_info.is_null() {
3663 if !memory_dedicated_allocate_info.is_null() {
3666 match DeviceMemoryType::from_index(allocate_info.memoryTypeIndex).unwrap() {
3667 DeviceMemoryType::Main => {
3668 if allocate_info.allocationSize > isize::max_value() as u64 {
3669 return api::VK_ERROR_OUT_OF_DEVICE_MEMORY;
3671 match DeviceMemory::allocate_from_default_heap(DeviceMemoryLayout::calculate(
3672 allocate_info.allocationSize as usize,
3673 MIN_MEMORY_MAP_ALIGNMENT,
3676 *memory = OwnedHandle::<api::VkDeviceMemory>::new(new_memory).take();
3679 Err(_) => api::VK_ERROR_OUT_OF_DEVICE_MEMORY,
3685 #[allow(non_snake_case)]
3686 pub unsafe extern "system" fn vkFreeMemory(
3687 _device: api::VkDevice,
3688 memory: api::VkDeviceMemory,
3689 _allocator: *const api::VkAllocationCallbacks,
3691 if !memory.is_null() {
3692 OwnedHandle::from(memory);
3696 #[allow(non_snake_case)]
3697 pub unsafe extern "system" fn vkMapMemory(
3698 _device: api::VkDevice,
3699 memory: api::VkDeviceMemory,
3700 offset: api::VkDeviceSize,
3701 size: api::VkDeviceSize,
3702 flags: api::VkMemoryMapFlags,
3703 data: *mut *mut c_void,
3704 ) -> api::VkResult {
3705 let memory = SharedHandle::from(memory).unwrap();
3706 // remember to keep vkUnmapMemory up to date
3707 *data = memory.get().as_ptr().offset(offset as isize) as *mut c_void;
3711 #[allow(non_snake_case)]
3712 pub unsafe extern "system" fn vkUnmapMemory(_device: api::VkDevice, _memory: api::VkDeviceMemory) {}
3714 #[allow(non_snake_case)]
3715 pub unsafe extern "system" fn vkFlushMappedMemoryRanges(
3716 _device: api::VkDevice,
3717 _memoryRangeCount: u32,
3718 _pMemoryRanges: *const api::VkMappedMemoryRange,
3719 ) -> api::VkResult {
3723 #[allow(non_snake_case)]
3724 pub unsafe extern "system" fn vkInvalidateMappedMemoryRanges(
3725 _device: api::VkDevice,
3726 _memoryRangeCount: u32,
3727 _pMemoryRanges: *const api::VkMappedMemoryRange,
3728 ) -> api::VkResult {
3732 #[allow(non_snake_case)]
3733 pub unsafe extern "system" fn vkGetDeviceMemoryCommitment(
3734 _device: api::VkDevice,
3735 _memory: api::VkDeviceMemory,
3736 _pCommittedMemoryInBytes: *mut api::VkDeviceSize,
3741 #[allow(non_snake_case)]
3742 pub unsafe extern "system" fn vkBindBufferMemory(
3743 device: api::VkDevice,
3744 buffer: api::VkBuffer,
3745 memory: api::VkDeviceMemory,
3746 memory_offset: api::VkDeviceSize,
3747 ) -> api::VkResult {
3748 vkBindBufferMemory2(
3751 &api::VkBindBufferMemoryInfo {
3752 sType: api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO,
3756 memoryOffset: memory_offset,
3761 #[allow(non_snake_case)]
3762 pub unsafe extern "system" fn vkBindImageMemory(
3763 device: api::VkDevice,
3764 image: api::VkImage,
3765 memory: api::VkDeviceMemory,
3766 memory_offset: api::VkDeviceSize,
3767 ) -> api::VkResult {
3771 &api::VkBindImageMemoryInfo {
3772 sType: api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
3776 memoryOffset: memory_offset,
3781 #[allow(non_snake_case)]
3782 pub unsafe extern "system" fn vkGetBufferMemoryRequirements(
3783 device: api::VkDevice,
3784 buffer: api::VkBuffer,
3785 memory_requirements: *mut api::VkMemoryRequirements,
3787 let mut memory_requirements_2 = api::VkMemoryRequirements2 {
3788 sType: api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
3790 memoryRequirements: mem::zeroed(),
3792 vkGetBufferMemoryRequirements2(
3794 &api::VkBufferMemoryRequirementsInfo2 {
3795 sType: api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
3799 &mut memory_requirements_2,
3801 *memory_requirements = memory_requirements_2.memoryRequirements;
3804 #[allow(non_snake_case)]
3805 pub unsafe extern "system" fn vkGetImageMemoryRequirements(
3806 device: api::VkDevice,
3807 image: api::VkImage,
3808 memory_requirements: *mut api::VkMemoryRequirements,
3810 let mut memory_requirements_2 = api::VkMemoryRequirements2 {
3811 sType: api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
3813 memoryRequirements: mem::zeroed(),
3815 vkGetImageMemoryRequirements2(
3817 &api::VkImageMemoryRequirementsInfo2 {
3818 sType: api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2,
3822 &mut memory_requirements_2,
3824 *memory_requirements = memory_requirements_2.memoryRequirements;
3827 #[allow(non_snake_case)]
3828 pub unsafe extern "system" fn vkGetImageSparseMemoryRequirements(
3829 _device: api::VkDevice,
3830 _image: api::VkImage,
3831 _pSparseMemoryRequirementCount: *mut u32,
3832 _pSparseMemoryRequirements: *mut api::VkSparseImageMemoryRequirements,
3837 #[allow(non_snake_case)]
3838 pub unsafe extern "system" fn vkGetPhysicalDeviceSparseImageFormatProperties(
3839 _physicalDevice: api::VkPhysicalDevice,
3840 _format: api::VkFormat,
3841 _type_: api::VkImageType,
3842 _samples: api::VkSampleCountFlagBits,
3843 _usage: api::VkImageUsageFlags,
3844 _tiling: api::VkImageTiling,
3845 _pPropertyCount: *mut u32,
3846 _pProperties: *mut api::VkSparseImageFormatProperties,
3851 #[allow(non_snake_case)]
3852 pub unsafe extern "system" fn vkQueueBindSparse(
3853 _queue: api::VkQueue,
3854 _bindInfoCount: u32,
3855 _pBindInfo: *const api::VkBindSparseInfo,
3856 _fence: api::VkFence,
3857 ) -> api::VkResult {
3861 #[allow(non_snake_case)]
3862 pub unsafe extern "system" fn vkCreateFence(
3863 _device: api::VkDevice,
3864 _pCreateInfo: *const api::VkFenceCreateInfo,
3865 _pAllocator: *const api::VkAllocationCallbacks,
3866 _pFence: *mut api::VkFence,
3867 ) -> api::VkResult {
3871 #[allow(non_snake_case)]
3872 pub unsafe extern "system" fn vkDestroyFence(
3873 _device: api::VkDevice,
3874 _fence: api::VkFence,
3875 _pAllocator: *const api::VkAllocationCallbacks,
3880 #[allow(non_snake_case)]
3881 pub unsafe extern "system" fn vkResetFences(
3882 _device: api::VkDevice,
3884 _pFences: *const api::VkFence,
3885 ) -> api::VkResult {
3889 #[allow(non_snake_case)]
3890 pub unsafe extern "system" fn vkGetFenceStatus(
3891 _device: api::VkDevice,
3892 _fence: api::VkFence,
3893 ) -> api::VkResult {
3897 #[allow(non_snake_case)]
3898 pub unsafe extern "system" fn vkWaitForFences(
3899 _device: api::VkDevice,
3901 _pFences: *const api::VkFence,
3902 _waitAll: api::VkBool32,
3904 ) -> api::VkResult {
3908 #[allow(non_snake_case)]
3909 pub unsafe extern "system" fn vkCreateSemaphore(
3910 _device: api::VkDevice,
3911 _pCreateInfo: *const api::VkSemaphoreCreateInfo,
3912 _pAllocator: *const api::VkAllocationCallbacks,
3913 _pSemaphore: *mut api::VkSemaphore,
3914 ) -> api::VkResult {
3918 #[allow(non_snake_case)]
3919 pub unsafe extern "system" fn vkDestroySemaphore(
3920 _device: api::VkDevice,
3921 _semaphore: api::VkSemaphore,
3922 _pAllocator: *const api::VkAllocationCallbacks,
3927 #[allow(non_snake_case)]
3928 pub unsafe extern "system" fn vkCreateEvent(
3929 _device: api::VkDevice,
3930 _pCreateInfo: *const api::VkEventCreateInfo,
3931 _pAllocator: *const api::VkAllocationCallbacks,
3932 _pEvent: *mut api::VkEvent,
3933 ) -> api::VkResult {
3937 #[allow(non_snake_case)]
3938 pub unsafe extern "system" fn vkDestroyEvent(
3939 _device: api::VkDevice,
3940 _event: api::VkEvent,
3941 _pAllocator: *const api::VkAllocationCallbacks,
3946 #[allow(non_snake_case)]
3947 pub unsafe extern "system" fn vkGetEventStatus(
3948 _device: api::VkDevice,
3949 _event: api::VkEvent,
3950 ) -> api::VkResult {
3954 #[allow(non_snake_case)]
3955 pub unsafe extern "system" fn vkSetEvent(
3956 _device: api::VkDevice,
3957 _event: api::VkEvent,
3958 ) -> api::VkResult {
3962 #[allow(non_snake_case)]
3963 pub unsafe extern "system" fn vkResetEvent(
3964 _device: api::VkDevice,
3965 _event: api::VkEvent,
3966 ) -> api::VkResult {
3970 #[allow(non_snake_case)]
3971 pub unsafe extern "system" fn vkCreateQueryPool(
3972 _device: api::VkDevice,
3973 _pCreateInfo: *const api::VkQueryPoolCreateInfo,
3974 _pAllocator: *const api::VkAllocationCallbacks,
3975 _pQueryPool: *mut api::VkQueryPool,
3976 ) -> api::VkResult {
3980 #[allow(non_snake_case)]
3981 pub unsafe extern "system" fn vkDestroyQueryPool(
3982 _device: api::VkDevice,
3983 _queryPool: api::VkQueryPool,
3984 _pAllocator: *const api::VkAllocationCallbacks,
3989 #[allow(non_snake_case)]
3990 pub unsafe extern "system" fn vkGetQueryPoolResults(
3991 _device: api::VkDevice,
3992 _queryPool: api::VkQueryPool,
3996 _pData: *mut c_void,
3997 _stride: api::VkDeviceSize,
3998 _flags: api::VkQueryResultFlags,
3999 ) -> api::VkResult {
4003 #[allow(non_snake_case)]
4004 pub unsafe extern "system" fn vkCreateBuffer(
4005 _device: api::VkDevice,
4006 create_info: *const api::VkBufferCreateInfo,
4007 _allocator: *const api::VkAllocationCallbacks,
4008 buffer: *mut api::VkBuffer,
4009 ) -> api::VkResult {
4010 parse_next_chain_const!{
4012 root = api::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
4013 external_memory_buffer: api::VkExternalMemoryBufferCreateInfo = api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO,
4015 let ref create_info = *create_info;
4016 if !external_memory_buffer.is_null() {
4017 let ref external_memory_buffer = *external_memory_buffer;
4018 assert_eq!(external_memory_buffer.handleTypes, 0);
4020 if create_info.size > isize::max_value() as u64 {
4021 return api::VK_ERROR_OUT_OF_DEVICE_MEMORY;
4023 *buffer = OwnedHandle::<api::VkBuffer>::new(Buffer {
4024 size: create_info.size as usize,
4031 #[allow(non_snake_case)]
4032 pub unsafe extern "system" fn vkDestroyBuffer(
4033 _device: api::VkDevice,
4034 buffer: api::VkBuffer,
4035 _allocator: *const api::VkAllocationCallbacks,
4037 OwnedHandle::from(buffer);
4040 #[allow(non_snake_case)]
4041 pub unsafe extern "system" fn vkCreateBufferView(
4042 _device: api::VkDevice,
4043 _pCreateInfo: *const api::VkBufferViewCreateInfo,
4044 _pAllocator: *const api::VkAllocationCallbacks,
4045 _pView: *mut api::VkBufferView,
4046 ) -> api::VkResult {
4050 #[allow(non_snake_case)]
4051 pub unsafe extern "system" fn vkDestroyBufferView(
4052 _device: api::VkDevice,
4053 _bufferView: api::VkBufferView,
4054 _pAllocator: *const api::VkAllocationCallbacks,
4059 #[allow(non_snake_case)]
4060 pub unsafe extern "system" fn vkCreateImage(
4061 _device: api::VkDevice,
4062 create_info: *const api::VkImageCreateInfo,
4063 _allocator: *const api::VkAllocationCallbacks,
4064 image: *mut api::VkImage,
4065 ) -> api::VkResult {
4066 parse_next_chain_const!{
4068 root = api::VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
4069 external_memory_image_create_info: api::VkExternalMemoryImageCreateInfo = api::VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,
4070 image_swapchain_create_info: api::VkImageSwapchainCreateInfoKHR = api::VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR,
4072 let ref create_info = *create_info;
4073 if !external_memory_image_create_info.is_null() {
4076 if !image_swapchain_create_info.is_null() {
4079 *image = OwnedHandle::<api::VkImage>::new(Image {
4080 properties: ImageProperties {
4081 supported_tilings: match create_info.tiling {
4082 api::VK_IMAGE_TILING_OPTIMAL => SupportedTilings::Any,
4083 api::VK_IMAGE_TILING_LINEAR => SupportedTilings::LinearOnly,
4084 _ => unreachable!("invalid image tiling"),
4086 format: create_info.format,
4087 extents: create_info.extent,
4088 array_layers: create_info.arrayLayers,
4089 mip_levels: create_info.mipLevels,
4090 multisample_count: match create_info.samples {
4091 api::VK_SAMPLE_COUNT_1_BIT => ImageMultisampleCount::Count1,
4092 api::VK_SAMPLE_COUNT_4_BIT => ImageMultisampleCount::Count4,
4093 _ => unreachable!("invalid sample count"),
4095 swapchain_present_tiling: None,
4103 #[allow(non_snake_case)]
4104 pub unsafe extern "system" fn vkDestroyImage(
4105 _device: api::VkDevice,
4106 image: api::VkImage,
4107 _allocator: *const api::VkAllocationCallbacks,
4109 OwnedHandle::from(image);
4112 #[allow(non_snake_case)]
4113 pub unsafe extern "system" fn vkGetImageSubresourceLayout(
4114 _device: api::VkDevice,
4115 _image: api::VkImage,
4116 _pSubresource: *const api::VkImageSubresource,
4117 _pLayout: *mut api::VkSubresourceLayout,
4122 #[allow(non_snake_case)]
4123 pub unsafe extern "system" fn vkCreateImageView(
4124 _device: api::VkDevice,
4125 _pCreateInfo: *const api::VkImageViewCreateInfo,
4126 _pAllocator: *const api::VkAllocationCallbacks,
4127 _pView: *mut api::VkImageView,
4128 ) -> api::VkResult {
4132 #[allow(non_snake_case)]
4133 pub unsafe extern "system" fn vkDestroyImageView(
4134 _device: api::VkDevice,
4135 _imageView: api::VkImageView,
4136 _pAllocator: *const api::VkAllocationCallbacks,
4141 #[allow(non_snake_case)]
4142 pub unsafe extern "system" fn vkCreateShaderModule(
4143 _device: api::VkDevice,
4144 create_info: *const api::VkShaderModuleCreateInfo,
4145 _allocator: *const api::VkAllocationCallbacks,
4146 shader_module: *mut api::VkShaderModule,
4147 ) -> api::VkResult {
4148 parse_next_chain_const!{
4150 root = api::VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
4152 let ref create_info = *create_info;
4153 const U32_BYTE_COUNT: usize = 4;
4154 assert_eq!(U32_BYTE_COUNT, mem::size_of::<u32>());
4155 assert_eq!(create_info.codeSize % U32_BYTE_COUNT, 0);
4156 assert_ne!(create_info.codeSize, 0);
4157 let code = slice::from_raw_parts(create_info.pCode, create_info.codeSize / U32_BYTE_COUNT);
4158 *shader_module = OwnedHandle::<api::VkShaderModule>::new(ShaderModule {
4159 code: code.to_owned(),
4165 #[allow(non_snake_case)]
4166 pub unsafe extern "system" fn vkDestroyShaderModule(
4167 _device: api::VkDevice,
4168 shader_module: api::VkShaderModule,
4169 _allocator: *const api::VkAllocationCallbacks,
4171 OwnedHandle::from(shader_module);
4174 #[allow(non_snake_case)]
4175 pub unsafe extern "system" fn vkCreatePipelineCache(
4176 _device: api::VkDevice,
4177 _pCreateInfo: *const api::VkPipelineCacheCreateInfo,
4178 _pAllocator: *const api::VkAllocationCallbacks,
4179 _pPipelineCache: *mut api::VkPipelineCache,
4180 ) -> api::VkResult {
4184 #[allow(non_snake_case)]
4185 pub unsafe extern "system" fn vkDestroyPipelineCache(
4186 _device: api::VkDevice,
4187 _pipelineCache: api::VkPipelineCache,
4188 _pAllocator: *const api::VkAllocationCallbacks,
4193 #[allow(non_snake_case)]
4194 pub unsafe extern "system" fn vkGetPipelineCacheData(
4195 _device: api::VkDevice,
4196 _pipelineCache: api::VkPipelineCache,
4197 _pDataSize: *mut usize,
4198 _pData: *mut c_void,
4199 ) -> api::VkResult {
4203 #[allow(non_snake_case)]
4204 pub unsafe extern "system" fn vkMergePipelineCaches(
4205 _device: api::VkDevice,
4206 _dstCache: api::VkPipelineCache,
4207 _srcCacheCount: u32,
4208 _pSrcCaches: *const api::VkPipelineCache,
4209 ) -> api::VkResult {
4213 #[allow(non_snake_case)]
4214 pub unsafe extern "system" fn vkCreateGraphicsPipelines(
4215 _device: api::VkDevice,
4216 _pipelineCache: api::VkPipelineCache,
4217 _createInfoCount: u32,
4218 _pCreateInfos: *const api::VkGraphicsPipelineCreateInfo,
4219 _pAllocator: *const api::VkAllocationCallbacks,
4220 _pPipelines: *mut api::VkPipeline,
4221 ) -> api::VkResult {
4225 #[allow(non_snake_case)]
4226 pub unsafe extern "system" fn vkCreateComputePipelines(
4227 _device: api::VkDevice,
4228 _pipelineCache: api::VkPipelineCache,
4229 _createInfoCount: u32,
4230 _pCreateInfos: *const api::VkComputePipelineCreateInfo,
4231 _pAllocator: *const api::VkAllocationCallbacks,
4232 _pPipelines: *mut api::VkPipeline,
4233 ) -> api::VkResult {
4237 #[allow(non_snake_case)]
4238 pub unsafe extern "system" fn vkDestroyPipeline(
4239 _device: api::VkDevice,
4240 _pipeline: api::VkPipeline,
4241 _pAllocator: *const api::VkAllocationCallbacks,
4246 #[allow(non_snake_case)]
4247 pub unsafe extern "system" fn vkCreatePipelineLayout(
4248 _device: api::VkDevice,
4249 _pCreateInfo: *const api::VkPipelineLayoutCreateInfo,
4250 _pAllocator: *const api::VkAllocationCallbacks,
4251 _pPipelineLayout: *mut api::VkPipelineLayout,
4252 ) -> api::VkResult {
4256 #[allow(non_snake_case)]
4257 pub unsafe extern "system" fn vkDestroyPipelineLayout(
4258 _device: api::VkDevice,
4259 _pipelineLayout: api::VkPipelineLayout,
4260 _pAllocator: *const api::VkAllocationCallbacks,
4265 #[allow(non_snake_case)]
4266 pub unsafe extern "system" fn vkCreateSampler(
4267 _device: api::VkDevice,
4268 create_info: *const api::VkSamplerCreateInfo,
4269 _allocator: *const api::VkAllocationCallbacks,
4270 sampler: *mut api::VkSampler,
4271 ) -> api::VkResult {
4272 parse_next_chain_const!{
4274 root = api::VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
4276 let ref create_info = *create_info;
4277 *sampler = OwnedHandle::<api::VkSampler>::new(Sampler {
4278 mag_filter: create_info.magFilter,
4279 min_filter: create_info.minFilter,
4280 mipmap_mode: create_info.mipmapMode,
4282 create_info.addressModeU,
4283 create_info.addressModeV,
4284 create_info.addressModeW,
4286 mip_lod_bias: create_info.mipLodBias,
4287 anisotropy: if create_info.anisotropyEnable != api::VK_FALSE {
4288 Some(sampler::AnisotropySettings {
4289 max: create_info.maxAnisotropy,
4294 compare_op: if create_info.compareEnable != api::VK_FALSE {
4295 Some(create_info.compareOp)
4299 min_lod: create_info.minLod,
4300 max_lod: create_info.maxLod,
4301 border_color: create_info.borderColor,
4302 unnormalized_coordinates: create_info.unnormalizedCoordinates != api::VK_FALSE,
4303 sampler_ycbcr_conversion: None,
4309 #[allow(non_snake_case)]
4310 pub unsafe extern "system" fn vkDestroySampler(
4311 _device: api::VkDevice,
4312 sampler: api::VkSampler,
4313 _allocator: *const api::VkAllocationCallbacks,
4315 OwnedHandle::from(sampler);
4318 #[allow(non_snake_case)]
4319 pub unsafe extern "system" fn vkCreateDescriptorSetLayout(
4320 _device: api::VkDevice,
4321 _pCreateInfo: *const api::VkDescriptorSetLayoutCreateInfo,
4322 _pAllocator: *const api::VkAllocationCallbacks,
4323 _pSetLayout: *mut api::VkDescriptorSetLayout,
4324 ) -> api::VkResult {
4328 #[allow(non_snake_case)]
4329 pub unsafe extern "system" fn vkDestroyDescriptorSetLayout(
4330 _device: api::VkDevice,
4331 _descriptorSetLayout: api::VkDescriptorSetLayout,
4332 _pAllocator: *const api::VkAllocationCallbacks,
4337 #[allow(non_snake_case)]
4338 pub unsafe extern "system" fn vkCreateDescriptorPool(
4339 _device: api::VkDevice,
4340 _pCreateInfo: *const api::VkDescriptorPoolCreateInfo,
4341 _pAllocator: *const api::VkAllocationCallbacks,
4342 _pDescriptorPool: *mut api::VkDescriptorPool,
4343 ) -> api::VkResult {
4347 #[allow(non_snake_case)]
4348 pub unsafe extern "system" fn vkDestroyDescriptorPool(
4349 _device: api::VkDevice,
4350 _descriptorPool: api::VkDescriptorPool,
4351 _pAllocator: *const api::VkAllocationCallbacks,
4356 #[allow(non_snake_case)]
4357 pub unsafe extern "system" fn vkResetDescriptorPool(
4358 _device: api::VkDevice,
4359 _descriptorPool: api::VkDescriptorPool,
4360 _flags: api::VkDescriptorPoolResetFlags,
4361 ) -> api::VkResult {
4365 #[allow(non_snake_case)]
4366 pub unsafe extern "system" fn vkAllocateDescriptorSets(
4367 _device: api::VkDevice,
4368 _pAllocateInfo: *const api::VkDescriptorSetAllocateInfo,
4369 _pDescriptorSets: *mut api::VkDescriptorSet,
4370 ) -> api::VkResult {
4374 #[allow(non_snake_case)]
4375 pub unsafe extern "system" fn vkFreeDescriptorSets(
4376 _device: api::VkDevice,
4377 _descriptorPool: api::VkDescriptorPool,
4378 _descriptorSetCount: u32,
4379 _pDescriptorSets: *const api::VkDescriptorSet,
4380 ) -> api::VkResult {
4384 #[allow(non_snake_case)]
4385 pub unsafe extern "system" fn vkUpdateDescriptorSets(
4386 _device: api::VkDevice,
4387 _descriptorWriteCount: u32,
4388 _pDescriptorWrites: *const api::VkWriteDescriptorSet,
4389 _descriptorCopyCount: u32,
4390 _pDescriptorCopies: *const api::VkCopyDescriptorSet,
4395 #[allow(non_snake_case)]
4396 pub unsafe extern "system" fn vkCreateFramebuffer(
4397 _device: api::VkDevice,
4398 _pCreateInfo: *const api::VkFramebufferCreateInfo,
4399 _pAllocator: *const api::VkAllocationCallbacks,
4400 _pFramebuffer: *mut api::VkFramebuffer,
4401 ) -> api::VkResult {
4405 #[allow(non_snake_case)]
4406 pub unsafe extern "system" fn vkDestroyFramebuffer(
4407 _device: api::VkDevice,
4408 _framebuffer: api::VkFramebuffer,
4409 _pAllocator: *const api::VkAllocationCallbacks,
4414 #[allow(non_snake_case)]
4415 pub unsafe extern "system" fn vkCreateRenderPass(
4416 _device: api::VkDevice,
4417 _pCreateInfo: *const api::VkRenderPassCreateInfo,
4418 _pAllocator: *const api::VkAllocationCallbacks,
4419 _pRenderPass: *mut api::VkRenderPass,
4420 ) -> api::VkResult {
4424 #[allow(non_snake_case)]
4425 pub unsafe extern "system" fn vkDestroyRenderPass(
4426 _device: api::VkDevice,
4427 _renderPass: api::VkRenderPass,
4428 _pAllocator: *const api::VkAllocationCallbacks,
4433 #[allow(non_snake_case)]
4434 pub unsafe extern "system" fn vkGetRenderAreaGranularity(
4435 _device: api::VkDevice,
4436 _renderPass: api::VkRenderPass,
4437 _pGranularity: *mut api::VkExtent2D,
4442 #[allow(non_snake_case)]
4443 pub unsafe extern "system" fn vkCreateCommandPool(
4444 _device: api::VkDevice,
4445 _pCreateInfo: *const api::VkCommandPoolCreateInfo,
4446 _pAllocator: *const api::VkAllocationCallbacks,
4447 _pCommandPool: *mut api::VkCommandPool,
4448 ) -> api::VkResult {
4452 #[allow(non_snake_case)]
4453 pub unsafe extern "system" fn vkDestroyCommandPool(
4454 _device: api::VkDevice,
4455 _commandPool: api::VkCommandPool,
4456 _pAllocator: *const api::VkAllocationCallbacks,
4461 #[allow(non_snake_case)]
4462 pub unsafe extern "system" fn vkResetCommandPool(
4463 _device: api::VkDevice,
4464 _commandPool: api::VkCommandPool,
4465 _flags: api::VkCommandPoolResetFlags,
4466 ) -> api::VkResult {
4470 #[allow(non_snake_case)]
4471 pub unsafe extern "system" fn vkAllocateCommandBuffers(
4472 _device: api::VkDevice,
4473 _pAllocateInfo: *const api::VkCommandBufferAllocateInfo,
4474 _pCommandBuffers: *mut api::VkCommandBuffer,
4475 ) -> api::VkResult {
4479 #[allow(non_snake_case)]
4480 pub unsafe extern "system" fn vkFreeCommandBuffers(
4481 _device: api::VkDevice,
4482 _commandPool: api::VkCommandPool,
4483 _commandBufferCount: u32,
4484 _pCommandBuffers: *const api::VkCommandBuffer,
4489 #[allow(non_snake_case)]
4490 pub unsafe extern "system" fn vkBeginCommandBuffer(
4491 _commandBuffer: api::VkCommandBuffer,
4492 _pBeginInfo: *const api::VkCommandBufferBeginInfo,
4493 ) -> api::VkResult {
4497 #[allow(non_snake_case)]
4498 pub unsafe extern "system" fn vkEndCommandBuffer(
4499 _commandBuffer: api::VkCommandBuffer,
4500 ) -> api::VkResult {
4504 #[allow(non_snake_case)]
4505 pub unsafe extern "system" fn vkResetCommandBuffer(
4506 _commandBuffer: api::VkCommandBuffer,
4507 _flags: api::VkCommandBufferResetFlags,
4508 ) -> api::VkResult {
4512 #[allow(non_snake_case)]
4513 pub unsafe extern "system" fn vkCmdBindPipeline(
4514 _commandBuffer: api::VkCommandBuffer,
4515 _pipelineBindPoint: api::VkPipelineBindPoint,
4516 _pipeline: api::VkPipeline,
4521 #[allow(non_snake_case)]
4522 pub unsafe extern "system" fn vkCmdSetViewport(
4523 _commandBuffer: api::VkCommandBuffer,
4524 _firstViewport: u32,
4525 _viewportCount: u32,
4526 _pViewports: *const api::VkViewport,
4531 #[allow(non_snake_case)]
4532 pub unsafe extern "system" fn vkCmdSetScissor(
4533 _commandBuffer: api::VkCommandBuffer,
4536 _pScissors: *const api::VkRect2D,
4541 #[allow(non_snake_case)]
4542 pub unsafe extern "system" fn vkCmdSetLineWidth(
4543 _commandBuffer: api::VkCommandBuffer,
4549 #[allow(non_snake_case)]
4550 pub unsafe extern "system" fn vkCmdSetDepthBias(
4551 _commandBuffer: api::VkCommandBuffer,
4552 _depthBiasConstantFactor: f32,
4553 _depthBiasClamp: f32,
4554 _depthBiasSlopeFactor: f32,
4559 #[allow(non_snake_case)]
4560 pub unsafe extern "system" fn vkCmdSetBlendConstants(
4561 _commandBuffer: api::VkCommandBuffer,
4562 _blendConstants: *const f32,
4567 #[allow(non_snake_case)]
4568 pub unsafe extern "system" fn vkCmdSetDepthBounds(
4569 _commandBuffer: api::VkCommandBuffer,
4570 _minDepthBounds: f32,
4571 _maxDepthBounds: f32,
4576 #[allow(non_snake_case)]
4577 pub unsafe extern "system" fn vkCmdSetStencilCompareMask(
4578 _commandBuffer: api::VkCommandBuffer,
4579 _faceMask: api::VkStencilFaceFlags,
4585 #[allow(non_snake_case)]
4586 pub unsafe extern "system" fn vkCmdSetStencilWriteMask(
4587 _commandBuffer: api::VkCommandBuffer,
4588 _faceMask: api::VkStencilFaceFlags,
4594 #[allow(non_snake_case)]
4595 pub unsafe extern "system" fn vkCmdSetStencilReference(
4596 _commandBuffer: api::VkCommandBuffer,
4597 _faceMask: api::VkStencilFaceFlags,
4603 #[allow(non_snake_case)]
4604 pub unsafe extern "system" fn vkCmdBindDescriptorSets(
4605 _commandBuffer: api::VkCommandBuffer,
4606 _pipelineBindPoint: api::VkPipelineBindPoint,
4607 _layout: api::VkPipelineLayout,
4609 _descriptorSetCount: u32,
4610 _pDescriptorSets: *const api::VkDescriptorSet,
4611 _dynamicOffsetCount: u32,
4612 _pDynamicOffsets: *const u32,
4617 #[allow(non_snake_case)]
4618 pub unsafe extern "system" fn vkCmdBindIndexBuffer(
4619 _commandBuffer: api::VkCommandBuffer,
4620 _buffer: api::VkBuffer,
4621 _offset: api::VkDeviceSize,
4622 _indexType: api::VkIndexType,
4627 #[allow(non_snake_case)]
4628 pub unsafe extern "system" fn vkCmdBindVertexBuffers(
4629 _commandBuffer: api::VkCommandBuffer,
4632 _pBuffers: *const api::VkBuffer,
4633 _pOffsets: *const api::VkDeviceSize,
4638 #[allow(non_snake_case)]
4639 pub unsafe extern "system" fn vkCmdDraw(
4640 _commandBuffer: api::VkCommandBuffer,
4642 _instanceCount: u32,
4644 _firstInstance: u32,
4649 #[allow(non_snake_case)]
4650 pub unsafe extern "system" fn vkCmdDrawIndexed(
4651 _commandBuffer: api::VkCommandBuffer,
4653 _instanceCount: u32,
4656 _firstInstance: u32,
4661 #[allow(non_snake_case)]
4662 pub unsafe extern "system" fn vkCmdDrawIndirect(
4663 _commandBuffer: api::VkCommandBuffer,
4664 _buffer: api::VkBuffer,
4665 _offset: api::VkDeviceSize,
4672 #[allow(non_snake_case)]
4673 pub unsafe extern "system" fn vkCmdDrawIndexedIndirect(
4674 _commandBuffer: api::VkCommandBuffer,
4675 _buffer: api::VkBuffer,
4676 _offset: api::VkDeviceSize,
4683 #[allow(non_snake_case)]
4684 pub unsafe extern "system" fn vkCmdDispatch(
4685 _commandBuffer: api::VkCommandBuffer,
4693 #[allow(non_snake_case)]
4694 pub unsafe extern "system" fn vkCmdDispatchIndirect(
4695 _commandBuffer: api::VkCommandBuffer,
4696 _buffer: api::VkBuffer,
4697 _offset: api::VkDeviceSize,
4702 #[allow(non_snake_case)]
4703 pub unsafe extern "system" fn vkCmdCopyBuffer(
4704 _commandBuffer: api::VkCommandBuffer,
4705 _srcBuffer: api::VkBuffer,
4706 _dstBuffer: api::VkBuffer,
4708 _pRegions: *const api::VkBufferCopy,
4713 #[allow(non_snake_case)]
4714 pub unsafe extern "system" fn vkCmdCopyImage(
4715 _commandBuffer: api::VkCommandBuffer,
4716 _srcImage: api::VkImage,
4717 _srcImageLayout: api::VkImageLayout,
4718 _dstImage: api::VkImage,
4719 _dstImageLayout: api::VkImageLayout,
4721 _pRegions: *const api::VkImageCopy,
4726 #[allow(non_snake_case)]
4727 pub unsafe extern "system" fn vkCmdBlitImage(
4728 _commandBuffer: api::VkCommandBuffer,
4729 _srcImage: api::VkImage,
4730 _srcImageLayout: api::VkImageLayout,
4731 _dstImage: api::VkImage,
4732 _dstImageLayout: api::VkImageLayout,
4734 _pRegions: *const api::VkImageBlit,
4735 _filter: api::VkFilter,
4740 #[allow(non_snake_case)]
4741 pub unsafe extern "system" fn vkCmdCopyBufferToImage(
4742 _commandBuffer: api::VkCommandBuffer,
4743 _srcBuffer: api::VkBuffer,
4744 _dstImage: api::VkImage,
4745 _dstImageLayout: api::VkImageLayout,
4747 _pRegions: *const api::VkBufferImageCopy,
4752 #[allow(non_snake_case)]
4753 pub unsafe extern "system" fn vkCmdCopyImageToBuffer(
4754 _commandBuffer: api::VkCommandBuffer,
4755 _srcImage: api::VkImage,
4756 _srcImageLayout: api::VkImageLayout,
4757 _dstBuffer: api::VkBuffer,
4759 _pRegions: *const api::VkBufferImageCopy,
4764 #[allow(non_snake_case)]
4765 pub unsafe extern "system" fn vkCmdUpdateBuffer(
4766 _commandBuffer: api::VkCommandBuffer,
4767 _dstBuffer: api::VkBuffer,
4768 _dstOffset: api::VkDeviceSize,
4769 _dataSize: api::VkDeviceSize,
4770 _pData: *const c_void,
4775 #[allow(non_snake_case)]
4776 pub unsafe extern "system" fn vkCmdFillBuffer(
4777 _commandBuffer: api::VkCommandBuffer,
4778 _dstBuffer: api::VkBuffer,
4779 _dstOffset: api::VkDeviceSize,
4780 _size: api::VkDeviceSize,
4786 #[allow(non_snake_case)]
4787 pub unsafe extern "system" fn vkCmdClearColorImage(
4788 _commandBuffer: api::VkCommandBuffer,
4789 _image: api::VkImage,
4790 _imageLayout: api::VkImageLayout,
4791 _pColor: *const api::VkClearColorValue,
4793 _pRanges: *const api::VkImageSubresourceRange,
4798 #[allow(non_snake_case)]
4799 pub unsafe extern "system" fn vkCmdClearDepthStencilImage(
4800 _commandBuffer: api::VkCommandBuffer,
4801 _image: api::VkImage,
4802 _imageLayout: api::VkImageLayout,
4803 _pDepthStencil: *const api::VkClearDepthStencilValue,
4805 _pRanges: *const api::VkImageSubresourceRange,
4810 #[allow(non_snake_case)]
4811 pub unsafe extern "system" fn vkCmdClearAttachments(
4812 _commandBuffer: api::VkCommandBuffer,
4813 _attachmentCount: u32,
4814 _pAttachments: *const api::VkClearAttachment,
4816 _pRects: *const api::VkClearRect,
4821 #[allow(non_snake_case)]
4822 pub unsafe extern "system" fn vkCmdResolveImage(
4823 _commandBuffer: api::VkCommandBuffer,
4824 _srcImage: api::VkImage,
4825 _srcImageLayout: api::VkImageLayout,
4826 _dstImage: api::VkImage,
4827 _dstImageLayout: api::VkImageLayout,
4829 _pRegions: *const api::VkImageResolve,
4834 #[allow(non_snake_case)]
4835 pub unsafe extern "system" fn vkCmdSetEvent(
4836 _commandBuffer: api::VkCommandBuffer,
4837 _event: api::VkEvent,
4838 _stageMask: api::VkPipelineStageFlags,
4843 #[allow(non_snake_case)]
4844 pub unsafe extern "system" fn vkCmdResetEvent(
4845 _commandBuffer: api::VkCommandBuffer,
4846 _event: api::VkEvent,
4847 _stageMask: api::VkPipelineStageFlags,
4852 #[allow(non_snake_case)]
4853 pub unsafe extern "system" fn vkCmdWaitEvents(
4854 _commandBuffer: api::VkCommandBuffer,
4856 _pEvents: *const api::VkEvent,
4857 _srcStageMask: api::VkPipelineStageFlags,
4858 _dstStageMask: api::VkPipelineStageFlags,
4859 _memoryBarrierCount: u32,
4860 _pMemoryBarriers: *const api::VkMemoryBarrier,
4861 _bufferMemoryBarrierCount: u32,
4862 _pBufferMemoryBarriers: *const api::VkBufferMemoryBarrier,
4863 _imageMemoryBarrierCount: u32,
4864 _pImageMemoryBarriers: *const api::VkImageMemoryBarrier,
4869 #[allow(non_snake_case)]
4870 pub unsafe extern "system" fn vkCmdPipelineBarrier(
4871 _commandBuffer: api::VkCommandBuffer,
4872 _srcStageMask: api::VkPipelineStageFlags,
4873 _dstStageMask: api::VkPipelineStageFlags,
4874 _dependencyFlags: api::VkDependencyFlags,
4875 _memoryBarrierCount: u32,
4876 _pMemoryBarriers: *const api::VkMemoryBarrier,
4877 _bufferMemoryBarrierCount: u32,
4878 _pBufferMemoryBarriers: *const api::VkBufferMemoryBarrier,
4879 _imageMemoryBarrierCount: u32,
4880 _pImageMemoryBarriers: *const api::VkImageMemoryBarrier,
4885 #[allow(non_snake_case)]
4886 pub unsafe extern "system" fn vkCmdBeginQuery(
4887 _commandBuffer: api::VkCommandBuffer,
4888 _queryPool: api::VkQueryPool,
4890 _flags: api::VkQueryControlFlags,
4895 #[allow(non_snake_case)]
4896 pub unsafe extern "system" fn vkCmdEndQuery(
4897 _commandBuffer: api::VkCommandBuffer,
4898 _queryPool: api::VkQueryPool,
4904 #[allow(non_snake_case)]
4905 pub unsafe extern "system" fn vkCmdResetQueryPool(
4906 _commandBuffer: api::VkCommandBuffer,
4907 _queryPool: api::VkQueryPool,
4914 #[allow(non_snake_case)]
4915 pub unsafe extern "system" fn vkCmdWriteTimestamp(
4916 _commandBuffer: api::VkCommandBuffer,
4917 _pipelineStage: api::VkPipelineStageFlagBits,
4918 _queryPool: api::VkQueryPool,
4924 #[allow(non_snake_case)]
4925 pub unsafe extern "system" fn vkCmdCopyQueryPoolResults(
4926 _commandBuffer: api::VkCommandBuffer,
4927 _queryPool: api::VkQueryPool,
4930 _dstBuffer: api::VkBuffer,
4931 _dstOffset: api::VkDeviceSize,
4932 _stride: api::VkDeviceSize,
4933 _flags: api::VkQueryResultFlags,
4938 #[allow(non_snake_case)]
4939 pub unsafe extern "system" fn vkCmdPushConstants(
4940 _commandBuffer: api::VkCommandBuffer,
4941 _layout: api::VkPipelineLayout,
4942 _stageFlags: api::VkShaderStageFlags,
4945 _pValues: *const c_void,
4950 #[allow(non_snake_case)]
4951 pub unsafe extern "system" fn vkCmdBeginRenderPass(
4952 _commandBuffer: api::VkCommandBuffer,
4953 _pRenderPassBegin: *const api::VkRenderPassBeginInfo,
4954 _contents: api::VkSubpassContents,
4959 #[allow(non_snake_case)]
4960 pub unsafe extern "system" fn vkCmdNextSubpass(
4961 _commandBuffer: api::VkCommandBuffer,
4962 _contents: api::VkSubpassContents,
4967 #[allow(non_snake_case)]
4968 pub unsafe extern "system" fn vkCmdEndRenderPass(_commandBuffer: api::VkCommandBuffer) {
4972 #[allow(non_snake_case)]
4973 pub unsafe extern "system" fn vkCmdExecuteCommands(
4974 _commandBuffer: api::VkCommandBuffer,
4975 _commandBufferCount: u32,
4976 _pCommandBuffers: *const api::VkCommandBuffer,
4981 #[allow(non_snake_case)]
4982 pub unsafe extern "system" fn vkBindBufferMemory2(
4983 _device: api::VkDevice,
4984 bind_info_count: u32,
4985 bind_infos: *const api::VkBindBufferMemoryInfo,
4986 ) -> api::VkResult {
4987 assert_ne!(bind_info_count, 0);
4988 let bind_infos = slice::from_raw_parts(bind_infos, bind_info_count as usize);
4989 for bind_info in bind_infos {
4990 parse_next_chain_const!{
4991 bind_info as *const api::VkBindBufferMemoryInfo,
4992 root = api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO,
4993 device_group_info: api::VkBindBufferMemoryDeviceGroupInfo = api::VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO,
4995 if !device_group_info.is_null() {
4996 let ref device_group_info = *device_group_info;
4997 if device_group_info.deviceIndexCount == 0 {
4999 assert_eq!(device_group_info.deviceIndexCount, 1);
5000 assert_eq!(*device_group_info.pDeviceIndices, 0);
5003 let ref bind_info = *bind_info;
5004 let mut buffer = MutHandle::from(bind_info.buffer).unwrap();
5005 let device_memory = SharedHandle::from(bind_info.memory).unwrap();
5006 let device_memory_size = device_memory.size();
5007 assert!(bind_info.memoryOffset < device_memory_size as u64);
5008 let offset = bind_info.memoryOffset as usize;
5009 assert!(buffer.size.checked_add(offset).unwrap() <= device_memory_size);
5010 assert_eq!(offset % BUFFER_ALIGNMENT, 0);
5011 buffer.memory = Some(BufferMemory {
5019 #[allow(non_snake_case)]
5020 pub unsafe extern "system" fn vkBindImageMemory2(
5021 _device: api::VkDevice,
5022 bind_info_count: u32,
5023 bind_infos: *const api::VkBindImageMemoryInfo,
5024 ) -> api::VkResult {
5025 assert_ne!(bind_info_count, 0);
5026 let bind_infos = slice::from_raw_parts(bind_infos, bind_info_count as usize);
5027 for bind_info in bind_infos {
5028 parse_next_chain_const!{
5029 bind_info as *const api::VkBindImageMemoryInfo,
5030 root = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
5031 device_group_info: api::VkBindImageMemoryDeviceGroupInfo = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO,
5032 swapchain_info: api::VkBindImageMemorySwapchainInfoKHR = api::VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR,
5033 plane_info: api::VkBindImagePlaneMemoryInfo = api::VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO,
5035 if !device_group_info.is_null() {
5036 let ref device_group_info = *device_group_info;
5037 if device_group_info.deviceIndexCount == 0 {
5039 assert_eq!(device_group_info.deviceIndexCount, 1);
5040 assert_eq!(*device_group_info.pDeviceIndices, 0);
5043 if !swapchain_info.is_null() {
5046 if !plane_info.is_null() {
5049 let ref bind_info = *bind_info;
5050 let mut image = MutHandle::from(bind_info.image).unwrap();
5051 let device_memory = SharedHandle::from(bind_info.memory).unwrap();
5052 let device_memory_size = device_memory.size();
5053 let image_memory_layout = image.properties.computed_properties().memory_layout;
5054 assert!(bind_info.memoryOffset < device_memory_size as u64);
5055 let offset = bind_info.memoryOffset as usize;
5056 assert!(image_memory_layout.size.checked_add(offset).unwrap() <= device_memory_size);
5057 assert_eq!(offset % image_memory_layout.alignment, 0);
5058 image.memory = Some(ImageMemory {
5066 #[allow(non_snake_case)]
5067 pub unsafe extern "system" fn vkGetDeviceGroupPeerMemoryFeatures(
5068 _device: api::VkDevice,
5070 _localDeviceIndex: u32,
5071 _remoteDeviceIndex: u32,
5072 _pPeerMemoryFeatures: *mut api::VkPeerMemoryFeatureFlags,
5077 #[allow(non_snake_case)]
5078 pub unsafe extern "system" fn vkCmdSetDeviceMask(
5079 _commandBuffer: api::VkCommandBuffer,
5085 #[allow(non_snake_case)]
5086 pub unsafe extern "system" fn vkCmdDispatchBase(
5087 _commandBuffer: api::VkCommandBuffer,
5098 #[allow(non_snake_case)]
5099 pub unsafe extern "system" fn vkEnumeratePhysicalDeviceGroups(
5100 instance: api::VkInstance,
5101 physical_device_group_count: *mut u32,
5102 physical_device_group_properties: *mut api::VkPhysicalDeviceGroupProperties,
5103 ) -> api::VkResult {
5105 physical_device_group_count,
5106 physical_device_group_properties,
5108 |physical_device_group_properties, _| {
5109 parse_next_chain_mut!{
5110 physical_device_group_properties as *mut api::VkPhysicalDeviceGroupProperties,
5111 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES,
5113 let mut physical_devices = [Handle::null(); api::VK_MAX_DEVICE_GROUP_SIZE as usize];
5114 physical_devices[0] = SharedHandle::from(instance)
5118 *physical_device_group_properties = api::VkPhysicalDeviceGroupProperties {
5119 sType: physical_device_group_properties.sType,
5120 pNext: physical_device_group_properties.pNext,
5121 physicalDeviceCount: 1,
5122 physicalDevices: physical_devices,
5123 subsetAllocation: api::VK_TRUE,
5129 #[allow(non_snake_case)]
5130 pub unsafe extern "system" fn vkGetImageMemoryRequirements2(
5131 _device: api::VkDevice,
5132 info: *const api::VkImageMemoryRequirementsInfo2,
5133 memory_requirements: *mut api::VkMemoryRequirements2,
5135 parse_next_chain_const!{
5137 root = api::VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2,
5138 image_plane_memory_requirements_info: api::VkImagePlaneMemoryRequirementsInfo = api::VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO,
5140 parse_next_chain_mut!{
5141 memory_requirements,
5142 root = api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
5143 dedicated_requirements: api::VkMemoryDedicatedRequirements = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS,
5145 if !image_plane_memory_requirements_info.is_null() {
5148 let ref info = *info;
5149 let image = SharedHandle::from(info.image).unwrap();
5150 let ref mut memory_requirements = *memory_requirements;
5151 let layout = image.properties.computed_properties().memory_layout;
5152 memory_requirements.memoryRequirements = api::VkMemoryRequirements {
5153 size: layout.size as u64,
5154 alignment: layout.alignment as u64,
5155 memoryTypeBits: DeviceMemoryType::Main.to_bits(),
5156 ..mem::zeroed() // for padding fields
5158 if !dedicated_requirements.is_null() {
5159 let ref mut dedicated_requirements = *dedicated_requirements;
5160 dedicated_requirements.prefersDedicatedAllocation = api::VK_FALSE;
5161 dedicated_requirements.requiresDedicatedAllocation = api::VK_FALSE;
5165 #[allow(non_snake_case)]
5166 pub unsafe extern "system" fn vkGetBufferMemoryRequirements2(
5167 _device: api::VkDevice,
5168 info: *const api::VkBufferMemoryRequirementsInfo2,
5169 memory_requirements: *mut api::VkMemoryRequirements2,
5171 parse_next_chain_const!{
5173 root = api::VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
5175 parse_next_chain_mut!{
5176 memory_requirements,
5177 root = api::VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
5178 dedicated_requirements: api::VkMemoryDedicatedRequirements = api::VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS,
5180 let ref mut memory_requirements = *memory_requirements;
5181 let ref info = *info;
5182 let buffer = SharedHandle::from(info.buffer).unwrap();
5183 let layout = DeviceMemoryLayout::calculate(buffer.size, BUFFER_ALIGNMENT);
5184 memory_requirements.memoryRequirements = api::VkMemoryRequirements {
5185 size: layout.size as u64,
5186 alignment: layout.alignment as u64,
5187 memoryTypeBits: DeviceMemoryType::Main.to_bits(),
5188 ..mem::zeroed() // for padding fields
5190 if !dedicated_requirements.is_null() {
5191 let ref mut dedicated_requirements = *dedicated_requirements;
5192 dedicated_requirements.prefersDedicatedAllocation = api::VK_FALSE;
5193 dedicated_requirements.requiresDedicatedAllocation = api::VK_FALSE;
5197 #[allow(non_snake_case)]
5198 pub unsafe extern "system" fn vkGetImageSparseMemoryRequirements2(
5199 _device: api::VkDevice,
5200 _pInfo: *const api::VkImageSparseMemoryRequirementsInfo2,
5201 _pSparseMemoryRequirementCount: *mut u32,
5202 _pSparseMemoryRequirements: *mut api::VkSparseImageMemoryRequirements2,
5207 #[allow(non_snake_case)]
5208 pub unsafe extern "system" fn vkGetPhysicalDeviceFeatures2(
5209 physical_device: api::VkPhysicalDevice,
5210 features: *mut api::VkPhysicalDeviceFeatures2,
5212 parse_next_chain_mut!{
5214 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
5215 sampler_ycbcr_conversion_features: api::VkPhysicalDeviceSamplerYcbcrConversionFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES,
5216 physical_device_16bit_storage_features: api::VkPhysicalDevice16BitStorageFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES,
5217 variable_pointer_features: api::VkPhysicalDeviceVariablePointerFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
5218 physical_device_shader_draw_parameter_features: api::VkPhysicalDeviceShaderDrawParameterFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES,
5219 physical_device_protected_memory_features: api::VkPhysicalDeviceProtectedMemoryFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES,
5220 physical_device_multiview_features: api::VkPhysicalDeviceMultiviewFeatures = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES,
5222 let physical_device = SharedHandle::from(physical_device).unwrap();
5223 physical_device.features.export_feature_set(&mut *features);
5224 if !sampler_ycbcr_conversion_features.is_null() {
5227 .export_feature_set(&mut *sampler_ycbcr_conversion_features);
5229 if !physical_device_16bit_storage_features.is_null() {
5232 .export_feature_set(&mut *physical_device_16bit_storage_features);
5234 if !variable_pointer_features.is_null() {
5237 .export_feature_set(&mut *variable_pointer_features);
5239 if !physical_device_shader_draw_parameter_features.is_null() {
5242 .export_feature_set(&mut *physical_device_shader_draw_parameter_features);
5244 if !physical_device_protected_memory_features.is_null() {
5247 .export_feature_set(&mut *physical_device_protected_memory_features);
5249 if !physical_device_multiview_features.is_null() {
5252 .export_feature_set(&mut *physical_device_multiview_features);
5256 #[allow(non_snake_case)]
5257 pub unsafe extern "system" fn vkGetPhysicalDeviceProperties2(
5258 physical_device: api::VkPhysicalDevice,
5259 properties: *mut api::VkPhysicalDeviceProperties2,
5261 parse_next_chain_mut!{
5263 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
5264 point_clipping_properties: api::VkPhysicalDevicePointClippingProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES,
5265 multiview_properties: api::VkPhysicalDeviceMultiviewProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES,
5266 id_properties: api::VkPhysicalDeviceIDProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES,
5267 maintenance_3_properties: api::VkPhysicalDeviceMaintenance3Properties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES,
5268 protected_memory_properties: api::VkPhysicalDeviceProtectedMemoryProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES,
5269 subgroup_properties: api::VkPhysicalDeviceSubgroupProperties = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES,
5271 let ref mut properties = *properties;
5272 let physical_device = SharedHandle::from(physical_device).unwrap();
5273 properties.properties = physical_device.properties;
5274 if !point_clipping_properties.is_null() {
5275 let ref mut point_clipping_properties = *point_clipping_properties;
5276 *point_clipping_properties = api::VkPhysicalDevicePointClippingProperties {
5277 sType: point_clipping_properties.sType,
5278 pNext: point_clipping_properties.pNext,
5279 ..physical_device.point_clipping_properties
5282 if !multiview_properties.is_null() {
5283 let ref mut multiview_properties = *multiview_properties;
5284 *multiview_properties = api::VkPhysicalDeviceMultiviewProperties {
5285 sType: multiview_properties.sType,
5286 pNext: multiview_properties.pNext,
5287 ..physical_device.multiview_properties
5290 if !id_properties.is_null() {
5291 let ref mut id_properties = *id_properties;
5292 *id_properties = api::VkPhysicalDeviceIDProperties {
5293 sType: id_properties.sType,
5294 pNext: id_properties.pNext,
5295 ..physical_device.id_properties
5298 if !maintenance_3_properties.is_null() {
5299 let ref mut maintenance_3_properties = *maintenance_3_properties;
5300 *maintenance_3_properties = api::VkPhysicalDeviceMaintenance3Properties {
5301 sType: maintenance_3_properties.sType,
5302 pNext: maintenance_3_properties.pNext,
5303 ..physical_device.maintenance_3_properties
5306 if !protected_memory_properties.is_null() {
5307 let ref mut protected_memory_properties = *protected_memory_properties;
5308 *protected_memory_properties = api::VkPhysicalDeviceProtectedMemoryProperties {
5309 sType: protected_memory_properties.sType,
5310 pNext: protected_memory_properties.pNext,
5311 ..physical_device.protected_memory_properties
5314 if !subgroup_properties.is_null() {
5315 let ref mut subgroup_properties = *subgroup_properties;
5316 *subgroup_properties = api::VkPhysicalDeviceSubgroupProperties {
5317 sType: subgroup_properties.sType,
5318 pNext: subgroup_properties.pNext,
5319 ..physical_device.subgroup_properties
5324 #[allow(non_snake_case)]
5325 pub unsafe extern "system" fn vkGetPhysicalDeviceFormatProperties2(
5326 _physical_device: api::VkPhysicalDevice,
5327 format: api::VkFormat,
5328 format_properties: *mut api::VkFormatProperties2,
5330 parse_next_chain_mut!{
5332 root = api::VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2,
5334 let ref mut format_properties = *format_properties;
5335 format_properties.formatProperties = PhysicalDevice::get_format_properties(format);
5338 #[allow(non_snake_case)]
5339 pub unsafe extern "system" fn vkGetPhysicalDeviceImageFormatProperties2(
5340 _physicalDevice: api::VkPhysicalDevice,
5341 _pImageFormatInfo: *const api::VkPhysicalDeviceImageFormatInfo2,
5342 _pImageFormatProperties: *mut api::VkImageFormatProperties2,
5343 ) -> api::VkResult {
5347 #[allow(non_snake_case)]
5348 pub unsafe extern "system" fn vkGetPhysicalDeviceQueueFamilyProperties2(
5349 physical_device: api::VkPhysicalDevice,
5350 queue_family_property_count: *mut u32,
5351 queue_family_properties: *mut api::VkQueueFamilyProperties2,
5354 queue_family_property_count,
5355 queue_family_properties,
5356 QUEUE_COUNTS.iter(),
5357 |queue_family_properties, &count| {
5358 get_physical_device_queue_family_properties(
5359 SharedHandle::from(physical_device).unwrap(),
5360 queue_family_properties,
5367 #[allow(non_snake_case)]
5368 pub unsafe extern "system" fn vkGetPhysicalDeviceMemoryProperties2(
5369 physical_device: api::VkPhysicalDevice,
5370 memory_properties: *mut api::VkPhysicalDeviceMemoryProperties2,
5372 let physical_device = SharedHandle::from(physical_device).unwrap();
5373 parse_next_chain_mut!{
5375 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2,
5377 let ref mut memory_properties = *memory_properties;
5378 let mut properties: api::VkPhysicalDeviceMemoryProperties = mem::zeroed();
5379 properties.memoryTypeCount = DeviceMemoryTypes::default().len() as u32;
5380 for (memory_type, _) in DeviceMemoryTypes::default().iter() {
5381 properties.memoryTypes[memory_type as usize] = api::VkMemoryType {
5382 propertyFlags: memory_type.flags(),
5383 heapIndex: memory_type.heap() as u32,
5386 properties.memoryHeapCount = DeviceMemoryHeaps::default().len() as u32;
5387 for (memory_heap, _) in DeviceMemoryHeaps::default().iter() {
5388 properties.memoryHeaps[memory_heap as usize] = api::VkMemoryHeap {
5389 size: match memory_heap {
5390 DeviceMemoryHeap::Main => physical_device.system_memory_size * 7 / 8,
5392 flags: memory_heap.flags(),
5393 ..mem::zeroed() // for padding fields
5396 memory_properties.memoryProperties = properties;
5399 #[allow(non_snake_case)]
5400 pub unsafe extern "system" fn vkGetPhysicalDeviceSparseImageFormatProperties2(
5401 _physicalDevice: api::VkPhysicalDevice,
5402 _pFormatInfo: *const api::VkPhysicalDeviceSparseImageFormatInfo2,
5403 _pPropertyCount: *mut u32,
5404 _pProperties: *mut api::VkSparseImageFormatProperties2,
5409 #[allow(non_snake_case)]
5410 pub unsafe extern "system" fn vkTrimCommandPool(
5411 _device: api::VkDevice,
5412 _commandPool: api::VkCommandPool,
5413 _flags: api::VkCommandPoolTrimFlags,
5418 #[allow(non_snake_case)]
5419 pub unsafe extern "system" fn vkGetDeviceQueue2(
5420 device: api::VkDevice,
5421 queue_info: *const api::VkDeviceQueueInfo2,
5422 queue: *mut api::VkQueue,
5424 parse_next_chain_const!{
5426 root = api::VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2,
5428 let ref queue_info = *queue_info;
5429 assert_eq!(queue_info.flags, 0);
5430 let device = SharedHandle::from(device).unwrap();
5431 *queue = device.queues[queue_info.queueFamilyIndex as usize][queue_info.queueIndex as usize]
5435 #[allow(non_snake_case)]
5436 pub unsafe extern "system" fn vkCreateSamplerYcbcrConversion(
5437 _device: api::VkDevice,
5438 _pCreateInfo: *const api::VkSamplerYcbcrConversionCreateInfo,
5439 _pAllocator: *const api::VkAllocationCallbacks,
5440 _pYcbcrConversion: *mut api::VkSamplerYcbcrConversion,
5441 ) -> api::VkResult {
5445 #[allow(non_snake_case)]
5446 pub unsafe extern "system" fn vkDestroySamplerYcbcrConversion(
5447 _device: api::VkDevice,
5448 _ycbcrConversion: api::VkSamplerYcbcrConversion,
5449 _pAllocator: *const api::VkAllocationCallbacks,
5454 #[allow(non_snake_case)]
5455 pub unsafe extern "system" fn vkCreateDescriptorUpdateTemplate(
5456 _device: api::VkDevice,
5457 _pCreateInfo: *const api::VkDescriptorUpdateTemplateCreateInfo,
5458 _pAllocator: *const api::VkAllocationCallbacks,
5459 _pDescriptorUpdateTemplate: *mut api::VkDescriptorUpdateTemplate,
5460 ) -> api::VkResult {
5464 #[allow(non_snake_case)]
5465 pub unsafe extern "system" fn vkDestroyDescriptorUpdateTemplate(
5466 _device: api::VkDevice,
5467 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5468 _pAllocator: *const api::VkAllocationCallbacks,
5473 #[allow(non_snake_case)]
5474 pub unsafe extern "system" fn vkUpdateDescriptorSetWithTemplate(
5475 _device: api::VkDevice,
5476 _descriptorSet: api::VkDescriptorSet,
5477 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5478 _pData: *const c_void,
5483 #[allow(non_snake_case)]
5484 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalBufferProperties(
5485 _physicalDevice: api::VkPhysicalDevice,
5486 _pExternalBufferInfo: *const api::VkPhysicalDeviceExternalBufferInfo,
5487 _pExternalBufferProperties: *mut api::VkExternalBufferProperties,
5492 #[allow(non_snake_case)]
5493 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalFenceProperties(
5494 _physicalDevice: api::VkPhysicalDevice,
5495 _pExternalFenceInfo: *const api::VkPhysicalDeviceExternalFenceInfo,
5496 _pExternalFenceProperties: *mut api::VkExternalFenceProperties,
5501 #[allow(non_snake_case)]
5502 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalSemaphoreProperties(
5503 _physicalDevice: api::VkPhysicalDevice,
5504 _pExternalSemaphoreInfo: *const api::VkPhysicalDeviceExternalSemaphoreInfo,
5505 _pExternalSemaphoreProperties: *mut api::VkExternalSemaphoreProperties,
5510 #[allow(non_snake_case)]
5511 pub unsafe extern "system" fn vkGetDescriptorSetLayoutSupport(
5512 _device: api::VkDevice,
5513 _pCreateInfo: *const api::VkDescriptorSetLayoutCreateInfo,
5514 _pSupport: *mut api::VkDescriptorSetLayoutSupport,
5519 #[allow(non_snake_case)]
5520 pub unsafe extern "system" fn vkDestroySurfaceKHR(
5521 _instance: api::VkInstance,
5522 surface: api::VkSurfaceKHR,
5523 _allocator: *const api::VkAllocationCallbacks,
5525 if let Some(surface) = SharedHandle::from(surface) {
5526 let surface_implementation = SurfacePlatform::from(surface.platform)
5528 .get_surface_implementation();
5529 surface_implementation.destroy_surface(surface.into_nonnull());
5533 #[allow(non_snake_case)]
5534 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceSupportKHR(
5535 _physicalDevice: api::VkPhysicalDevice,
5536 _queueFamilyIndex: u32,
5537 _surface: api::VkSurfaceKHR,
5538 _pSupported: *mut api::VkBool32,
5539 ) -> api::VkResult {
5543 #[allow(non_snake_case)]
5544 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
5545 physical_device: api::VkPhysicalDevice,
5546 surface: api::VkSurfaceKHR,
5547 surface_capabilities: *mut api::VkSurfaceCapabilitiesKHR,
5548 ) -> api::VkResult {
5549 let mut surface_capabilities_2 = api::VkSurfaceCapabilities2KHR {
5550 sType: api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
5552 surfaceCapabilities: mem::zeroed(),
5554 match vkGetPhysicalDeviceSurfaceCapabilities2KHR(
5556 &api::VkPhysicalDeviceSurfaceInfo2KHR {
5557 sType: api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR,
5561 &mut surface_capabilities_2,
5563 api::VK_SUCCESS => {
5564 *surface_capabilities = surface_capabilities_2.surfaceCapabilities;
5571 #[allow(non_snake_case)]
5572 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceFormatsKHR(
5573 _physical_device: api::VkPhysicalDevice,
5574 surface: api::VkSurfaceKHR,
5575 surface_format_count: *mut u32,
5576 surface_formats: *mut api::VkSurfaceFormatKHR,
5577 ) -> api::VkResult {
5578 let surface_implementation =
5579 SurfacePlatform::from(SharedHandle::from(surface).unwrap().platform)
5581 .get_surface_implementation();
5582 let returned_surface_formats = match surface_implementation.get_surface_formats(surface) {
5583 Ok(returned_surface_formats) => returned_surface_formats,
5584 Err(result) => return result,
5587 surface_format_count,
5589 returned_surface_formats.iter(),
5594 #[allow(non_snake_case)]
5595 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfacePresentModesKHR(
5596 _physical_device: api::VkPhysicalDevice,
5597 surface: api::VkSurfaceKHR,
5598 present_mode_count: *mut u32,
5599 present_modes: *mut api::VkPresentModeKHR,
5600 ) -> api::VkResult {
5601 let surface_implementation =
5602 SurfacePlatform::from(SharedHandle::from(surface).unwrap().platform)
5604 .get_surface_implementation();
5605 let returned_present_modes = match surface_implementation.get_present_modes(surface) {
5606 Ok(returned_present_modes) => returned_present_modes,
5607 Err(result) => return result,
5612 returned_present_modes.iter(),
5617 #[allow(non_snake_case)]
5618 pub unsafe extern "system" fn vkCreateSwapchainKHR(
5619 device: api::VkDevice,
5620 create_info: *const api::VkSwapchainCreateInfoKHR,
5621 _allocator: *const api::VkAllocationCallbacks,
5622 swapchain: *mut api::VkSwapchainKHR,
5623 ) -> api::VkResult {
5624 parse_next_chain_const!{
5626 root = api::VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
5627 device_group_swapchain_create_info: api::VkDeviceGroupSwapchainCreateInfoKHR = api::VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR,
5629 let ref create_info = *create_info;
5630 let device_group_swapchain_create_info = if device_group_swapchain_create_info.is_null() {
5633 Some(&*device_group_swapchain_create_info)
5635 *swapchain = Handle::null();
5637 SurfacePlatform::from(SharedHandle::from(create_info.surface).unwrap().platform).unwrap();
5639 .get_surface_implementation()
5640 .build(create_info, device_group_swapchain_create_info)
5642 Ok(new_swapchain) => {
5643 *swapchain = OwnedHandle::<api::VkSwapchainKHR>::new(new_swapchain).take();
5646 Err(error) => error,
5650 #[allow(non_snake_case)]
5651 pub unsafe extern "system" fn vkDestroySwapchainKHR(
5652 _device: api::VkDevice,
5653 swapchain: api::VkSwapchainKHR,
5654 _allocator: *const api::VkAllocationCallbacks,
5656 OwnedHandle::from(swapchain);
5659 #[allow(non_snake_case)]
5660 pub unsafe extern "system" fn vkGetSwapchainImagesKHR(
5661 _device: api::VkDevice,
5662 _swapchain: api::VkSwapchainKHR,
5663 _pSwapchainImageCount: *mut u32,
5664 _pSwapchainImages: *mut api::VkImage,
5665 ) -> api::VkResult {
5669 #[allow(non_snake_case)]
5670 pub unsafe extern "system" fn vkAcquireNextImageKHR(
5671 _device: api::VkDevice,
5672 _swapchain: api::VkSwapchainKHR,
5674 _semaphore: api::VkSemaphore,
5675 _fence: api::VkFence,
5676 _pImageIndex: *mut u32,
5677 ) -> api::VkResult {
5681 #[allow(non_snake_case)]
5682 pub unsafe extern "system" fn vkQueuePresentKHR(
5683 _queue: api::VkQueue,
5684 _pPresentInfo: *const api::VkPresentInfoKHR,
5685 ) -> api::VkResult {
5689 #[allow(non_snake_case)]
5690 pub unsafe extern "system" fn vkGetDeviceGroupPresentCapabilitiesKHR(
5691 _device: api::VkDevice,
5692 _pDeviceGroupPresentCapabilities: *mut api::VkDeviceGroupPresentCapabilitiesKHR,
5693 ) -> api::VkResult {
5697 #[allow(non_snake_case)]
5698 pub unsafe extern "system" fn vkGetDeviceGroupSurfacePresentModesKHR(
5699 _device: api::VkDevice,
5700 _surface: api::VkSurfaceKHR,
5701 _pModes: *mut api::VkDeviceGroupPresentModeFlagsKHR,
5702 ) -> api::VkResult {
5706 #[allow(non_snake_case)]
5707 pub unsafe extern "system" fn vkGetPhysicalDevicePresentRectanglesKHR(
5708 _physicalDevice: api::VkPhysicalDevice,
5709 _surface: api::VkSurfaceKHR,
5710 _pRectCount: *mut u32,
5711 _pRects: *mut api::VkRect2D,
5712 ) -> api::VkResult {
5716 #[allow(non_snake_case)]
5717 pub unsafe extern "system" fn vkAcquireNextImage2KHR(
5718 _device: api::VkDevice,
5719 _pAcquireInfo: *const api::VkAcquireNextImageInfoKHR,
5720 _pImageIndex: *mut u32,
5721 ) -> api::VkResult {
5725 #[allow(non_snake_case)]
5726 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPropertiesKHR(
5727 _physicalDevice: api::VkPhysicalDevice,
5728 _pPropertyCount: *mut u32,
5729 _pProperties: *mut api::VkDisplayPropertiesKHR,
5730 ) -> api::VkResult {
5734 #[allow(non_snake_case)]
5735 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
5736 _physicalDevice: api::VkPhysicalDevice,
5737 _pPropertyCount: *mut u32,
5738 _pProperties: *mut api::VkDisplayPlanePropertiesKHR,
5739 ) -> api::VkResult {
5743 #[allow(non_snake_case)]
5744 pub unsafe extern "system" fn vkGetDisplayPlaneSupportedDisplaysKHR(
5745 _physicalDevice: api::VkPhysicalDevice,
5747 _pDisplayCount: *mut u32,
5748 _pDisplays: *mut api::VkDisplayKHR,
5749 ) -> api::VkResult {
5753 #[allow(non_snake_case)]
5754 pub unsafe extern "system" fn vkGetDisplayModePropertiesKHR(
5755 _physicalDevice: api::VkPhysicalDevice,
5756 _display: api::VkDisplayKHR,
5757 _pPropertyCount: *mut u32,
5758 _pProperties: *mut api::VkDisplayModePropertiesKHR,
5759 ) -> api::VkResult {
5763 #[allow(non_snake_case)]
5764 pub unsafe extern "system" fn vkCreateDisplayModeKHR(
5765 _physicalDevice: api::VkPhysicalDevice,
5766 _display: api::VkDisplayKHR,
5767 _pCreateInfo: *const api::VkDisplayModeCreateInfoKHR,
5768 _pAllocator: *const api::VkAllocationCallbacks,
5769 _pMode: *mut api::VkDisplayModeKHR,
5770 ) -> api::VkResult {
5774 #[allow(non_snake_case)]
5775 pub unsafe extern "system" fn vkGetDisplayPlaneCapabilitiesKHR(
5776 _physicalDevice: api::VkPhysicalDevice,
5777 _mode: api::VkDisplayModeKHR,
5779 _pCapabilities: *mut api::VkDisplayPlaneCapabilitiesKHR,
5780 ) -> api::VkResult {
5784 #[allow(non_snake_case)]
5785 pub unsafe extern "system" fn vkCreateDisplayPlaneSurfaceKHR(
5786 _instance: api::VkInstance,
5787 _pCreateInfo: *const api::VkDisplaySurfaceCreateInfoKHR,
5788 _pAllocator: *const api::VkAllocationCallbacks,
5789 _pSurface: *mut api::VkSurfaceKHR,
5790 ) -> api::VkResult {
5794 #[allow(non_snake_case)]
5795 pub unsafe extern "system" fn vkCreateSharedSwapchainsKHR(
5796 _device: api::VkDevice,
5797 _swapchainCount: u32,
5798 _pCreateInfos: *const api::VkSwapchainCreateInfoKHR,
5799 _pAllocator: *const api::VkAllocationCallbacks,
5800 _pSwapchains: *mut api::VkSwapchainKHR,
5801 ) -> api::VkResult {
5805 #[allow(non_snake_case)]
5806 pub unsafe extern "system" fn vkGetMemoryFdKHR(
5807 _device: api::VkDevice,
5808 _pGetFdInfo: *const api::VkMemoryGetFdInfoKHR,
5810 ) -> api::VkResult {
5814 #[allow(non_snake_case)]
5815 pub unsafe extern "system" fn vkGetMemoryFdPropertiesKHR(
5816 _device: api::VkDevice,
5817 _handleType: api::VkExternalMemoryHandleTypeFlagBits,
5819 _pMemoryFdProperties: *mut api::VkMemoryFdPropertiesKHR,
5820 ) -> api::VkResult {
5824 #[allow(non_snake_case)]
5825 pub unsafe extern "system" fn vkImportSemaphoreFdKHR(
5826 _device: api::VkDevice,
5827 _pImportSemaphoreFdInfo: *const api::VkImportSemaphoreFdInfoKHR,
5828 ) -> api::VkResult {
5832 #[allow(non_snake_case)]
5833 pub unsafe extern "system" fn vkGetSemaphoreFdKHR(
5834 _device: api::VkDevice,
5835 _pGetFdInfo: *const api::VkSemaphoreGetFdInfoKHR,
5837 ) -> api::VkResult {
5841 #[allow(non_snake_case)]
5842 pub unsafe extern "system" fn vkCmdPushDescriptorSetKHR(
5843 _commandBuffer: api::VkCommandBuffer,
5844 _pipelineBindPoint: api::VkPipelineBindPoint,
5845 _layout: api::VkPipelineLayout,
5847 _descriptorWriteCount: u32,
5848 _pDescriptorWrites: *const api::VkWriteDescriptorSet,
5853 #[allow(non_snake_case)]
5854 pub unsafe extern "system" fn vkCmdPushDescriptorSetWithTemplateKHR(
5855 _commandBuffer: api::VkCommandBuffer,
5856 _descriptorUpdateTemplate: api::VkDescriptorUpdateTemplate,
5857 _layout: api::VkPipelineLayout,
5859 _pData: *const c_void,
5864 #[allow(non_snake_case)]
5865 pub unsafe extern "system" fn vkCreateRenderPass2KHR(
5866 _device: api::VkDevice,
5867 _pCreateInfo: *const api::VkRenderPassCreateInfo2KHR,
5868 _pAllocator: *const api::VkAllocationCallbacks,
5869 _pRenderPass: *mut api::VkRenderPass,
5870 ) -> api::VkResult {
5874 #[allow(non_snake_case)]
5875 pub unsafe extern "system" fn vkCmdBeginRenderPass2KHR(
5876 _commandBuffer: api::VkCommandBuffer,
5877 _pRenderPassBegin: *const api::VkRenderPassBeginInfo,
5878 _pSubpassBeginInfo: *const api::VkSubpassBeginInfoKHR,
5883 #[allow(non_snake_case)]
5884 pub unsafe extern "system" fn vkCmdNextSubpass2KHR(
5885 _commandBuffer: api::VkCommandBuffer,
5886 _pSubpassBeginInfo: *const api::VkSubpassBeginInfoKHR,
5887 _pSubpassEndInfo: *const api::VkSubpassEndInfoKHR,
5892 #[allow(non_snake_case)]
5893 pub unsafe extern "system" fn vkCmdEndRenderPass2KHR(
5894 _commandBuffer: api::VkCommandBuffer,
5895 _pSubpassEndInfo: *const api::VkSubpassEndInfoKHR,
5900 #[allow(non_snake_case)]
5901 pub unsafe extern "system" fn vkGetSwapchainStatusKHR(
5902 _device: api::VkDevice,
5903 _swapchain: api::VkSwapchainKHR,
5904 ) -> api::VkResult {
5908 #[allow(non_snake_case)]
5909 pub unsafe extern "system" fn vkImportFenceFdKHR(
5910 _device: api::VkDevice,
5911 _pImportFenceFdInfo: *const api::VkImportFenceFdInfoKHR,
5912 ) -> api::VkResult {
5916 #[allow(non_snake_case)]
5917 pub unsafe extern "system" fn vkGetFenceFdKHR(
5918 _device: api::VkDevice,
5919 _pGetFdInfo: *const api::VkFenceGetFdInfoKHR,
5921 ) -> api::VkResult {
5925 #[allow(non_snake_case)]
5926 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilities2KHR(
5927 _physical_device: api::VkPhysicalDevice,
5928 surface_info: *const api::VkPhysicalDeviceSurfaceInfo2KHR,
5929 surface_capabilities: *mut api::VkSurfaceCapabilities2KHR,
5930 ) -> api::VkResult {
5931 parse_next_chain_const!{
5933 root = api::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR,
5935 let ref surface_info = *surface_info;
5936 parse_next_chain_mut!{
5937 surface_capabilities,
5938 root = api::VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
5940 let ref mut surface_capabilities = *surface_capabilities;
5941 let surface_implementation =
5942 SurfacePlatform::from(SharedHandle::from(surface_info.surface).unwrap().platform)
5944 .get_surface_implementation();
5945 match surface_implementation.get_capabilities(surface_info.surface) {
5946 Ok(capabilities) => {
5947 surface_capabilities.surfaceCapabilities = capabilities;
5950 Err(result) => result,
5954 #[allow(non_snake_case)]
5955 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceFormats2KHR(
5956 _physicalDevice: api::VkPhysicalDevice,
5957 _pSurfaceInfo: *const api::VkPhysicalDeviceSurfaceInfo2KHR,
5958 _pSurfaceFormatCount: *mut u32,
5959 _pSurfaceFormats: *mut api::VkSurfaceFormat2KHR,
5960 ) -> api::VkResult {
5964 #[allow(non_snake_case)]
5965 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayProperties2KHR(
5966 _physicalDevice: api::VkPhysicalDevice,
5967 _pPropertyCount: *mut u32,
5968 _pProperties: *mut api::VkDisplayProperties2KHR,
5969 ) -> api::VkResult {
5973 #[allow(non_snake_case)]
5974 pub unsafe extern "system" fn vkGetPhysicalDeviceDisplayPlaneProperties2KHR(
5975 _physicalDevice: api::VkPhysicalDevice,
5976 _pPropertyCount: *mut u32,
5977 _pProperties: *mut api::VkDisplayPlaneProperties2KHR,
5978 ) -> api::VkResult {
5982 #[allow(non_snake_case)]
5983 pub unsafe extern "system" fn vkGetDisplayModeProperties2KHR(
5984 _physicalDevice: api::VkPhysicalDevice,
5985 _display: api::VkDisplayKHR,
5986 _pPropertyCount: *mut u32,
5987 _pProperties: *mut api::VkDisplayModeProperties2KHR,
5988 ) -> api::VkResult {
5992 #[allow(non_snake_case)]
5993 pub unsafe extern "system" fn vkGetDisplayPlaneCapabilities2KHR(
5994 _physicalDevice: api::VkPhysicalDevice,
5995 _pDisplayPlaneInfo: *const api::VkDisplayPlaneInfo2KHR,
5996 _pCapabilities: *mut api::VkDisplayPlaneCapabilities2KHR,
5997 ) -> api::VkResult {
6001 #[allow(non_snake_case)]
6002 pub unsafe extern "system" fn vkCmdDrawIndirectCountKHR(
6003 _commandBuffer: api::VkCommandBuffer,
6004 _buffer: api::VkBuffer,
6005 _offset: api::VkDeviceSize,
6006 _countBuffer: api::VkBuffer,
6007 _countBufferOffset: api::VkDeviceSize,
6014 #[allow(non_snake_case)]
6015 pub unsafe extern "system" fn vkCmdDrawIndexedIndirectCountKHR(
6016 _commandBuffer: api::VkCommandBuffer,
6017 _buffer: api::VkBuffer,
6018 _offset: api::VkDeviceSize,
6019 _countBuffer: api::VkBuffer,
6020 _countBufferOffset: api::VkDeviceSize,
6027 #[allow(non_snake_case)]
6028 pub unsafe extern "system" fn vkCreateDebugReportCallbackEXT(
6029 _instance: api::VkInstance,
6030 _pCreateInfo: *const api::VkDebugReportCallbackCreateInfoEXT,
6031 _pAllocator: *const api::VkAllocationCallbacks,
6032 _pCallback: *mut api::VkDebugReportCallbackEXT,
6033 ) -> api::VkResult {
6037 #[allow(non_snake_case)]
6038 pub unsafe extern "system" fn vkDestroyDebugReportCallbackEXT(
6039 _instance: api::VkInstance,
6040 _callback: api::VkDebugReportCallbackEXT,
6041 _pAllocator: *const api::VkAllocationCallbacks,
6046 #[allow(non_snake_case)]
6047 pub unsafe extern "system" fn vkDebugReportMessageEXT(
6048 _instance: api::VkInstance,
6049 _flags: api::VkDebugReportFlagsEXT,
6050 _objectType: api::VkDebugReportObjectTypeEXT,
6054 _pLayerPrefix: *const c_char,
6055 _pMessage: *const c_char,
6060 #[allow(non_snake_case)]
6061 pub unsafe extern "system" fn vkDebugMarkerSetObjectTagEXT(
6062 _device: api::VkDevice,
6063 _pTagInfo: *const api::VkDebugMarkerObjectTagInfoEXT,
6064 ) -> api::VkResult {
6068 #[allow(non_snake_case)]
6069 pub unsafe extern "system" fn vkDebugMarkerSetObjectNameEXT(
6070 _device: api::VkDevice,
6071 _pNameInfo: *const api::VkDebugMarkerObjectNameInfoEXT,
6072 ) -> api::VkResult {
6076 #[allow(non_snake_case)]
6077 pub unsafe extern "system" fn vkCmdDebugMarkerBeginEXT(
6078 _commandBuffer: api::VkCommandBuffer,
6079 _pMarkerInfo: *const api::VkDebugMarkerMarkerInfoEXT,
6084 #[allow(non_snake_case)]
6085 pub unsafe extern "system" fn vkCmdDebugMarkerEndEXT(_commandBuffer: api::VkCommandBuffer) {
6089 #[allow(non_snake_case)]
6090 pub unsafe extern "system" fn vkCmdDebugMarkerInsertEXT(
6091 _commandBuffer: api::VkCommandBuffer,
6092 _pMarkerInfo: *const api::VkDebugMarkerMarkerInfoEXT,
6097 #[allow(non_snake_case)]
6098 pub unsafe extern "system" fn vkCmdDrawIndirectCountAMD(
6099 _commandBuffer: api::VkCommandBuffer,
6100 _buffer: api::VkBuffer,
6101 _offset: api::VkDeviceSize,
6102 _countBuffer: api::VkBuffer,
6103 _countBufferOffset: api::VkDeviceSize,
6110 #[allow(non_snake_case)]
6111 pub unsafe extern "system" fn vkCmdDrawIndexedIndirectCountAMD(
6112 _commandBuffer: api::VkCommandBuffer,
6113 _buffer: api::VkBuffer,
6114 _offset: api::VkDeviceSize,
6115 _countBuffer: api::VkBuffer,
6116 _countBufferOffset: api::VkDeviceSize,
6123 #[allow(non_snake_case)]
6124 pub unsafe extern "system" fn vkGetShaderInfoAMD(
6125 _device: api::VkDevice,
6126 _pipeline: api::VkPipeline,
6127 _shaderStage: api::VkShaderStageFlagBits,
6128 _infoType: api::VkShaderInfoTypeAMD,
6129 _pInfoSize: *mut usize,
6130 _pInfo: *mut c_void,
6131 ) -> api::VkResult {
6135 #[allow(non_snake_case)]
6136 pub unsafe extern "system" fn vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
6137 _physicalDevice: api::VkPhysicalDevice,
6138 _format: api::VkFormat,
6139 _type_: api::VkImageType,
6140 _tiling: api::VkImageTiling,
6141 _usage: api::VkImageUsageFlags,
6142 _flags: api::VkImageCreateFlags,
6143 _externalHandleType: api::VkExternalMemoryHandleTypeFlagsNV,
6144 _pExternalImageFormatProperties: *mut api::VkExternalImageFormatPropertiesNV,
6145 ) -> api::VkResult {
6149 #[allow(non_snake_case)]
6150 pub unsafe extern "system" fn vkCmdBeginConditionalRenderingEXT(
6151 _commandBuffer: api::VkCommandBuffer,
6152 _pConditionalRenderingBegin: *const api::VkConditionalRenderingBeginInfoEXT,
6157 #[allow(non_snake_case)]
6158 pub unsafe extern "system" fn vkCmdEndConditionalRenderingEXT(
6159 _commandBuffer: api::VkCommandBuffer,
6164 #[allow(non_snake_case)]
6165 pub unsafe extern "system" fn vkCmdSetViewportWScalingNV(
6166 _commandBuffer: api::VkCommandBuffer,
6167 _firstViewport: u32,
6168 _viewportCount: u32,
6169 _pViewportWScalings: *const api::VkViewportWScalingNV,
6174 #[allow(non_snake_case)]
6175 pub unsafe extern "system" fn vkReleaseDisplayEXT(
6176 _physicalDevice: api::VkPhysicalDevice,
6177 _display: api::VkDisplayKHR,
6178 ) -> api::VkResult {
6182 #[allow(non_snake_case)]
6183 pub unsafe extern "system" fn vkGetPhysicalDeviceSurfaceCapabilities2EXT(
6184 _physicalDevice: api::VkPhysicalDevice,
6185 _surface: api::VkSurfaceKHR,
6186 _pSurfaceCapabilities: *mut api::VkSurfaceCapabilities2EXT,
6187 ) -> api::VkResult {
6191 #[allow(non_snake_case)]
6192 pub unsafe extern "system" fn vkDisplayPowerControlEXT(
6193 _device: api::VkDevice,
6194 _display: api::VkDisplayKHR,
6195 _pDisplayPowerInfo: *const api::VkDisplayPowerInfoEXT,
6196 ) -> api::VkResult {
6200 #[allow(non_snake_case)]
6201 pub unsafe extern "system" fn vkRegisterDeviceEventEXT(
6202 _device: api::VkDevice,
6203 _pDeviceEventInfo: *const api::VkDeviceEventInfoEXT,
6204 _pAllocator: *const api::VkAllocationCallbacks,
6205 _pFence: *mut api::VkFence,
6206 ) -> api::VkResult {
6210 #[allow(non_snake_case)]
6211 pub unsafe extern "system" fn vkRegisterDisplayEventEXT(
6212 _device: api::VkDevice,
6213 _display: api::VkDisplayKHR,
6214 _pDisplayEventInfo: *const api::VkDisplayEventInfoEXT,
6215 _pAllocator: *const api::VkAllocationCallbacks,
6216 _pFence: *mut api::VkFence,
6217 ) -> api::VkResult {
6221 #[allow(non_snake_case)]
6222 pub unsafe extern "system" fn vkGetSwapchainCounterEXT(
6223 _device: api::VkDevice,
6224 _swapchain: api::VkSwapchainKHR,
6225 _counter: api::VkSurfaceCounterFlagBitsEXT,
6226 _pCounterValue: *mut u64,
6227 ) -> api::VkResult {
6231 #[allow(non_snake_case)]
6232 pub unsafe extern "system" fn vkGetRefreshCycleDurationGOOGLE(
6233 _device: api::VkDevice,
6234 _swapchain: api::VkSwapchainKHR,
6235 _pDisplayTimingProperties: *mut api::VkRefreshCycleDurationGOOGLE,
6236 ) -> api::VkResult {
6240 #[allow(non_snake_case)]
6241 pub unsafe extern "system" fn vkGetPastPresentationTimingGOOGLE(
6242 _device: api::VkDevice,
6243 _swapchain: api::VkSwapchainKHR,
6244 _pPresentationTimingCount: *mut u32,
6245 _pPresentationTimings: *mut api::VkPastPresentationTimingGOOGLE,
6246 ) -> api::VkResult {
6250 #[allow(non_snake_case)]
6251 pub unsafe extern "system" fn vkCmdSetDiscardRectangleEXT(
6252 _commandBuffer: api::VkCommandBuffer,
6253 _firstDiscardRectangle: u32,
6254 _discardRectangleCount: u32,
6255 _pDiscardRectangles: *const api::VkRect2D,
6260 #[allow(non_snake_case)]
6261 pub unsafe extern "system" fn vkSetHdrMetadataEXT(
6262 _device: api::VkDevice,
6263 _swapchainCount: u32,
6264 _pSwapchains: *const api::VkSwapchainKHR,
6265 _pMetadata: *const api::VkHdrMetadataEXT,
6270 #[allow(non_snake_case)]
6271 pub unsafe extern "system" fn vkSetDebugUtilsObjectNameEXT(
6272 _device: api::VkDevice,
6273 _pNameInfo: *const api::VkDebugUtilsObjectNameInfoEXT,
6274 ) -> api::VkResult {
6278 #[allow(non_snake_case)]
6279 pub unsafe extern "system" fn vkSetDebugUtilsObjectTagEXT(
6280 _device: api::VkDevice,
6281 _pTagInfo: *const api::VkDebugUtilsObjectTagInfoEXT,
6282 ) -> api::VkResult {
6286 #[allow(non_snake_case)]
6287 pub unsafe extern "system" fn vkQueueBeginDebugUtilsLabelEXT(
6288 _queue: api::VkQueue,
6289 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6294 #[allow(non_snake_case)]
6295 pub unsafe extern "system" fn vkQueueEndDebugUtilsLabelEXT(_queue: api::VkQueue) {
6299 #[allow(non_snake_case)]
6300 pub unsafe extern "system" fn vkQueueInsertDebugUtilsLabelEXT(
6301 _queue: api::VkQueue,
6302 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6307 #[allow(non_snake_case)]
6308 pub unsafe extern "system" fn vkCmdBeginDebugUtilsLabelEXT(
6309 _commandBuffer: api::VkCommandBuffer,
6310 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6315 #[allow(non_snake_case)]
6316 pub unsafe extern "system" fn vkCmdEndDebugUtilsLabelEXT(_commandBuffer: api::VkCommandBuffer) {
6320 #[allow(non_snake_case)]
6321 pub unsafe extern "system" fn vkCmdInsertDebugUtilsLabelEXT(
6322 _commandBuffer: api::VkCommandBuffer,
6323 _pLabelInfo: *const api::VkDebugUtilsLabelEXT,
6328 #[allow(non_snake_case)]
6329 pub unsafe extern "system" fn vkCreateDebugUtilsMessengerEXT(
6330 _instance: api::VkInstance,
6331 _pCreateInfo: *const api::VkDebugUtilsMessengerCreateInfoEXT,
6332 _pAllocator: *const api::VkAllocationCallbacks,
6333 _pMessenger: *mut api::VkDebugUtilsMessengerEXT,
6334 ) -> api::VkResult {
6338 #[allow(non_snake_case)]
6339 pub unsafe extern "system" fn vkDestroyDebugUtilsMessengerEXT(
6340 _instance: api::VkInstance,
6341 _messenger: api::VkDebugUtilsMessengerEXT,
6342 _pAllocator: *const api::VkAllocationCallbacks,
6347 #[allow(non_snake_case)]
6348 pub unsafe extern "system" fn vkSubmitDebugUtilsMessageEXT(
6349 _instance: api::VkInstance,
6350 _messageSeverity: api::VkDebugUtilsMessageSeverityFlagBitsEXT,
6351 _messageTypes: api::VkDebugUtilsMessageTypeFlagsEXT,
6352 _pCallbackData: *const api::VkDebugUtilsMessengerCallbackDataEXT,
6357 #[allow(non_snake_case)]
6358 pub unsafe extern "system" fn vkCmdSetSampleLocationsEXT(
6359 _commandBuffer: api::VkCommandBuffer,
6360 _pSampleLocationsInfo: *const api::VkSampleLocationsInfoEXT,
6365 #[allow(non_snake_case)]
6366 pub unsafe extern "system" fn vkGetPhysicalDeviceMultisamplePropertiesEXT(
6367 _physicalDevice: api::VkPhysicalDevice,
6368 _samples: api::VkSampleCountFlagBits,
6369 _pMultisampleProperties: *mut api::VkMultisamplePropertiesEXT,
6374 #[allow(non_snake_case)]
6375 pub unsafe extern "system" fn vkCreateValidationCacheEXT(
6376 _device: api::VkDevice,
6377 _pCreateInfo: *const api::VkValidationCacheCreateInfoEXT,
6378 _pAllocator: *const api::VkAllocationCallbacks,
6379 _pValidationCache: *mut api::VkValidationCacheEXT,
6380 ) -> api::VkResult {
6384 #[allow(non_snake_case)]
6385 pub unsafe extern "system" fn vkDestroyValidationCacheEXT(
6386 _device: api::VkDevice,
6387 _validationCache: api::VkValidationCacheEXT,
6388 _pAllocator: *const api::VkAllocationCallbacks,
6393 #[allow(non_snake_case)]
6394 pub unsafe extern "system" fn vkMergeValidationCachesEXT(
6395 _device: api::VkDevice,
6396 _dstCache: api::VkValidationCacheEXT,
6397 _srcCacheCount: u32,
6398 _pSrcCaches: *const api::VkValidationCacheEXT,
6399 ) -> api::VkResult {
6403 #[allow(non_snake_case)]
6404 pub unsafe extern "system" fn vkGetValidationCacheDataEXT(
6405 _device: api::VkDevice,
6406 _validationCache: api::VkValidationCacheEXT,
6407 _pDataSize: *mut usize,
6408 _pData: *mut c_void,
6409 ) -> api::VkResult {
6413 #[allow(non_snake_case)]
6414 pub unsafe extern "system" fn vkCmdBindShadingRateImageNV(
6415 _commandBuffer: api::VkCommandBuffer,
6416 _imageView: api::VkImageView,
6417 _imageLayout: api::VkImageLayout,
6422 #[allow(non_snake_case)]
6423 pub unsafe extern "system" fn vkCmdSetViewportShadingRatePaletteNV(
6424 _commandBuffer: api::VkCommandBuffer,
6425 _firstViewport: u32,
6426 _viewportCount: u32,
6427 _pShadingRatePalettes: *const api::VkShadingRatePaletteNV,
6432 #[allow(non_snake_case)]
6433 pub unsafe extern "system" fn vkCmdSetCoarseSampleOrderNV(
6434 _commandBuffer: api::VkCommandBuffer,
6435 _sampleOrderType: api::VkCoarseSampleOrderTypeNV,
6436 _customSampleOrderCount: u32,
6437 _pCustomSampleOrders: *const api::VkCoarseSampleOrderCustomNV,
6442 #[allow(non_snake_case)]
6443 pub unsafe extern "system" fn vkGetMemoryHostPointerPropertiesEXT(
6444 _device: api::VkDevice,
6445 _handleType: api::VkExternalMemoryHandleTypeFlagBits,
6446 _pHostPointer: *const c_void,
6447 _pMemoryHostPointerProperties: *mut api::VkMemoryHostPointerPropertiesEXT,
6448 ) -> api::VkResult {
6452 #[allow(non_snake_case)]
6453 pub unsafe extern "system" fn vkCmdWriteBufferMarkerAMD(
6454 _commandBuffer: api::VkCommandBuffer,
6455 _pipelineStage: api::VkPipelineStageFlagBits,
6456 _dstBuffer: api::VkBuffer,
6457 _dstOffset: api::VkDeviceSize,
6463 #[allow(non_snake_case)]
6464 pub unsafe extern "system" fn vkCmdDrawMeshTasksNV(
6465 _commandBuffer: api::VkCommandBuffer,
6472 #[allow(non_snake_case)]
6473 pub unsafe extern "system" fn vkCmdDrawMeshTasksIndirectNV(
6474 _commandBuffer: api::VkCommandBuffer,
6475 _buffer: api::VkBuffer,
6476 _offset: api::VkDeviceSize,
6483 #[allow(non_snake_case)]
6484 pub unsafe extern "system" fn vkCmdDrawMeshTasksIndirectCountNV(
6485 _commandBuffer: api::VkCommandBuffer,
6486 _buffer: api::VkBuffer,
6487 _offset: api::VkDeviceSize,
6488 _countBuffer: api::VkBuffer,
6489 _countBufferOffset: api::VkDeviceSize,
6496 #[allow(non_snake_case)]
6497 pub unsafe extern "system" fn vkCmdSetExclusiveScissorNV(
6498 _commandBuffer: api::VkCommandBuffer,
6499 _firstExclusiveScissor: u32,
6500 _exclusiveScissorCount: u32,
6501 _pExclusiveScissors: *const api::VkRect2D,
6506 #[allow(non_snake_case)]
6507 pub unsafe extern "system" fn vkCmdSetCheckpointNV(
6508 _commandBuffer: api::VkCommandBuffer,
6509 _pCheckpointMarker: *const c_void,
6514 #[allow(non_snake_case)]
6515 pub unsafe extern "system" fn vkGetQueueCheckpointDataNV(
6516 _queue: api::VkQueue,
6517 _pCheckpointDataCount: *mut u32,
6518 _pCheckpointData: *mut api::VkCheckpointDataNV,
6524 #[allow(non_snake_case)]
6525 pub unsafe extern "system" fn vkCreateXcbSurfaceKHR(
6526 _instance: api::VkInstance,
6527 create_info: *const api::VkXcbSurfaceCreateInfoKHR,
6528 _allocator: *const api::VkAllocationCallbacks,
6529 surface: *mut api::VkSurfaceKHR,
6530 ) -> api::VkResult {
6531 parse_next_chain_const!{
6533 root = api::VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR,
6535 let ref create_info = *create_info;
6536 let new_surface = Box::new(api::VkIcdSurfaceXcb {
6537 base: api::VkIcdSurfaceBase {
6538 platform: api::VK_ICD_WSI_PLATFORM_XCB,
6540 connection: create_info.connection,
6541 window: create_info.window,
6543 *surface = api::VkSurfaceKHR::new(NonNull::new(
6544 Box::into_raw(new_surface) as *mut api::VkIcdSurfaceBase
6550 #[allow(non_snake_case)]
6551 pub unsafe extern "system" fn vkGetPhysicalDeviceXcbPresentationSupportKHR(
6552 _physicalDevice: api::VkPhysicalDevice,
6553 _queueFamilyIndex: u32,
6554 _connection: *mut xcb::ffi::xcb_connection_t,
6555 _visual_id: xcb::ffi::xcb_visualid_t,
6556 ) -> api::VkBool32 {