Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Vulkan-Profiles #133

Open
charles-lunarg opened this issue Apr 26, 2022 · 3 comments
Open

Support Vulkan-Profiles #133

charles-lunarg opened this issue Apr 26, 2022 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@charles-lunarg
Copy link
Owner

charles-lunarg commented Apr 26, 2022

Allow a user to use a profile to feed vk-bootstrap's instance/device creation process. This should be straight forward as vk-bootstrap already contains all the necessary code to do the vulkan code, what is missing is the profile definition (json) -> vk-bootstrap. How this is achieved is yet to be determined.

Solutions include:

  • Write a basic json parser in-source.
  • Copy/paste an existing json parser into vk-bootstrap's source tree.
  • Require an external dependency for json parsing.

Open Questions:

  • Custom profiles? Extremely desirable but needs an interface to express them
    • Allow loading by file-path or only by passing a string?
  • Copy/paste "standard" Vulkan-Profiles into vk-bootstrap (with auto-updating)? Alternatively don't provide any profiles by default.
@charles-lunarg charles-lunarg added enhancement New feature or request question Further information is requested labels Apr 26, 2022
@DethRaid
Copy link

Me providing custom profiles as a JSON string makes sense. Different platforms have different filesystem APIs, no need for you to handle all that

@GavinNL
Copy link

GavinNL commented Jan 30, 2024

I don't know if this is worth doing, but LunarG provides some default profiles. Instead of having to write a JSON parser for your library, you can probably use a python script to read the provided json files and generate C++ functions which would return the
extensions/required device features.

I'm doing something similar, but I didn't write the code generator. I manually created the function that returns the profile information. See below:

struct VulkanProfile
{
    std::vector<char const*>         extensions;
    VkPhysicalDeviceFeatures          f10 = {};
    VkPhysicalDeviceVulkan11Features f11 = {};
    VkPhysicalDeviceVulkan12Features f12 = {};
    VkPhysicalDeviceVulkan13Features f13 = {};
};

// code-generated from VK_KHR_Roadman_2022.json
VulkanProfile VK_KHR_Roadmap_2022()
{
    VulkanProfile pro;

    {
        auto & req = pro.f10;
        req.robustBufferAccess = true;
        req.fullDrawIndexUint32 = true;
        req.imageCubeArray = true;
        req.independentBlend = true;
        req.sampleRateShading = true;
        req.drawIndirectFirstInstance = true;
        req.depthClamp = true;
        req.depthBiasClamp = true;
        req.samplerAnisotropy = true;
        req.occlusionQueryPrecise = true;
        req.fragmentStoresAndAtomics = true;
        req.shaderStorageImageExtendedFormats = true;
        req.shaderUniformBufferArrayDynamicIndexing = true;
        req.shaderSampledImageArrayDynamicIndexing = true;
        req.shaderStorageBufferArrayDynamicIndexing = true;
        req.shaderStorageImageArrayDynamicIndexing = true;
    }
    {
        auto & req = pro.f11;
        req.multiview = true;
        req.samplerYcbcrConversion = true;
    }
    
    {
        auto & req = pro.f12;
        req.uniformBufferStandardLayout = true;
        req.subgroupBroadcastDynamicId = true;
        req.imagelessFramebuffer = true;
        req.separateDepthStencilLayouts = true;
        req.hostQueryReset = true;
        req.timelineSemaphore = true;
        req.shaderSubgroupExtendedTypes = true;
        req.samplerMirrorClampToEdge = true;
        req.descriptorIndexing = true;
        req.shaderUniformTexelBufferArrayDynamicIndexing = true;
        req.shaderStorageTexelBufferArrayDynamicIndexing = true;
        req.shaderUniformBufferArrayNonUniformIndexing = true;
        req.shaderSampledImageArrayNonUniformIndexing = true;
        req.shaderStorageBufferArrayNonUniformIndexing = true;
        req.shaderStorageImageArrayNonUniformIndexing = true;
        req.shaderUniformTexelBufferArrayNonUniformIndexing = true;
        req.shaderStorageTexelBufferArrayNonUniformIndexing = true;
        req.descriptorBindingSampledImageUpdateAfterBind = true;
        req.descriptorBindingStorageImageUpdateAfterBind = true;
        req.descriptorBindingStorageBufferUpdateAfterBind = true;
        req.descriptorBindingUniformTexelBufferUpdateAfterBind = true;
        req.descriptorBindingStorageTexelBufferUpdateAfterBind = true;
        req.descriptorBindingUpdateUnusedWhilePending = true;
        req.descriptorBindingPartiallyBound = true;
        req.descriptorBindingVariableDescriptorCount = true;
        req.runtimeDescriptorArray = true;
        req.scalarBlockLayout = true;
        req.vulkanMemoryModel = true;
        req.vulkanMemoryModelDeviceScope = true;
        req.bufferDeviceAddress = true;
        req.vulkanMemoryModel = true;
        req.vulkanMemoryModelDeviceScope = true;
        req.vulkanMemoryModelAvailabilityVisibilityChains = true;
        req.bufferDeviceAddress = true;
    }
    {
        auto & req = pro.f13;
        req.robustImageAccess = true;
        req.shaderTerminateInvocation = true;
        req.shaderZeroInitializeWorkgroupMemory = true;
        req.synchronization2 = true;
        req.shaderIntegerDotProduct = true;
        req.maintenance4 = true;
        req.pipelineCreationCacheControl = true;
        req.subgroupSizeControl = true;
        req.computeFullSubgroups = true;
        req.shaderDemoteToHelperInvocation = true;
        req.inlineUniformBlock = true;
        req.dynamicRendering = true;
        req.robustImageAccess = true;
        req.shaderTerminateInvocation = true;
        req.shaderZeroInitializeWorkgroupMemory = true;
        req.synchronization2 = true;
        req.shaderIntegerDotProduct = true;
        req.maintenance4 = true;
        req.pipelineCreationCacheControl = true;
        req.subgroupSizeControl = true;
        req.computeFullSubgroups = true;
        req.shaderDemoteToHelperInvocation = true;
        req.inlineUniformBlock = true;
        req.descriptorBindingInlineUniformBlockUpdateAfterBind = true;
        req.descriptorBindingInlineUniformBlockUpdateAfterBind = true;
    }

    pro.extensions = {
        "VK_EXT_image_robustness",
        "VK_KHR_shader_non_semantic_info",
        "VK_KHR_shader_terminate_invocation",
        "VK_KHR_format_feature_flags2",
        "VK_KHR_zero_initialize_workgroup_memory",
        "VK_KHR_synchronization2",
        "VK_KHR_shader_integer_dot_product",
        "VK_KHR_maintenance4",
        "VK_EXT_4444_formats",
        "VK_EXT_extended_dynamic_state",
        "VK_EXT_extended_dynamic_state2",
        "VK_EXT_pipeline_creation_cache_control",
        "VK_EXT_subgroup_size_control",
        "VK_EXT_shader_demote_to_helper_invocation",
        "VK_EXT_inline_uniform_block",
        "VK_EXT_pipeline_creation_feedback",
        "VK_EXT_texel_buffer_alignment",
        "VK_EXT_ycbcr_2plane_444_formats",
        "VK_EXT_texture_compression_astc_hdr",
        "VK_EXT_tooling_info",
        "VK_EXT_private_data",
        "VK_KHR_dynamic_rendering",
        "VK_KHR_global_priority",
        "VK_EXT_inline_uniform_block"};

    return pro;
}

@charles-lunarg
Copy link
Owner Author

While there are some interesting solutions using C++ directly, I do think a simple JSON parser that can consume profiles directly is the best bet.

There seems to be a good open source json parser fit for this purpose: https://github.com/sheredom/json.h/tree/master

The license is permissive, it only uses a single allocation, and should be straight forward to integrate.

A definite requirement is generating the feature & properties struct parsing, as well as any other things profiles supports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants