Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

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

  1. #1
    Junior Member Regular Contributor
    Join Date
    May 2013
    Posts
    148

    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?

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,087
    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)`.

  3. #3
    Junior Member Regular Contributor
    Join Date
    May 2013
    Posts
    148
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •