[Mesa-dev] [PATCH 10/12] sso: update glGet: GL_PROGRAM_PIPELINE_BINDING

Ian Romanick idr at freedesktop.org
Tue May 28 13:16:46 PDT 2013


On 05/24/2013 01:17 PM, gregory hainaut wrote:
> On Sat, 4 May 2013 11:35:22 +0200
> gregory hainaut <gregory.hainaut at gmail.com> wrote:
>
>> On Fri, 3 May 2013 12:04:48 -0700
>> Matt Turner <mattst88 at gmail.com> wrote:
>>
>>> On Fri, May 3, 2013 at 10:44 AM, Gregory Hainaut
>>> <gregory.hainaut at gmail.com> wrote:
>>>> ---
>>>>   src/mesa/main/get.c              |    9 +++++++++
>>>>   src/mesa/main/get_hash_params.py |    3 +++
>>>>   2 files changed, 12 insertions(+)
>>>>
>>>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>>>> index 54159c0..6cbb7db 100644
>>>> --- a/src/mesa/main/get.c
>>>> +++ b/src/mesa/main/get.c
>>>> @@ -369,6 +369,7 @@ EXTRA_EXT(ARB_map_buffer_alignment);
>>>>   EXTRA_EXT(ARB_texture_cube_map_array);
>>>>   EXTRA_EXT(ARB_texture_buffer_range);
>>>>   EXTRA_EXT(ARB_texture_multisample);
>>>> +EXTRA_EXT(ARB_separate_shader_objects);
>>>>
>>>>   static const int
>>>>   extra_ARB_color_buffer_float_or_glcore[] = {
>>>> @@ -889,6 +890,14 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
>>>>            _mesa_problem(ctx, "driver doesn't implement GetTimestamp");
>>>>         }
>>>>         break;
>>>> +   /* GL_ARB_separate_shader_objects */
>>>> +   case GL_PROGRAM_PIPELINE_BINDING:
>>>> +      if (ctx->Pipeline.Current) {
>>>> +         v->value_int = ctx->Pipeline.Current->Name;
>>>> +      } else {
>>>> +         v->value_int = 0;
>>>> +      }
>>>> +      break;
>>>>      }
>>>>   }
>>>
>>> This looks believable, but I can't find a description in the extension
>>> spec or GL 4.1+ specs that say precisely what this query is supposed
>>> to do. Looks like it's just mentioned in the extension spec, and not
>>> at all in GL 4.1+ specs.
>>
>>
>> Yes you're right that strange. There is also a couple of line in glGet man page.
>>
>> GL_PROGRAM_PIPELINE_BINDING
>>
>>                          params a single value, the name of the currently bound program pipeline
>>                          object, or zero if no program pipeline object is bound.
>>                          See glBindProgramPipeline.
>>
>> Both Nvidia and AMD support this query. I did a quick update on my piglit test, on the AMD side:
>> * UseProgram(2)
>> * BindPipeline(5) (the pipeline isn't really bound because UseProgram got an higher priority)
>> * Get GL_PROGRAM_PIPELINE_BINDING => 5
>>
>> I will try to check the behavior on Nvidia implementation.
>
> Nvidia implementation "is" this one:
>        if (ctx->_Shader) {
>           v->value_int = ctx->_Shader->Name;
>        } else {
>           v->value_int = 0;
>        }
>
> So on my previous example
> * UseProgram(2)
> * BindPipeline(5)
> * Get GL_PROGRAM_PIPELINE_BINDING => 0
>
> There is no spec but the SSO spec was written by Nvidia so I would say that Nvidia is correct.

In the OpenGL 4.3 spec, table 23.32 says, "Current program pipeline 
object binding."  It then refers to section 7.4.  Section 7.4 says 
glBindProgramPipeline sets the current pipeline object binding, but 
(paraphrasing) the programs in that pipeline may not be used for 
rendering or glUniform calls.

     "If there is a current program object established by UseProgram,
     the bound program pipeline object has no effect on rendering or
     uniform updates. When a bound program pipeline object is used
     for rendering, individual shader executables are taken from its
     program objects as described in the discussion of UseProgram in
     section 7.3)."

I believe the patch is correct as-is: always return the binding if there 
is one.  I've submitted a spec bug that the behavior is underspecified.

>>>> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
>>>> index 2b97da6..43a11cf 100644
>>>> --- a/src/mesa/main/get_hash_params.py
>>>> +++ b/src/mesa/main/get_hash_params.py
>>>> @@ -709,6 +709,9 @@ descriptor=[
>>>>
>>>>   # GL_ARB_texture_cube_map_array
>>>>     [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ],
>>>> +
>>>> +# GL_ARB_separate_shader_objects
>>>> +  [ "PROGRAM_PIPELINE_BINDING", "LOC_CUSTOM, TYPE_INT, GL_PROGRAM_PIPELINE_BINDING, extra_ARB_separate_shader_objects" ],
>>>>   ]},
>>>>
>>>>   # Enums restricted to OpenGL Core profile
>>>> --
>>>> 1.7.10.4
>>>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list