[Bug 105731] linker error "fragment shader input ... has no matching output in the previous stage" when previous stage's output declaration in a separate shader object

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Mar 24 18:14:23 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=105731

            Bug ID: 105731
           Summary: linker error "fragment shader input ... has no
                    matching output in the previous stage" when previous
                    stage's output declaration in a separate shader object
           Product: Mesa
           Version: git
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: minor
          Priority: medium
         Component: glsl-compiler
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: quisquilia at gmx.de
        QA Contact: intel-3d-bugs at lists.freedesktop.org

Created attachment 138342
  --> https://bugs.freedesktop.org/attachment.cgi?id=138342&action=edit
C/OpenGL code to trigger the issue

GLSL spec (using version 4.30 here, section "4.3.4 Input variables", page 43f)
states that there should be no link error if an input variable is used for
which there is no static use in the previous stage, but a valid output
declaration.

Mesa's linker seems to adhere to this not in every case. If the declaration is
in a separate shader object, it fails to link. See the attached example code.
The key point is the following vertex shader:

    static const char *vs_part1=
        "out vec4 foo;\n"
        "void unused() {foo=vec4(1);}\n";

    static const char *vs_part2=
        "in vec4 pos;\n"
        "void main() { gl_Position = pos; }\n";

used in conjunction with this fragment shader:
    static const char *fs_part1=
        "in vec4 foo;\n"
        "out vec4 color;\n"
        "void main() {color=foo;}\n";

When this is created as a single GL_VERTEX_SHADER with both strings
concatenated (via glShaderSource), the resulting program will link, just with a
warning

    warning: fragment shader varying foo not written by vertex shader

which is conforming behavior.

However, when vs_part1 and vs_part2 are compiled as separate shader objects,
the final link fails with

    error: fragment shader input `foo' has no matching output in the previous 
           stage

which (in my interpretation of the spec) should not happen.

Tested with:
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.1.1
(git-092c485)

as well as:
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.1.0-devel
(git-ff0e3fa1fe)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20180324/623d47ef/attachment.html>


More information about the intel-3d-bugs mailing list