Shader storage buffer objects


#1

I am trying to implement a shader storage buffer object in Vulkan. I have successfully implemented a uniform buffer object from this tutorial:
https://vulkan-tutorial.com/Uniform_buffers

I declared the shader storage object in the vertex shader like so:

layout(set = 0, binding = 0) buffer StorageBufferObject { vec4 data[]; };

I searched and replaced all instances of the term “UNIFORM_” in my C++ code with “STORAGE_” and it compiles and runs, but the data is not being read in the shader. What do I have to do to make a shader storage buffer object work?


#2

Hmmm, this is actually working on Intel graphics and not working on Nvidia:
https://devtalk.nvidia.com/default/topic/1051283/vulkan/ssbos-work-on-intel-but-not-nvidia/


#3

Check with validation layers. Do they output any errors? If not, please provide the code so we can check. It’s possible that you’re missing proper usage flags or your descriptor types won’t match, or your alignment, buffer offests, buffer sizes, etc. are wrong.

SSBOs work fine for me on NVidia, Intel, AMD, Arm, Mali, etc.


#4

No validation errors. I will scrape out the code and post it here tomorrow.


#5

In the process of preparing the code to show I discovered my VkDescriptorBufferInfo.range parameter was incorrect. It now works.