Is there a way before GL_ARB_program_interface to query the layout(binding = X) value

Simple question and I guess the answer is no. But maybe I overlooked something.

Is there any way before GL_ARB_program_interface_query (Core since 4.3) to query the binding that is set in the shader via layout(binding = X) for samplers/images/UBO?

For opaque types, the binding qualifier effectively sets the uniform’s value; that is, it does the equivalent of a glUniformi call. So the querying API is just querying the uniform’s value: glGetUniform. ARB_program_interface_query doesn’t provide a way to query that.

For uniform blocks, the binding qualifier is the equivalent of glUniformBlockBinding. And you retrieve that value with glGetActiveUniformBlockiv(program, block_index, GL_UNIFORM_BLOCK_BINDING, &value).

I got stuck in my memory that getUniform did not work for this. But after testing it does on all my current drivers. Must have being some rusty driver version issue. All works fine now, thanks!