[Mesa-dev] [Bug 110872] Shader cache gives spurious linking errors on sharing between contexts of different versions

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jun 10 09:40:30 UTC 2019


            Bug ID: 110872
           Summary: Shader cache gives spurious linking errors on sharing
                    between contexts of different versions
           Product: Mesa
           Version: git
          Hardware: x86-64 (AMD64)
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: glsl-compiler
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: sgunderson at bigfoot.com
        QA Contact: intel-3d-bugs at lists.freedesktop.org


I've got an application that runs an OpenGL 4.5 core context (let's call it
context A), and then due to some Qt issues, ends up creating an OpenGL 2.0
context (context B) that's sharing with A.

The bug goes about as follows, if I have my thoughts ordered correctly:

1. A compiles a vertex shader 1 (#version 150) and a fragment shader 2, and
links it into a program 3. Mesa looks into its GLSL cache index, and figures
that compilation succeeded once, so glCompileShader() returns true without even
checking. (However, 1 and 2 have actually disappeared out of the cache
2. B wants to use 3, but can't since it's in use by some other thread and that
might disturb its uniforms (I can't use UBOs, since they're very slow in Mesa
on Haswell), so it asks to re-link 1+2 into a new program.
3. Mesa notices that it needs to _actually_ compile 1+2, since it can't find
them in the disk cache. However, it does so in the context of B, which can't
handle #version 150 programs. The compilation fails with a syntax error, but
nothing in Mesa actually checks the return value.
4. Mesa tries to link 1+2, even though both failed and thus are empty
internally. The error it returns is

Error linking program: error: vertex shader lacks `main'

which is an obviously bogus error.

It's unclear from the spec what should happen, but given that 1 and 2 were
compiled in the context of A, I would say that linking them in B should be
legal, and it does work if I disable the cache (export
MESA_GLSL_CACHE_DISABLE=1). At the very least, it shouldn't complain about the
lack of main when main is indeed there.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190610/e269a641/attachment-0001.html>

More information about the mesa-dev mailing list