Forums - Vulkan subpassLoad return wrong value

2 posts / 0 new
Last post
Vulkan subpassLoad return wrong value
il_lbj
Join Date: 16 Jul 23
Posts: 1
Posted: Sun, 2023-07-16 04:49

I'm developing a painting software using Vulkan, and I need to get the historical values of pixels in fragment shader. 

It is well known that the EXT_shader_framebuffer_fetch extension can be used in Opengl ES to guarantees full coherency between framebuffer reads and writes.

To do the same in vulkan, I used a combination of subpass self-dependency and pipeline barrier. Simply speaking, a renderpass contains only one subpass, and the values of srcSubpass and dstSubpass of subpass denpency are both 0. Then insert a vkCmdPipelineBarrier instruction before each vkCmdDrawIndexed instruction.

This works as expected on the Snapdragon 870, but on the Snapdragon 8+gen1 there are some wrong values.

I fixed all the validation layer errors, including the synchronization validation errors, but still got the wrong value, which was frustrating.

Any idea how should I process?
Thank you!

 

  • Up0
  • Down0
jleger
Join Date: 23 Aug 16
Posts: 15
Posted: Tue, 2023-07-25 10:33

Core Vulkan doesnt have full coherency of EXT_shader_framebuffer_fetch, so it's closer to  
GL_EXT_shader_framebuffer_fetch_non_coherent.   Adding vkCmdPipelineBarrier between the "write" primitives and the "read primitives"  should do the trick, but if a single vkCmdDrawIndexed is performing both writes and reads then there is no guarantee that you will get full coherency of the primitives within that command.  This may work on some GPUs in some cases, and not work on others.  If you really need something that is functionally equivalient to the coherent EXT_shader_framebuffer_fetch, then VK_EXT_rasterization_order_attachment_access is a likely choice but our existing drivers dont support that extension.  Is that something you need?

If you belive the app is inserting the barriers as required and yet it's not working as expected, can you provide a small sample
(Github source code or APK) that demonstrates the problem?

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.