Vulkan tutorial: why is src access null, but dst access write when transitioning image layout?
In Khronos' Vulkan tutorial when transitioning the image layout for rendering the triangle, there is a dst access mask which doesn't seem to do anything since the src access mask is null. As far as I understand memory barriers make src accesses performed in src stage visible to dst accesses in dst stage. Shouldn't both src and dst access be empty by that logic since we are just discarding the image?
The new How to Vulkan also does the same thing but they also [or] the write with read access.
// Before starting rendering, transition the swapchain image to vk::ImageLayout::eColorAttachmentOptimal
transition_image_layout(
imageIndex,
vk::ImageLayout::eUndefined,
vk::ImageLayout::eColorAttachmentOptimal,
{}, // srcAccessMask (no need to wait for previous operations)
vk::AccessFlagBits2::eColorAttachmentWrite, // dstAccessMask
vk::PipelineStageFlagBits2::eColorAttachmentOutput, // srcStage
vk::PipelineStageFlagBits2::eColorAttachmentOutput // dstStage
);