I am trying to follow Sacha Willems' example on conservative rasterization.
To that effect I added tried requesting the extensions when making my device:
const std::vector<const char*> DEVICE_EXTENSIONS = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME,
VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME,
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME
};
vk::DeviceCreateInfo create_info = {};
create_info.queueCreateInfoCount = queue_create_infos.size();
create_info.pQueueCreateInfos = queue_create_infos.data();
create_info.enabledLayerCount = 0;
create_info.ppEnabledLayerNames = nullptr;
create_info.enabledExtensionCount = DEVICE_EXTENSIONS.size();
create_info.ppEnabledExtensionNames = DEVICE_EXTENSIONS.data();
create_info.pEnabledFeatures = &device_features;
/* ... */
However when I try to load some of the extension functions, it fails:
vkGetPhysicalDeviceProperties2KHR_NE = (PFN_vkGetPhysicalDeviceProperties2KHR) vkGetInstanceProcAddr(
instance, "vkGetPhysicalDeviceProperties2KHR");
Assert(vkGetPhysicalDeviceProperties2KHR_NE,
"Failed to find extension function: vkGetPhysicalDeviceProperties2KHR");
Failed check: vkGetPhysicalDeviceProperties2KHR_NE
Failed to find extension function: vkGetPhysicalDeviceProperties2KHR
I know that the extension is available in my card:
vulkaninfo | grep extensi | grep conservative
MESA-INTEL: warning: Haswell Vulkan support is incomplete
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
VK_EXT_conservative_rasterization : extension revision 1
What am I missing?
CodePudding user response:
VK_KHR_get_physical_device_properties2
is an instance level extension (see the name chapter of the extension spec), but you are enabling it at the device level. That's why loading it's function pointer via vkGetInstanceProcAddr
fails. You need to enable that extension at instance creation time.