QT5 - OpenGL - Compute Shader - "no buffers available for bindable storage buffer"
I'm using Qt5 for convenience in my OpenGL programs. Recently I tried to use Compute Shader and got stuck with a shader program linking error.
@QOpenGLShader::link: "Compute info
0(21) : error C5058: no buffers available for bindable storage buffer@
The compilation passed.
I dare say I'm in a OpenGL 4.3 context as :
@m_pFunctions = p_context->versionFunctions<QOpenGLFunctions_4_3_Core>();@
returns a valid pointer that I can use.
As the error say, I'm using shader storage blocks in my shader and it seems to be the problem.
I do believe the problem is the limitation in number of bindable buffers. If I only use 2 buffers in the shader, the linking goes smoothly. If I define my shader as originally planned, 54 buffers (2 groups of 27), 11 couldn't be bound in the first gorup and 1 in the second.
However, at run time, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 96.
I have two ideas on the problem source :
A previous linking failed and the bindings haven't been released. 96 - 54 = 42. If I try to bind once again 54 buffer, I will have 12 buffers without space for binding, which is my problem.
Since this is fairly new to Qt, maybe in the linking code (I use QOpenGLShaderProgram, so it's out of my scope) twice the amount of required buffers are linked, with a specific reason or a mistake.
Any idea on how to fix my issue ? (And no questions on the usage of 54 buffers, this is not the subject here).