The difference between SSBO and image upload / storage

What are the differences between Shader Buffer Storage (SSBO) operations and image loading

When do you need to use one and not the other?

Both of them can have atomic operations, and I assume that they are stored in the same type of memory. And regardless of whether they are stored in the same type of memory, do they have the same performance characteristics?

edit: the original question asked between SSBOs and Uniform buffer objects, it should have been between SSBO and the image loading repository.

+6
source share
2 answers

The difference between shader storage buffer objects and image textures and why they should be used is that they can use interface blocks.

Images are only textures, which only mean vec4 in the data structure. Well, not only vec4, it can have other formats, but the data structure will consist of one data type.

Where, how, SSBOs are common. They can use combinations of int, float, vec3 arrays all in one interface unit.

So, SSBOs are much more flexible than just image textures.

+6
source

Your question has already been answered more or less definitively at http://www.opengl.org/wiki/Shader_Storage_Buffer_Object . It says:

SSBOs are a lot like Uniform Buffer Objects. Shader storage units defined by an interface unit (GLSL) s are almost the same as uniform units. Buffer objects that store SSBOs are tied to snapping SSBO points, just like buffer objects for uniforms are tied to binding to UBO points. And so on.

The main differences between them:

  • SSBOs can be much larger. The minimum size of UBO is 16 KB; the minimum size of SSBO is 16 MB, and typical sizes be of the order of the size of the GPU memory.

  • SSBOs can be writable, even atomically; UBOs are uniform. SSBOs read and write the use of incoherent memory accesses, so they need appropriate barriers, as well as image loading operations.

  • SSBOs can have unlimited storage, up to the limit of the buffer range; UBOs must have a specific fixed storage size. This means that you can have an array of arbitrary length in SSBO. The actual size of the array, based on the range of the buffer boundary, can be requested at runtime in a shader using the length function on an unlimited array.

+3
source

Source: https://habr.com/ru/post/956826/


All Articles