Vulkan validation warning catch-22 about VK_KHR_portability_subset on MoltenVK
Asked Answered
Y

2

9

I'm using Vulkan 1.2.170 with MoltenVK (and GLFW) on Big Sur (mid 2014 15" Retina). I created the instance with VK_LAYER_KHRONOS_validation and when I call vkCreateDevice I get the warning

VUID-VkDeviceCreateInfo-pProperties-04451(ERROR / SPEC): msgNum: 976972960 - Validation Error:
 [ VUID-VkDeviceCreateInfo-pProperties-04451 ] Object 0: handle = 0x10cfaad00, 
type = VK_OBJECT_TYPE_PHYSICAL_DEVICE; | MessageID = 0x3a3b6ca0 | vkCreateDevice: 
VK_KHR_portability_subset must be enabled because physical device VkPhysicalDevice 0x10cfaad00[] 
supports it The Vulkan spec states: If the [VK_KHR_portability_subset] extension is included in 
pProperties of vkEnumerateDeviceExtensionProperties, ppEnabledExtensions must include 
"VK_KHR_portability_subset".

Okay, fine, I add it to the extensions parameter as the only extension. Then it says

Missing extension required by the device extension VK_KHR_portability_subset:
VK_KHR_get_physical_device_properties2.

and segfaults. If I add VK_KHR_get_physical_device_properties2, it crashes saying it doesn't exist, which is true (vkEnumerateDeviceExtensionProperties doesn't return it).

Is this a bug or is there some set of extensions it will accept?

If it helps, the supported extensions are

VK_KHR_16bit_storage VK_KHR_8bit_storage VK_KHR_bind_memory2 VK_KHR_create_renderpass2 VK_KHR_dedicated_allocation VK_KHR_depth_stencil_resolve VK_KHR_descriptor_update_template VK_KHR_device_group VK_KHR_driver_properties VK_KHR_external_fence VK_KHR_external_memory VK_KHR_external_semaphore VK_KHR_get_memory_requirements2 VK_KHR_image_format_list VK_KHR_maintenance1 VK_KHR_maintenance2 VK_KHR_maintenance3 VK_KHR_multiview VK_KHR_portability_subset VK_KHR_push_descriptor VK_KHR_relaxed_block_layout VK_KHR_sampler_mirror_clamp_to_edge VK_KHR_sampler_ycbcr_conversion VK_KHR_shader_draw_parameters VK_KHR_shader_float16_int8 VK_KHR_storage_buffer_storage_class VK_KHR_swapchain VK_KHR_swapchain_mutable_format VK_KHR_timeline_semaphore VK_KHR_uniform_buffer_standard_layout VK_KHR_variable_pointers VK_EXT_debug_marker VK_EXT_descriptor_indexing VK_EXT_fragment_shader_interlock VK_EXT_hdr_metadata VK_EXT_host_query_reset VK_EXT_image_robustness VK_EXT_inline_uniform_block VK_EXT_memory_budget VK_EXT_private_data VK_EXT_robustness2 VK_EXT_scalar_block_layout VK_EXT_shader_viewport_index_layer VK_EXT_subgroup_size_control VK_EXT_texel_buffer_alignment VK_EXT_vertex_attribute_divisor VK_AMD_gpu_shader_half_float VK_AMD_negative_viewport_height VK_AMD_shader_trinary_minmax VK_INTEL_shader_integer_functions2 VK_GOOGLE_display_timing VK_NV_glsl_shader

Yurikoyursa answered 16/3, 2021 at 17:2 Comment(0)
Y
14

Turns out VK_KHR_get_physical_device_properties2 is an instance extension, not a device extension, so it's passed to vkCreateInstance like so:

VkInstanceCreateInfo instCreateInfo;
const char* instExtension = "VK_KHR_get_physical_device_properties2";
instCreateInfo.enabledExtensionCount = 1;
instCreateInfo.ppEnabledExtensionNames = &instExtension;
// etcetera
VkInstance instance;
vkCreateInstance(&instCreateInfo, nullptr, &instance);

// ...

VkDeviceCreateInfo deviceCreateInfo;
const char* deviceExtension = "VK_KHR_portability_subset";
deviceCreateInfo.enabledExtensionCount = 1;
deviceCreateInfo.ppEnabledExtensionNames = &deviceExtension;
// etcetera
VkDevice device;
vkCreateDevice(physicalDevice, &deviceCreateInfo, nullptr, &device);
Yurikoyursa answered 16/3, 2021 at 17:15 Comment(3)
Hi Dan. I'm following the tutorial on vulkan-tutorial.com and I'm getting the same error. How did you exactly solve this problem in the end? Thx for your help!Scandal
Are you loading the extensions unconditionally? I had the feeling one has to check whether they are even necessary before loading them.Zr
@ChristianIvicevic Yes, you should call vkEnumerateDeviceExtensionProperties first and check for it. I've omitted that from the code sample for clarity.Yurikoyursa
T
0

A bit late to answer this question. But I faced the same issue and used vk::enumerateInstanceExtensionProperties() and .enumerateDeviceExtensionProperties() to check if the extensions were present.

Tolle answered 18/11, 2021 at 12:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.