@@ -292,10 +292,10 @@ The function we're going to write now involves recording and executing a command
292292[,c++]
293293----
294294vk::raii::CommandBuffer beginSingleTimeCommands() {
295- vk::CommandBufferAllocateInfo allocInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1) ;
295+ vk::CommandBufferAllocateInfo allocInfo{ . commandPool = commandPool, .level = vk::CommandBufferLevel::ePrimary, .commandBufferCount = 1 } ;
296296 vk::raii::CommandBuffer commandBuffer = std::move(device.allocateCommandBuffers(allocInfo).front());
297297
298- vk::CommandBufferBeginInfo beginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) ;
298+ vk::CommandBufferBeginInfo beginInfo{ .flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit } ;
299299 commandBuffer.begin(beginInfo);
300300
301301 return commandBuffer;
@@ -304,7 +304,7 @@ vk::raii::CommandBuffer beginSingleTimeCommands() {
304304void endSingleTimeCommands(vk::raii::CommandBuffer& commandBuffer) {
305305 commandBuffer.end();
306306
307- vk::SubmitInfo submitInfo( {}, {}, { *commandBuffer}) ;
307+ vk::SubmitInfo submitInfo{ .commandBufferCount = 1, .pCommandBuffers = & *commandBuffer } ;
308308 graphicsQueue.submit(submitInfo, nullptr);
309309 graphicsQueue.waitIdle();
310310}
@@ -340,13 +340,12 @@ There is an equivalent _buffer memory barrier_ to do this for buffers.
340340
341341[,c++]
342342----
343- vk::ImageMemoryBarrier barrier( {}, {}, oldLayout, newLayout, {}, {}, image, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } ) ;
343+ vk::ImageMemoryBarrier barrier{ .oldLayout = oldLayout, . newLayout = newLayout, . image = image, .subresourceRange = { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } } ;
344344----
345-
346- The first two fields specify layout transition.
345+ `oldLayout` and `newLayout` specify the the layout transition.
347346It is possible to use `VK_IMAGE_LAYOUT_UNDEFINED` as `oldLayout` if you don't care about the existing contents of the image.
348347
349- If you are using the barrier to transfer queue family ownership, then these two fields should be the indices of the queue families.
348+ If you are using the barrier to transfer queue family ownership, then `oldLayout` and `newLayout` fields should be the indices of the queue families.
350349They must be set to `VK_QUEUE_FAMILY_IGNORED` if you don't want to do this (not the default value!).
351350
352351The `image` and `subresourceRange` specify the image that is affected and the specific part of the image.
@@ -394,7 +393,8 @@ This happens through `VkBufferImageCopy` structs:
394393
395394[,c++]
396395----
397- vk::BufferImageCopy region( 0, 0, 0, { vk::ImageAspectFlagBits::eColor, 0, 0, 1 }, {0, 0, 0}, {width, height, 1});
396+ vk::BufferImageCopy region{ .bufferOffset = 0, .bufferRowLength = 0, .bufferImageHeight = 0,
397+ .imageSubresource = { vk::ImageAspectFlagBits::eColor, 0, 0, 1 }, .imageOffset = {0, 0, 0}, .imageExtent = {width, height, 1} };
398398----
399399
400400Most of these fields are self-explanatory.
0 commit comments