@@ -57,7 +57,10 @@ namespace ZEngine::Hardwares
5757
5858 VkInstanceCreateInfo instance_create_info = {.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = VK_NULL_HANDLE, .flags = 0 , .pApplicationInfo = &app_info};
5959
60- auto scratch = ZGetScratch (Arena);
60+ #ifdef __APPLE__
61+ instance_create_info.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
62+ #endif
63+ auto scratch = ZGetScratch (Arena);
6164
6265 Array<const char *> enabled_layer_name_collection;
6366 Array<LayerProperty> selected_layer_property_collection;
@@ -71,7 +74,9 @@ namespace ZEngine::Hardwares
7174 validation_layer_name_collection.push (" VK_LAYER_LUNARG_api_dump" );
7275 validation_layer_name_collection.push (" VK_LAYER_KHRONOS_validation" );
7376 validation_layer_name_collection.push (" VK_LAYER_LUNARG_monitor" );
77+ #ifndef __APPLE__
7478 validation_layer_name_collection.push (" VK_LAYER_LUNARG_screenshot" );
79+ #endif
7580
7681 for (const char * layer_name : validation_layer_name_collection)
7782 {
@@ -126,6 +131,9 @@ namespace ZEngine::Hardwares
126131 }
127132 }
128133
134+ #ifdef __APPLE__
135+ enabled_extension_layer_name_collection.push (VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
136+ #endif
129137 instance_create_info.enabledLayerCount = enabled_layer_name_collection.size ();
130138 instance_create_info.ppEnabledLayerNames = enabled_layer_name_collection.data ();
131139 instance_create_info.enabledExtensionCount = enabled_extension_layer_name_collection.size ();
@@ -175,16 +183,26 @@ namespace ZEngine::Hardwares
175183
176184 for (VkPhysicalDevice physical_device : physical_device_collection)
177185 {
178- VkPhysicalDeviceProperties physical_device_properties;
179- VkPhysicalDeviceFeatures physical_device_feature;
186+ VkPhysicalDeviceDescriptorIndexingProperties indexing_properties = {};
187+ indexing_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES;
188+
189+ VkPhysicalDeviceProperties physical_device_properties;
190+ VkPhysicalDeviceProperties2 physical_device_properties2 = {};
191+ physical_device_properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
192+ physical_device_properties2.pNext = &indexing_properties;
193+
194+ VkPhysicalDeviceFeatures physical_device_feature;
195+
180196 vkGetPhysicalDeviceProperties (physical_device, &physical_device_properties);
197+ vkGetPhysicalDeviceProperties2 (physical_device, &physical_device_properties2);
181198 vkGetPhysicalDeviceFeatures (physical_device, &physical_device_feature);
182199
183- if ((physical_device_feature.geometryShader == VK_TRUE) && (physical_device_feature.samplerAnisotropy == VK_TRUE) && ((physical_device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) || (physical_device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)))
200+ if (/* (physical_device_feature.geometryShader == VK_TRUE) && (physical_device_feature.samplerAnisotropy == VK_TRUE) && */ ((physical_device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) || (physical_device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)))
184201 {
185- PhysicalDevice = physical_device;
186- PhysicalDeviceProperties = physical_device_properties;
187- PhysicalDeviceFeature = physical_device_feature;
202+ PhysicalDevice = physical_device;
203+ PhysicalDeviceProperties = physical_device_properties;
204+ PhysicalDeviceDescriptorIndexingProperties = indexing_properties;
205+ PhysicalDeviceFeature = physical_device_feature;
188206 vkGetPhysicalDeviceMemoryProperties (PhysicalDevice, &PhysicalDeviceMemoryProperties);
189207 break ;
190208 }
@@ -197,6 +215,9 @@ namespace ZEngine::Hardwares
197215
198216 requested_device_extension_layer_name_collection.push (VK_KHR_SWAPCHAIN_EXTENSION_NAME);
199217 requested_device_extension_layer_name_collection.push (VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME);
218+ #ifdef __APPLE__
219+ requested_device_extension_layer_name_collection.push (" VK_KHR_portability_subset" );
220+ #endif
200221
201222 for (LayerProperty& layer : selected_layer_property_collection)
202223 {
0 commit comments