Two pass rendering using different SSBOs with the same binding point

Hi, guys!

I try to implement two pass rendering:

    • all static objects from prepared SSBO with them.
    • fill another SSBO with dynamic objects and use it.

So, I try to use the same shaders for it and of cource the same binding point:


#version 430

layout (location=0) in vec3 position;


uniform mat4 projLightViewMatrix;

struct VertexUniform {
  mat4 modelMatrix;
};

layout (std430, binding = 0) buffer VertexUniformBlock {
  VertexUniform vertexUniform[];
};


void main() {
    gl_Position = projLightViewMatrix * vertexUniform[gl_InstanceID].modelMatrix * vec4(position, 1.0f);
}

bind to binding point:


    glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferId);
    glBindBufferBase(GL_SHADER_STORAGE_BUFFER, bindingPoint, bufferId);

How can I release that bindingPoint for using it in the second pass with other SSBO?

Thanks for answer. :slight_smile:

I think I will bind both of SSBOs at the same time.
While rendering I send maxStaticObjectNumber to shader and define which SSBO I should use at the time.

Such way is more efficient then two pass rendering I think.