简体   繁体   中英

Trying to enable conservative rasterization fails

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM