i have a vulkan program where i have a renderpass that has two subpasses the first…
- User
i have a vulkan program where i have a renderpass that has two subpasses
the first writes into a offscreen framebuffer the second reads this framebuffer as input attachment
in the dependencies of the second subpass, if i don't add MEMORY_WRITE to the dst_access_mask. i get validation errors. but why would MEMORY_WRITE be needed?
Assistant
The
MEMORY_WRITEflag in thedst_access_maskof a Vulkan render pass subpass is used to indicate that the subpass writes to the memory, in addition to reading from it.In your case, the second subpass reads from the offscreen framebuffer that is written to by the first subpass. If the second subpass doesn't have
MEMORY_WRITEin itsdst_access_mask, it means that it doesn't modify the memory in any way, and it only reads from it.However, the validation errors you're seeing suggest that the Vulkan driver expects the second subpass to also write to the memory, in addition to reading from it. This is likely because the driver is trying to optimize the rendering pipeline by reusing the memory for both reading and writing.
By adding
MEMORY_WRITEto thedst_access_maskof the second subpass, you're telling the driver that the subpass writes to the memory, and the driver can therefore optimize the pipeline accordingly.It's worth noting that if you don't actually modify the memory in the second subpass, adding
MEMORY_WRITEto thedst_access_maskwon't have any performance impact. However, it's still necessary to add it to avoid the validation errors.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.