[Mesa-dev] [WIP 11/13] glsl: parser changes for GL_ARB_explicit_uniform_location

Ian Romanick idr at freedesktop.org
Fri Apr 4 14:58:59 PDT 2014


On 04/04/2014 02:51 PM, Matt Turner wrote:
> On Fri, Apr 4, 2014 at 2:42 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 03/27/2014 11:45 PM, Tapani Pälli wrote:
>>> Patch adds a preprocessor define for the extension and stores
>>> explicit location data for uniforms during AST->HIR conversion.
>>> It also sets layout token to be available when having the
>>> extension in place.
>>>
>>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>>> ---
>>>  src/glsl/ast_to_hir.cpp      | 13 +++++++++++++
>>>  src/glsl/glcpp/glcpp-parse.y |  3 +++
>>>  src/glsl/glsl_lexer.ll       |  1 +
>>>  3 files changed, 17 insertions(+)
>>>
>>> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
>>> index 8f6e901..3bfad02 100644
>>> --- a/src/glsl/ast_to_hir.cpp
>>> +++ b/src/glsl/ast_to_hir.cpp
>>> @@ -2123,6 +2123,19 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
>>>  {
>>>     bool fail = false;
>>>
>>> +   /* Checks for GL_ARB_explicit_uniform_location. */
>>> +   if (qual->flags.q.uniform) {
>>> +
>>> +      if (qual->index < 0) {
>>> +         _mesa_glsl_error(loc, state,
>>> +                          "explicit location < 0 for uniform %s", var->name);
>>
>> We also need to check that the explicit location isn't too large.  I
>> don't think that check can happen here because (I think) it will depend
>> on the size of the uniform.  The spec isn't completely clear, but I think
>>
>> // assume GL_MAX_UNIFORM_LOCATIONS is 65536
>> layout(location=65535) float foo[1];
> 
> I think you mean foo[2]?

Right.



More information about the mesa-dev mailing list