| Summary: | Linking GLSL 1.30 shaders with invariant and deprecated variables triggers an 'mismatching invariant qualifiers' error | ||
|---|---|---|---|
| Product: | Mesa | Reporter: | Olivier Lauffenburger <o.lauffenburger> |
| Component: | glsl-compiler | Assignee: | mesa-dev |
| Status: | RESOLVED FIXED | QA Contact: | Intel 3D Bugs Mailing List <intel-3d-bugs> |
| Severity: | normal | ||
| Priority: | medium | CC: | danylo.piliaiev, metalcaedes |
| Version: | 17.2 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| i915 platform: | i915 features: | ||
I ran into the same bug, on Ubuntu 17.04 with both Mesa 17.0.7-0ubuntu0.17.04.1 and 17.2.2+git20171019+17.2.23c08dab-0ubuntu0ricotz~17.04.1 (from the xorg-edgers ppa). I have observed this bug both with Intel (Iris Pro 5200) and AMD (Radeon R7 370) GPUs. It doesn't only happen with deprecated variables, but also when using a OpenGL core (3.2) context and corresponding shaders, by adding "invariant gl_Position;" to a vertex shader (doesn't seem to affect all vertex shaders, though). It can be reproduced with this branch of Yamagi Quake2: https://github.com/DanielGibson/yquake2/tree/mesa-100316 (start with ./quake2 +set vid_renderer gl3) The corresponding source is: https://github.com/DanielGibson/yquake2/blob/mesa-100316/src/client/refresh/gl3/gl3_shaders.c#L328-L329 (https://github.com/DanielGibson/yquake2/blob/mesa-100316/src/client/refresh/gl3/gl3_shaders.c#L261-L288 is also part of the shader) When adding "invariant gl_Position;" into my simpler vertexSrc2D shader (https://github.com/DanielGibson/yquake2/blob/mesa-100316/src/client/refresh/gl3/gl3_shaders.c#L166), it does not create an error there. As Olivier wrote, compiling the shader gives no errors, but linking the vertex- and fragment-shaders into a program fails. The error message doesn't even mention gl_Position directly, but some other variable (in my case "error: declarations for uniform `transModel' have mismatching invariant qualifiers") - but when commenting the "invariant gl_Position;" line out, it works. We're hitting the same issue with `invariant gl_Position;` (as described by Daniel in comment 1) in Godot Engine, at least for AMD hardware. Godot uses OpenGL 3.3 Core Profile: https://github.com/godotengine/godot/issues/13450 I've sent the patch for more general manifestation of the issue: https://patchwork.freedesktop.org/patch/247067/ (In reply to Danylo from comment #3) > I've sent the patch for more general manifestation of the issue: > https://patchwork.freedesktop.org/patch/247067/ Just noting that Danylo submitted a merge request for this patch: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/84 Fixed by Danylo in:
commit ea9bde151f1394ff82b73d028c2a3a747723e525
glsl: Cross validate variable's invariance by explicit invariance only
|
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.
I have the following GLSL 1.30 vertex and pixel shaders: * Vertex shader: #version 130 flat out vec4 triangleColor; invariant gl_Position; void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex; triangleColor = vec4(1.0, 1.0, 0.0, 1.0); } * Fragment shader: #version 130 precision highp float; flat in vec4 triangleColor; void main() { gl_FragColor = gl_Color * triangleColor; } Compilation is OK but linking fails with error: error: declarations for uniform `gl_ModelViewProjectionMatrix' have mismatching invariant qualifiers Slightly different vertex shaders can produce the error: error: declarations for shader input `gl_Vertex' have mismatching invariant qualifiers There is no linking error anymore when I remove the "invariant gl_Position;" declaration. Given that gl_Vertex and gl_ModelViewProjectionMatrix are not output variables for vertex shaders, I suppose that this behavior is not expected. This error occurs with Mesa 17.0.2.