• Ian Romanick's avatar
    glsl-1.30: Test interpolation qualifiers on built-in variables · d427fcfc
    Ian Romanick authored
    Section 4.3.7 (Interpolation) of the GLSL 1.30 spec says:
    
        "If gl_Color is redeclared with an interpolation qualifier, then
        gl_FrontColor and gl_BackColor (if they are written to) must also be
        redeclared with the same interpolation qualifier, and vice versa. If
        gl_SecondaryColor is redeclared with an interpolation qualifier,
        then gl_FrontSecondaryColor and gl_BackSecondaryColor (if they are
        written to) must also be redeclared with the same interpolation
        qualifier, and vice versa. This qualifier matching on predeclared
        variables is only required for variables that are statically used
        within the shaders in a program."
    
    This adds five sets of tests from a single generator script:
    
        - Set an interpolation qualifier, possibly the default, for one of
          gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or
          gl_BackSecondaryColor in the vertex shader, and set a different
          interpolation qualifier, possibly the default, for the matching
          gl_Color or gl_SecondaryColor in the fragment shader.  This should
          fail to link.
    
        - Set a non-default interpolation qualifier for one of
          gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or
          gl_BackSecondaryColor in the vertex shader, and have no
          redeclaration in the fragment shader.  In the fragment shader,
          neither gl_Color nor gl_SecondaryColor is used.  This should
          successfully link.
    
        - Set a non-default interpolation qualifier for one of gl_Color or
          gl_SecondaryColor in the fragment shader, and have no
          redeclaration in the vertex shader.  In the vertex shader, none of
          the built-in color variables are used.  This should successfully
          link.
    
        - Set an interpolation qualifier, possibly the default, for one of
          gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, or
          gl_BackSecondaryColor in the vertex shader, and set a different
          interpolation qualifier, possibly the default, for the matching
          gl_Color or gl_SecondaryColor in the fragment shader.  Neither
          stage uses any of the color variables.  This should successfully
          to link.
    
        - Set conflicting interpolation qualifiers for gl_FrontColor /
          gl_BackColor or gl_FrontSecondaryColor / gl_BackSecondaryColor in
          the vertex shader, and set a matching interpolation qualifier on
          gl_Color or gl_SecondaryColor in the fragment shader for one of
          the vertex shader built-in varaibles.  This should fail to link.
    
    On Mesa, all of the tests that expect linking failures fail.  Basically,
    Mesa's linker accepts everything.
    
    NVIDIA (304.64 on GTX 260) fails the same set of tests.
    
    v2: Use Python lists instead of "set literal" syntax (Python 2.7+ only).
    Change the names of several maps to include the suffix _map.  Rename
    some additional varibles that had a misleading "front" or "back" in the
    name.  All changes suggested by Paul.
    Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47755Reviewed-by: Paul Berry's avatarPaul Berry <stereotype441@gmail.com>
    d427fcfc
interpolation-qualifier-built-in-variable.py 15.1 KB