2
votes

I was reading the documentation on glBindBuffer when I saw this:

Likewise, the GL_UNIFORM_BUFFER, GL_ATOMIC_COUNTER_BUFFER and GL_SHADER_STORAGE_BUFFER buffer binding points may be used, but do not directly affect uniform buffer, atomic counter buffer or shader storage buffer state, respectively.

What does "do not directly affect uniform buffer, atomic counter buffer or shader storage buffer state" mean?

I bound a buffer to the generic GL_SHADER_STORAGE_BUFFER binding point, and when querying for the state of SHADER_STORAGE_BUFFER_BINDING, the previously bound buffer name is returned.

On this site describing the shader_storage_buffer_object extension, it states that SHADER_STORAGE_BUFFER_BINDING is part of the shader storage buffer state.

Therefore I believe that using glBindBuffer on a generic binding point (such as GL_SHADER_STORAGE_BUFFER) does indeed affect the shader storage buffer state.

1

1 Answers

2
votes

Yes obviously, if you bind the buffers to the context, you can query those bind points. But the point the docs is trying to get across is that those binding points don't mean anything.

Consider GL_COPY_READ_BUFFER. Binding to this target means something. If you call glCopyBufferSubData, it will use the buffer bound to GL_COPY_READ_BUFFER as the source buffer for that copy operation.

By contrast, there is no OpenGL operation that will use the buffer bound to GL_SHADER_STORAGE_BUFFER for any actual OpenGL operations. Sure, you can query it, but that's all you can do with it. If you want to use a buffer for actual storage buffer operations, you must use glBindBufferRange/Base or equivalent functions.