Skip to content

Commit a998bd9

Browse files
authored
Use aggregate initialization to match demo code and the rest of the tutorial (#204)
1 parent 721e2c2 commit a998bd9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

en/06_Texture_mapping/02_Combined_image_sampler.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ Go to the `createDescriptorSets` function.
5858
[,c++]
5959
----
6060
for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
61-
vk::DescriptorBufferInfo bufferInfo(uniformBuffers[i], 0, sizeof(UniformBufferObject));
62-
vk::DescriptorImageInfo imageInfo( textureSampler, textureImageView, vk::ImageLayout::eShaderReadOnlyOptimal );
61+
vk::DescriptorBufferInfo bufferInfo{ .buffer = uniformBuffers[i], .offset = 0, .range = sizeof(UniformBufferObject) };
62+
vk::DescriptorImageInfo imageInfo{ .sampler = textureSampler, .imageView = textureImageView, .imageLayout = vk::ImageLayout::eShaderReadOnlyOptimal};
6363
6464
...
6565
}
@@ -71,8 +71,10 @@ This is where the objects from the previous chapter come together.
7171
[,c++]
7272
----
7373
std::array descriptorWrites{
74-
vk::WriteDescriptorSet( descriptorSets[i], 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfo ),
75-
vk::WriteDescriptorSet( descriptorSets[i], 1, 0, 1, vk::DescriptorType::eCombinedImageSampler, &imageInfo)
74+
vk::WriteDescriptorSet{ .dstSet = descriptorSets[i], .dstBinding = 0, .dstArrayElement = 0, .descriptorCount = 1,
75+
.descriptorType = vk::DescriptorType::eUniformBuffer, .pBufferInfo = &bufferInfo },
76+
vk::WriteDescriptorSet{ .dstSet = descriptorSets[i], .dstBinding = 1, .dstArrayElement = 0, .descriptorCount = 1,
77+
.descriptorType = vk::DescriptorType::eCombinedImageSampler, .pImageInfo = &imageInfo }
7678
};
7779
device.updateDescriptorSets(descriptorWrites, {});
7880
----

0 commit comments

Comments
 (0)