[Bug 103955] Using array in structure results in wrong GLSL compilation output

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Nov 28 14:08:38 UTC 2017


            Bug ID: 103955
           Summary: Using array in structure results in wrong GLSL
                    compilation output
           Product: Mesa
           Version: 17.3
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: minor
          Priority: medium
         Component: glsl-compiler
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: mieabby at gmail.com
        QA Contact: intel-3d-bugs at lists.freedesktop.org

Created attachment 135756
  --> https://bugs.freedesktop.org/attachment.cgi?id=135756&action=edit
Windows port of the test program

Declaring a uniform structure, whose one member is an array of float, results
in wrong shader code. Consider the following fragment shader:

        struct Set {
                vec3 color;
                float arr[3];

        uniform Set u_s;

        void main () {
                gl_FragColor = vec4(u_s.color * u_s.arr[0], 1.0);
                // gl_FragColor = vec4(u_s.color * vec3(1.0, 0.0, 0.0), 1.0);

This fragment shader should output FragColor of white(that is `vec4(1.0, 1.0,
1.0, 1.0)`) if the value of `u_s.arr[0]` is 1.0. However, the shader compiled
by Mesa driver produces `vec4(1.0, 0.0, 0.0, ?)`, which is red. The alpha
component is disregarded since GL_BLEND is disabled in the test application.

I wanted to know if this bug is hardware related. The attachment is the
makeshift test program I wrote with an existing example(in the courtesy of
opengl-tutorial.org) to demonstrate the bug. I found this bug when I was
developing a WebGL web app, so I wrote the test web page as well.


I also ported the test program to Windows. The bug is not reproducible on
Windows in whichever way.

On Linux running the Mesa driver, Firefox, Google Chrome displays a red
framebuffer. The bug is still seen running the browsers/test app with
`LIBGL_ALWAYS_SOFTWARE=1`, except for Chrome[1]

I'd also like to mention that I ran the test program and the web page with
`MESA_GLSL=dump`, `MESA_GLSL=uniform` to see if there's any form of "shader
source translation" like ANGLE does on Windows. The dump of the source code and
uniform upload were identical.

The bug is still there on 17.3.0-rc5 and 17.2.6.

Chrome browser defaults to its own software renderer when a slower renderer(SW
or VBox GPU) is detected. The canvas is white with that renderer.

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/20171128/bdbe84ec/attachment.html>

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