5

I am interested in passing a variable length array (attached SSBO) to a function, i.e.:

layout(std430) buffer ssbo {
    type buffer[];
};

void func(buffer) {
    buffer[...]
}

func(buffer);

EDIT: The extension spec clearly states that this is unsupported (issue #2 - https://www.opengl.org/registry/specs/ARB/shader_storage_buffer_object.txt). Therefore work-arounds are welcome.

unexpectedvalue
  • 6,079
  • 3
  • 38
  • 62
  • Um, why do you need to pass this type around? – Nicol Bolas Apr 27 '16 at 14:20
  • 4
    Clearer code. Method reuse. The usual. I want to pass buffers into code from included files, and I want to avoid referencing global declarations. Nothing fancy, nothing I can't live without. – unexpectedvalue Apr 28 '16 at 06:45
  • 1
    Have you looked at texture buffer objects? There's a GL_TEXTURE_BUFFER target for buffers which makes 1D texture maps look like vertex buffers in the C/C++ side, but are accessed using standard texture code in the shaders. – Hugh Fisher Apr 29 '16 at 10:19

0 Answers0