Use designated initializers and use explicit array types#212
Open
johannes-el wants to merge 1 commit intoKhronosGroup:mainfrom
Open
Use designated initializers and use explicit array types#212johannes-el wants to merge 1 commit intoKhronosGroup:mainfrom
johannes-el wants to merge 1 commit intoKhronosGroup:mainfrom
Conversation
| 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) | ||
| }; |
Contributor
There was a problem hiding this comment.
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 } }
};
Collaborator
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?