Skip to content

Conversation

@johannes-el
Copy link
Contributor

Refactored descriptor setup to use explicit array initialization and designated initializers.
Should I apply the same designated-initializer and explicit-type style to the C++ side as well, or leave it as-is to avoid potential merge conflicts?

std::array<vk::DescriptorSetLayoutBinding, 2> bindings = {
vk::DescriptorSetLayoutBinding( 0, vk::DescriptorType::eUniformBuffer, 1, vk::ShaderStageFlagBits::eVertex, nullptr),
vk::DescriptorSetLayoutBinding( 1, vk::DescriptorType::eCombinedImageSampler, 1, vk::ShaderStageFlagBits::eFragment, nullptr)
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could as well go one step further with designated initializers, like

    std::array<vk::DescriptorSetLayoutBinding, 2> bindings = {
      { { .binding = 0, .descriptorType = vk::DescriptorType::eUniformBuffer, .descriptorCount = 1, .stageFlags = vk::ShaderStageFlagBits::eVertex },
        { .binding = 1, .descriptorType = vk::DescriptorType::eCombinedImageSampler, .descriptorCount = 1, .stageFlags = vk::ShaderStageFlagBits::eFragment } }
    };

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's one of those areas where the tutorial is lacking consistency. We prob. should discuss this on our next call and agree on how we want to write code and then start updating the documentation accordingly.

rapfamily4 pushed a commit to rapfamily4/Vulkan-Tutorial that referenced this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants