Shader Storage Buffer Object: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
m (link fix)
(Adding the object float.)
Line 1: Line 1:
{{infobox feature
{{infobox feature
| core = 4.3
| core = 4.3
| core_extension = {{extref|shader_storage_buffer_object}}
| core_extension = {{extref|shader_storage_buffer_object}}
|{{object float}}

Revision as of 22:29, 16 October 2012

Shader Storage Buffer Object
Core in version 4.6
Core since version 4.3
Core ARB extension ARB_shader_storage_buffer_object

A Shader Storage Buffer Object is a Buffer Object that is used to store and retrieve data from GLSL.


SSBOs are a lot like Uniform Buffer Objects. Shader storage blocks are defined almost identically to uniform blocks. SSBOs are bound to SSBO binding points, just as UBOs are bound to UBO binding points. And so forth.

The principle differences between them are:

  1. SSBOs are typically 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 uniforms. SSBOs do need to use memory barriers, similar to Image Load Store write and read 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.

Functionally speaking, SSBOs can be thought of as a much nicer interface to Buffer Textures when accessed via Image Load Store.