5

I have a compute shader which produces vertex buffer and draw indirect structure that are then used to draw some geometry.

Compute shader is invoked not every frame, but once per 5-10 frames. In fact, I have my vertex and draw indirect buffers duplicated, so while I am rendering geometry using VB1 and DI1, compute shader is able to write to VB2 and DI2 and then swap them, so compute and drawing invocations may be independent. I also have 2 queue families: do-everything and compute-only.

So, I can think of 3 ways to do this:

  1. Use only one do-everything queue with VK_SHARING_MODE_EXCLUSIVE buffers
  2. Use compute-only queue for compute shader and do-everything for drawing with VK_SHARING_MODE_EXCLUSIVE buffers and ownership transfer between queues
  3. Use compute-only queue for compute shader and do-everything for drawing with VK_SHARING_MODE_CONCURRENT buffers

I would like hearing your advices about what option to use and what are they pros/cons. I have some assumptions about it and want to know, am I right or not:

  1. I think that using separate family dedicated for compute operations may improve performance
  2. I think that ownership transfer is a heavy operation and it worth doing it only once (like when uploading resource to gpu memory), but not every 5-10 frames
  3. Therefore I think that 3rd option will be the best choice for me
plasmacel
  • 8,183
  • 7
  • 53
  • 101
YaaZ
  • 380
  • 2
  • 11
  • 2
    According to [this](https://gpuopen.com/presentations/2019/Vulkanised2019_06_optimising_aaa_vulkan_title_on_desktop.pdf), the CONCURRENT mode has disabled DCC (Delta Color Compression), resulting in higher bandwidth requirements. – Hitokage Apr 22 '21 at 10:13

1 Answers1

6

Since the standard has this explicit warning:

VK_SHARING_MODE_CONCURRENT may result in lower performance access to the buffer or image than VK_SHARING_MODE_EXCLUSIVE.

I would say that you should pick exclusive mode unless and until your profiling data suggests there is a performance problem. After all, you said there is at least a 5:1 ratio between using the buffers and moving them across queues. So you access the buffers with greater frequency than the frequency with which you perform queue ownership operations.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982