[Mesa-dev] [PATCH] glsl: add stage references for UBO uniforms

Samuel Iglesias Gonsálvez siglesias at igalia.com
Wed May 13 00:35:32 PDT 2015



On 13/05/15 07:28, Tapani Pälli wrote:
> 
> 
> On 05/13/2015 08:02 AM, Samuel Iglesias Gonsálvez wrote:
>> Thanks Tapani!
>>
>> Reviewed-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
>>
>> Can you add a test to piglit to check this case?
> 
> I was hoping you had some test that hit this? :) I'll take a look if
> existing tests can be modified easily to cover this case.
> 

I have one test for SSBOs which also hit this. If you are busy, just let
me know and I will modify an existing test.

Thanks,

Sam

> 
>> Sam
>>
>> On 11/05/15 12:24, Tapani Pälli wrote:
>>> Patch marks uniforms inside UBO properly referenced by stages.
>>>
>>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90397
>>> ---
>>>   src/glsl/linker.cpp | 10 ++++++++++
>>>   1 file changed, 10 insertions(+)
>>>
>>> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>>> index ea73c6f..ecdc025 100644
>>> --- a/src/glsl/linker.cpp
>>> +++ b/src/glsl/linker.cpp
>>> @@ -2700,6 +2700,16 @@ build_program_resource_list(struct gl_context
>>> *ctx,
>>>
>>>         uint8_t stageref =
>>>            build_stageref(shProg, shProg->UniformStorage[i].name);
>>> +
>>> +      /* Add stagereferences for uniforms in a uniform block. */
>>> +      int block_index = shProg->UniformStorage[i].block_index;
>>> +      if (block_index != -1) {
>>> +         for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
>>> +             if (shProg->UniformBlockStageIndex[j][block_index] != -1)
>>> +                stageref |= (1 << j);
>>> +         }
>>> +      }
>>> +
>>>         if (!add_program_resource(shProg, GL_UNIFORM,
>>>                                   &shProg->UniformStorage[i], stageref))
>>>            return;
>>>
> 


More information about the mesa-dev mailing list