Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between SSBO and Image load/store

What are the diffences between "Shader Storage Buffer Objects" (SSBO) and Image load store operations

When should one be used and not the other?

They both can have atomic operations and I assume they are stored in the same type of memory. And regardless if they are stored in the same type of memory, do they have the same performance characteristics?

edit: the original question was asking between SSBOs and Uniform buffer objects, it was meant to be between SSBO and Image load store.

like image 226
tamato Avatar asked Oct 27 '13 17:10

tamato


2 Answers

The difference between shader storage buffer objects and image textures and why one would want to use them is that they can use interface blocks.

Images are just textures which mean only vec4's are in the data structure. Well not only vec4, it could have other formats, but the data structure would be many of one data type.

Where as, SSBO's are generic. They can use combinations of int's, float's, arrays of vec3's all in a single interface block.

So, SSBO's are much more flexible than just Image Texture's.

like image 80
tamato Avatar answered Sep 20 '22 00:09

tamato


Your question is already 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 blocks are defined by Interface Block (GLSL)s in almost the same way as uniform blocks. Buffer objects that store SSBOs are bound to SSBO binding points, just as buffer objects for uniforms are bound to UBO binding points. And so forth.

The major differences between them are:

  1. SSBOs can be much larger. The smallest required UBO size is 16KB; the smallest required SSBO size is 16MB, and typical sizes will be on the order of the size of GPU memory.

  2. SSBOs are writable, even atomically; UBOs are uniform​s. SSBOs reads and writes use incoherent memory accesses, so they need the appropriate barriers, just as Image Load Store operations.

  3. SSBOs can have unbounded storage, up to the buffer range bound; UBOs must have a specific, fixed storage size. This means that you can have an array of arbitrary length in an SSBO. The actual size of the array, based on the range of the buffer bound, can be queried at runtime in the shader using the length​ function on the unbounded array variable.

like image 36
2 revs Avatar answered Sep 19 '22 00:09

2 revs