Bug 47755 - [glsl-compiler] no error checking when Interpolation qualifier for built-in variable is different in vertex and fragment shader
Summary: [glsl-compiler] no error checking when Interpolation qualifier for built-in v...
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: All Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-23 02:27 UTC by fangxun
Modified: 2014-07-17 09:31 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
piglit case glsl-q-interpol_negative.builtin.missmatch (1.54 KB, text/plain)
2012-03-23 02:27 UTC, fangxun
Details

Description fangxun 2012-03-23 02:27:02 UTC
Created attachment 58905 [details]
piglit case glsl-q-interpol_negative.builtin.missmatch

System Environment:
--------------------------
Libdrm:         (master)2.4.32-1-gc50cc24690938db53cd91ae9ff2fa0958693f80d
Mesa:           (master)e07b1603e24ddd21a61b11390712c4b39d6a3c5c
Xserver: (master)xorg-server-1.12.0-5-gab3a815a75ab5695753fa37a98b0ea5293d4cb91
Xf86_video_intel:  (master)2.18.0-138-g52f39ae1697bef86471b7c5eef8553661f255b67
Kernel: (drm-intel-next-queued)fa37d39e4c6622d80bd8061d600701bcea1d6870

Bug detailed description:
-------------------------
According to the spec:  
“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”,
Our glsl compiler has no error checking when they are missing match.
This is the root cause that make following oglc cases failed.
glsl-q-interpol(negative.builtin.missmatch) 
glsl-q-interpol(negative.builtin.nofrag)
glsl-q-interpol(negative.builtin.novertex)
glsl-q-interpol(negative.builtin.onlyfrag)
glsl-q-interpol(negative.builtin.vxmissmatch)
Comment 1 Ian Romanick 2012-05-31 20:38:34 UTC
Tests for failed linking should look like tests/shaders/link-mismatch-layout-01.c.  This test should go in tests/spec/glsl-1.30/linker/interpolation-qualifier.  Can you make these changes and post the test to the piglit mailing list for review?
Comment 2 Ian Romanick 2013-09-05 17:25:18 UTC
This should be fixed by the following commit.  Since this causes shaders that would have previously linked to fail, this change will *NOT* be cherry picked to any stable branches.

commit 0851aa73659f894e6b54e3ef272c1fa360165128
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Fri Aug 30 15:42:01 2013 -0700

    glsl: Validate qualifiers on VS color outputs with FS color inputs
    
    The vertex shader color outputs (gl_FrontColor, gl_BackColor,
    gl_FrontSecondaryColor, and gl_BackSecondaryColor) don't have the same
    names as the matching fragment shader color inputs (gl_Color and
    gl_SecondaryColor).  As a result, the qualifiers on them were not being
    properly cross validated.
    
    Full spec compliance required ir_variable::used and
    ir_variable::assigned be set properly.  Without the preceeding patch,
    which fixes the ::clone method to copy them, this will not be the case.
    
    Fixes all of the previously failing piglit
    spec/glsl-1.30/linker/interpolation-qualifiers tests.
    
    v2: Update callers of cross_validate_types_and_qualifiers and
    cross_validate_front_and_back_color.  The function signature changed in
    v2 of a previous patch.  Suggested by Paul.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Paul Berry <stereotype441@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47755
Comment 3 fangxun 2014-07-17 09:31:08 UTC
Verified it on latest mesa master and 10.2 branch.


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.