<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Shader cache gives spurious linking errors on sharing between contexts of different versions"
href="https://bugs.freedesktop.org/show_bug.cgi?id=110872">110872</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Shader cache gives spurious linking errors on sharing between contexts of different versions
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>git
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>glsl-compiler
</td>
</tr>
<tr>
<th>Assignee</th>
<td>mesa-dev@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sgunderson@bigfoot.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>intel-3d-bugs@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>Hi,
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
already.)
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>