Skip to content

Best practices for optional feature enablement #863

@eddiehatfield

Description

@eddiehatfield

tldr

I'm not sure how to conditionally enable VkPhysicalDeviceVulkan12Features::timelineSemaphore when using a vulkan profile that already customizes VkPhysicalDeviceVulkan12Features in the pNext chain.

Background

I am writing a simple Vulkan application that uses a bindless rendering model. I am using the vulkan_profiles.hpp library as follows:
I have a custom profile called baseline.json, which I use to generate a vulkan_profiles.hpp file from this profile using a python script shipped with my Vulkan SDK. This profile contains the features that are absolutely required for my engine to run, which currently includes VK_KHR_swapchain, VK_KHR_dynamic_rendering, VK_KHR_draw_indirect_count, and VK_EXT_descriptor_indexing. Within the features JSON object, I have enabled VkPhysicalDeviceVulkan12Features::{drawIndirectCount,descriptorIndexing,runtimeDescriptorArray}. Without these features, my engine won't work at all.

In some of my rendering codepaths, I check via if-statement whether timeline semaphores are supported, in which case I make use of them. If this feature isn't supported, then the engine will still work.

Issue

My current issue is that I am unsure how to enable VkPhysicalDeviceVulkan12Features::timelineSemaphore, since I create my VkDevice via vpCreateDevice with the profile generated from baseline.json. I don't see a way to set the timelineSemaphore field to true since the pNext chain is completely handled by this function. Do I need to create a separate profile only for checking timelineSemaphore, then append that to pEnabledFullProfiles if it is supported?

Please let me know if I am not following the desired usage of this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions