1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 // Copyright 2018 Jacob Lifshay
3 #![cfg_attr(feature = "cargo-clippy", allow(clippy::new_ret_no_self))]
6 #[cfg(target_os = "linux")]
8 #[cfg(target_os = "linux")]
10 extern crate shader_compiler_backend;
11 extern crate sys_info;
13 #[cfg(target_os = "linux")]
25 #[cfg(target_os = "linux")]
28 #[cfg(target_os = "linux")]
31 use std::os::raw::c_char;
34 pub const KAZAN_DEVICE_NAME: &str = "Kazan Software Renderer";
35 pub const MIN_MEMORY_MAP_ALIGNMENT: usize = 128; // must be at least 64 and a power of 2 according to Vulkan spec
36 pub const QUEUE_FAMILY_COUNT: u32 = 1;
37 pub const QUEUE_COUNTS: [u32; QUEUE_FAMILY_COUNT as usize] = [1];
38 pub const TOTAL_QUEUE_COUNT: usize = 1;
39 pub const BUFFER_ALIGNMENT: usize = 64; // FIXME: determine correct value
40 pub const IMAGE_ALIGNMENT: usize = 64; // FIXME: determine correct value
44 pub unsafe extern "system" fn vk_icdGetInstanceProcAddr(
45 instance: api::VkInstance,
47 ) -> api::PFN_vkVoidFunction {
48 api_impl::vkGetInstanceProcAddr(instance, name)
51 // note that if the following fails, then you may be encountering bindgen issue #1402
52 // https://github.com/rust-lang-nursery/rust-bindgen/issues/1402
54 const ASSERT_TYPE_VK_ICD_GET_INSTANCE_PROC_ADDR: api::PFN_vkGetInstanceProcAddr =
55 Some(vk_icdGetInstanceProcAddr);
57 const ICD_VERSION: u32 = 5;
60 pub unsafe extern "system" fn vk_icdNegotiateLoaderICDInterfaceVersion(
61 supported_version: *mut u32,
63 if *supported_version > ICD_VERSION {
64 *supported_version = ICD_VERSION;
70 const ASSERT_TYPE_VK_ICD_NEGOTIATE_LOADER_ICD_INTERFACE_VERSION:
71 api::PFN_vkNegotiateLoaderICDInterfaceVersion = Some(vk_icdNegotiateLoaderICDInterfaceVersion);
74 pub unsafe extern "system" fn vk_icdGetPhysicalDeviceProcAddr(
75 instance: api::VkInstance,
77 ) -> api::PFN_vkVoidFunction {
78 match CStr::from_ptr(name).to_str().ok()? {
80 | "vkCreateDisplayModeKHR"
81 | "vkEnumerateDeviceExtensionProperties"
82 | "vkEnumerateDeviceLayerProperties"
83 | "vkGetDisplayModeProperties2KHR"
84 | "vkGetDisplayModePropertiesKHR"
85 | "vkGetDisplayPlaneCapabilities2KHR"
86 | "vkGetDisplayPlaneCapabilitiesKHR"
87 | "vkGetDisplayPlaneSupportedDisplaysKHR"
88 | "vkGetPhysicalDeviceDisplayPlaneProperties2KHR"
89 | "vkGetPhysicalDeviceDisplayPlanePropertiesKHR"
90 | "vkGetPhysicalDeviceDisplayProperties2KHR"
91 | "vkGetPhysicalDeviceDisplayPropertiesKHR"
92 | "vkGetPhysicalDeviceExternalBufferProperties"
93 | "vkGetPhysicalDeviceExternalBufferPropertiesKHR"
94 | "vkGetPhysicalDeviceExternalFenceProperties"
95 | "vkGetPhysicalDeviceExternalFencePropertiesKHR"
96 | "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"
97 | "vkGetPhysicalDeviceExternalSemaphoreProperties"
98 | "vkGetPhysicalDeviceExternalSemaphorePropertiesKHR"
99 | "vkGetPhysicalDeviceFeatures"
100 | "vkGetPhysicalDeviceFeatures2"
101 | "vkGetPhysicalDeviceFeatures2KHR"
102 | "vkGetPhysicalDeviceFormatProperties"
103 | "vkGetPhysicalDeviceFormatProperties2"
104 | "vkGetPhysicalDeviceFormatProperties2KHR"
105 | "vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX"
106 | "vkGetPhysicalDeviceImageFormatProperties"
107 | "vkGetPhysicalDeviceImageFormatProperties2"
108 | "vkGetPhysicalDeviceImageFormatProperties2KHR"
109 | "vkGetPhysicalDeviceMemoryProperties"
110 | "vkGetPhysicalDeviceMemoryProperties2"
111 | "vkGetPhysicalDeviceMemoryProperties2KHR"
112 | "vkGetPhysicalDeviceMultisamplePropertiesEXT"
113 | "vkGetPhysicalDevicePresentRectanglesKHR"
114 | "vkGetPhysicalDeviceProperties"
115 | "vkGetPhysicalDeviceProperties2"
116 | "vkGetPhysicalDeviceProperties2KHR"
117 | "vkGetPhysicalDeviceQueueFamilyProperties"
118 | "vkGetPhysicalDeviceQueueFamilyProperties2"
119 | "vkGetPhysicalDeviceQueueFamilyProperties2KHR"
120 | "vkGetPhysicalDeviceSparseImageFormatProperties"
121 | "vkGetPhysicalDeviceSparseImageFormatProperties2"
122 | "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"
123 | "vkGetPhysicalDeviceSurfaceCapabilities2EXT"
124 | "vkGetPhysicalDeviceSurfaceCapabilities2KHR"
125 | "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"
126 | "vkGetPhysicalDeviceSurfaceFormats2KHR"
127 | "vkGetPhysicalDeviceSurfaceFormatsKHR"
128 | "vkGetPhysicalDeviceSurfacePresentModesKHR"
129 | "vkGetPhysicalDeviceSurfaceSupportKHR"
130 | "vkGetPhysicalDeviceXcbPresentationSupportKHR"
131 | "vkReleaseDisplayEXT" => vk_icdGetInstanceProcAddr(instance, name),
137 const ASSERT_TYPE_VK_ICD_GET_PHYSICAL_DEVICE_PROC_ADDR: api::PFN_GetPhysicalDeviceProcAddr =
138 Some(vk_icdGetInstanceProcAddr);