[Mesa-dev] [Bug 101648] Adding a single-iteration do-while loop in a GLSL shader leads to a different image

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Jun 29 14:26:23 UTC 2017


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

            Bug ID: 101648
           Summary: Adding a single-iteration do-while loop in a GLSL
                    shader leads to a different image
           Product: Mesa
           Version: 17.1
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: h.evrard at imperial.ac.uk
        QA Contact: mesa-dev at lists.freedesktop.org

https://github.com/mc-imperial/shader-compiler-bugs/issues/75

Steps to Reproduce:
-------------------------------

0. This is reproducable with Mesa version 17.1.3, on Intel intergated GPUs.

1. Obtain and build the latest release of get-image-glsl, a simple tool
   that creates a .png image from a fragment shader. We need the
   `get_image_glfw` executable.
   https://github.com/graphicsfuzz/get-image-glsl

2. From a terminal, execute (this must be done in the directory where
   both .frag and .json files are):

   `/path/to/get_image_glfw original.frag`

   This will create output.png, which should look like original.png

3. From a terminal, execute (same remark as above):

   `/path/to/get_image_glfw variant.frag`

   This will create output.png, which should look like variant.png

Expected Results:
-------------------------------

Both shaders should render an image that looks like original.png.  This
is because the only difference between the .frag files is a 'do-while'
loop that should execute only once:

```
$ diff -u original.frag variant.frag
--- original.frag       2017-06-28 11:04:21.278754777 +0100
+++ variant.frag        2017-06-28 11:23:16.925591708 +0100
@@ -42,10 +42,12 @@
                 {
                     s += _FLOAT_CONST[2];
                 }
+            do {
             if(float(i) >= limit)
                 {
                     return s;
                 }
+            } while(gl_FragCoord.x < 0.0);
         }
     return s;
 }
```

Actual Results:
-------------------------------
The shaders render completely different images, which they should not.

Mesa code coverage:
-------------------------------
Unzip the `coverage.html.zip` file to get a web page that present the
comparative coverage of Mesa source code between the execution of the
original and the variant shader.

Additional Information:
-------------------------------
Some info on the system where the bug was found:

CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
GPU: "2nd Generation Core Processor Family Integrated Graphics Controller"
OS: Linux 4.8.0-56-generic #61~16.04.1-Ubuntu SMP
Mesa version: 17.1.3

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


More information about the mesa-dev mailing list