[Mesa-dev] [Bug 110953] Adding a redundant single-iteration do-while loop causes different image to be rendered

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Jun 20 17:18:42 UTC 2019


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

            Bug ID: 110953
           Summary: Adding a redundant single-iteration do-while loop
                    causes different image to be rendered
           Product: Mesa
           Version: git
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: glsl-compiler
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: abelbriggs1 at hotmail.com
        QA Contact: intel-3d-bugs at lists.freedesktop.org

Created attachment 144602
  --> https://bugs.freedesktop.org/attachment.cgi?id=144602&action=edit
piglit shader tests, images, diff

Similar bug reproduced with Intel i965 that was resolved as fixed:
https://bugs.freedesktop.org/show_bug.cgi?id=100303

I'm unsure if the error reproduced with the enclosed shaders occur on AMD/Intel
- please feel free to move this if it can't be reproduced.

The attached archive contains two shaders, a reference shader and a variant
shader, that by construction should render the same image. On the build and PC
specified below, however, these shaders render different images. Images of the
shaders’ output are also supplied in the archive, as well as the minor diff
between the source code of the two shaders.

The difference between the two shaders is that the variant wraps a
single-iteration do-while loop around existing code.

46c46
<       do
---
>        if(doSwap)
48,53c48,50
<        if(doSwap)
<         {
<             float temp = data[i];
<             data[i] = data[j];
<             data[j] = temp;
<         }
---
>        float temp = data[i];
>        data[i] = data[j];
>        data[j] = temp;
55d51
<      while(false);

Steps to reproduce:
-------------------------------------------------------------------------------
1. Obtain and build piglit, the Mesa OpenGL test suite runner:
https://gitlab.freedesktop.org/mesa/piglit
2. Download the attached archive.
3. From a terminal, execute the supplied tests with the piglit GLES3 shader
runner: 
$ bin/shader_runner_gles3 reference.shader_test
$ bin/shader_runner_gles3 variant.shader_test

Expected results:
-------------------------------------------------------------------------------
Both images should produce an image like reference.png, and so both tests
should pass. If both fail, it’s likely due to floating point errors that can
affect the precise color values - if this is the case, please manually observe
that the shader images have significant differences that are not limited to
minor floating point variation.

Actual results:
-------------------------------------------------------------------------------
The variant produces a different image (and fails the test) even though it
should run exactly the same as the reference shader. This is because the only
difference between the reference and variant shaders is that the variant shader
wraps a single-iteration do-while loop around existing code, which makes no
semantic difference between the two shaders.

Build & PC specs:
-------------------------------------------------------------------------------
CPU: Intel Core i7-5820k 
GPU: nVIDIA GTX 970

OS: Ubuntu 19.04
libdrm: git-5db0f7692d1fdf05f9f6c0c02ffa5a5f4379c1f3 (most recent as of this
writing)
Mesa: git-9c19d07b1cdcd22ced0f4e1c147e496b6ff5cf23 (most recent as of this
writing)
Xf86-video-nouveau: 1.0.16
Linux kernel version: 5.0.0-16-generic

This bug was found with GraphicsFuzz: https://github.com/google/graphicsfuzz

-- 
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/20190620/49a486f1/attachment.html>


More information about the mesa-dev mailing list