Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL: SSBO vs "Buffer Texture" vs "PBO / Texture" to feed compute shader

Tags:

opengl

I need to feed float data to a compute shader.

The 3 ways I see of doing that are:

  • Shader Storage Buffer Objects
  • Buffer Texture
  • 'classic' Texture (upload data to GPU using a PBO, then copy data to texture using glTexSubImage2D) and accessed as 'image2D' in the shader

What are the pros / cons / performance of each technique ?

I don't need filtering, I just need to access the raw float data. Since SSBO and Buffer Texture are 1D, that means if my data is '2D', I need to compute the offsets myself.

like image 304
246tNt Avatar asked May 26 '16 08:05

246tNt


1 Answers

  • Buffer Texture - useless
  • Texture - if your data is matrix-type and can fit 4 channel-float it could be little faster than pure buffer, you can utilize functions like textureGather and texture filtering
  • Image - like texture, but no samplers
  • SSBO - universal solution, same performance as image, you can still put 2D array in buffer and index as data[y][x]
like image 149
Neithy Avatar answered Sep 18 '22 09:09

Neithy