6

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.

3
  • Um, why do you need to pass this type around? Commented Apr 27, 2016 at 14:20
  • 5
    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. Commented Apr 28, 2016 at 6: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. Commented Apr 29, 2016 at 10:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.