Bug 29793 - [glsl2]piglit glslparsertest_glsl2_struct-05.vert and glslparsertest_glsl2_redeclaration-02.vert fail
Summary: [glsl2]piglit glslparsertest_glsl2_struct-05.vert and glslparsertest_glsl2_re...
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-25 01:53 UTC by fangxun
Modified: 2010-08-31 18:57 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
dmesg info (1.57 KB, text/plain)
2010-08-25 01:54 UTC, fangxun
Details

Description fangxun 2010-08-25 01:53:13 UTC
System Environment:
--------------------------
Arch    x86_64
Platform    piketon
Libdrm:         (master)2.4.21-16-gb61e81a191d3a5c269c5f7c40199aebc9ebc034c
Mesa:           (master)c8b26c63fdad84d311748a24972146b6a371ab31
Xserver:                (master)xorg-server-1.9.0
Xf86_video_intel:   (master)2.12.0-73-g104cd0554bde1d109a54db7a93700d5edfabd914
Kernel: (for-linus)76be97c1fc945db08aae1f1b746012662d643e97


Bug detailed description:
-------------------------
glslparsertest_glsl2_struct-05.vert and glslparsertest_glsl2_redeclaration-02.vert fail after update following piglit commit.

commit 51e07b4ed94084b875e18d34a86a4977d03fa878
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sun Aug 22 02:37:18 2010 -0700

    Add more redeclaration tests; fix redeclaration-02 and struct-05.

    In 1.10, variables and functions have separate name spaces, so both can
    be declared in the same scope, and variables do not hide functions.
    This means that redeclaration-02.vert should pass, not fail.  However,
    structures conflict with both variables and functions, so struct-05.vert
    should fail.

    In 1.20, functions, types, and variables all share the same namespace.
    Thus, declaring any two in the same scope is an error (aside from
    function overloading).  Also, declaring a name hides declarations of
    _any_ kind in an outer scope.

    Issues 22-28 in the GLSL 1.20 specification shed a lot of light on
    the scoping rules (though it's still not 100% clear).

    Also, according to the 1.20 spec, built-ins live in a special scope
    beyond a shader's global scope.


Reproduce steps:
----------------
1.xinit& 
2.glslparsertest struct-05.vert fail 1.10 
  glslparsertest redeclaration-02.vert pass 1.10
Comment 1 fangxun 2010-08-25 01:54:15 UTC
Created attachment 38137 [details]
dmesg info
Comment 2 Ian Romanick 2010-08-26 09:43:21 UTC
These failures are fixed by this patch sequence:

commit a044285e25615f2d97636fe3ba47d580c3537bc4
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Aug 23 14:52:06 2010 -0700

    glsl: Move built-ins to live beyond the global scope.
    
    Per the GLSL 1.20 specification (presumably a clarification of 1.10).
    
    Also, when creating user functions, make a new ir_function that shadows the
    built-in ir_function, rather than adding new signatures.  User functions
    are supposed to hide built-ins, not overload them.
    
    Fixes piglit tests redeclaration-{04, 12, 14}.vert.

commit b6f15869b324ae64a00d0fe46fa3c8c62c1edb6c
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Aug 20 20:04:39 2010 -0700

    glsl: Move is_built_in flag from ir_function_signature to ir_function.
    
    Also rename it to "is_builtin" for consistency.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

commit 5d25746640ee27882b69a962459727cf924443db
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Tue Aug 24 01:45:49 2010 -0700

    glsl: Refactor variable declaration handling.
    
    Moving the check for an earlier variable declaration helps cleanly
    separate out the re-declaration vs. new declaration code a bit.  With
    that in place, conflicts between variable names and structure types or
    function names aren't caught by the earlier "redeclaration" error
    message, so check the return type on glsl_symbol_table::add_variable
    and issue an error there.  If one occurs, don't emit the initializer.
    
    Fixes redeclaration-01.vert and redeclaration-09.vert.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

commit ac2376e6f51677ab321930b0200a79d1683cfbba
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Wed Aug 25 17:10:16 2010 -0700

    glsl: Don't add overloads to existing structure constructors.
    
    Instead, make a new ir_function and try to add it to the symbol table.
    
    Fixes piglit test redeclaration-08.vert.

commit e09591317b2470fe9c104606577d4e10255727c0
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Wed Aug 25 16:37:46 2010 -0700

    glsl: Remove name_declared_this_scope check when adding functions.
    
    Instead, rely on the symbol table's rules.
    
    Fixes redeclaration-02.vert.

commit e9c7ceed27f6811ad1cae46c93ce9bc3fb3668d8
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sat Aug 21 20:23:18 2010 -0700

    glsl: Use a single shared namespace in the symbol table.
    
    As of 1.20, variable names, function names, and structure type names all
    share a single namespace, and should conflict with one another in the
    same scope, or hide each other in nested scopes.
    
    However, in 1.10, variables and functions can share the same name in the
    same scope.  Structure types, however, conflict with/hide both.
    
    Fixes piglit tests redeclaration-06.vert, redeclaration-11.vert,
    redeclaration-19.vert, and struct-05.vert.
Comment 3 fangxun 2010-08-31 18:57:56 UTC
It works fine now. Mark it as verified.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.