From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 100303] Adding a single, meaningless if-else to a shader source leads to different image Date: Tue, 21 Mar 2017 15:07:49 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2041574581==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FE066E6FE for ; Tue, 21 Mar 2017 15:07:49 +0000 (UTC) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============2041574581== Content-Type: multipart/alternative; boundary="14901088690.12Fd4ABB7.25961"; charset="UTF-8" --14901088690.12Fd4ABB7.25961 Date: Tue, 21 Mar 2017 15:07:49 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D100303 Bug ID: 100303 Summary: Adding a single, meaningless if-else to a shader source leads to different image Product: Mesa Version: git Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel@lists.freedesktop.org Reporter: h.evrard@imperial.ac.uk QA Contact: dri-devel@lists.freedesktop.org Created attachment 130352 --> https://bugs.freedesktop.org/attachment.cgi?id=3D130352&action=3Dedit Zip archive with files to reproduce See: https://github.com/mc-imperial/shader-compiler-bugs/issues/62 Steps to Reproduce: ------------------------------- 0. This bug seems to affect AMD GPU (tested on Tonga, see below for more config details) 1. Obtain and build the latest release of get-image, a simple tool that creates a .png image from a fragment shader https://github.com/mc-imperial/get-image 2. From a terminal, execute: /path/to/get_image/linux_out/install/bin/get_image original.frag This will create output.png, which should look like original.png 3. From a terminal, execute: /path/to/get_image/linux_out/install/bin/get_image 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 shader source files is the addition of an if-else whose if block is empty and else block contains the original code. We control the condition value to make sure it is always false at runtime. Diff: ``` 27a28,29 > uniform vec2 injectionSwitch; > 117a120,124 > if(injectionSwitch.x > injectionSwitch.y) > { > } > else > { 129a137 > } ``` The injectionSwitch uniform is always set to { 0.0, 1.0 }. The else block contains the original code, untouched. Actual Results: ------------------------------- The shaders render different images, which they should not: the shadow in the lower part of the ball disappears in the variant. Additional Information: ------------------------------- Some info on the system where the bug was found: - CPU: AMD A10-7850K Radeon R7, 12 Compute Cores 4C+8G - GPU: Advanced Micro Devices, Inc. [AMD/ATI] Tonga PRO [Radeon R9 285/380] - Mesa: 17.1.0-devel (git-08df015) - OS: Ubuntu 16.04, Linux 4.4.0-67-generic --=20 You are receiving this mail because: You are the assignee for the bug.= --14901088690.12Fd4ABB7.25961 Date: Tue, 21 Mar 2017 15:07:49 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated
Bug ID 100303
Summary Adding a single, meaningless if-else to a shader source leads= to different image
Product Mesa
Version git
Hardware x86-64 (AMD64)
OS Linux (All)
Status NEW
Severity normal
Priority medium
Component Drivers/Gallium/radeonsi
Assignee dri-devel@lists.freedesktop.org
Reporter h.evrard@imperial.ac.uk
QA Contact dri-devel@lists.freedesktop.org

Created atta=
chment 130352 [details]
Zip archive with files to reproduce

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

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

0. This bug seems to affect AMD GPU (tested on Tonga, see below for
   more config details)

1. Obtain and build the latest release of get-image, a simple tool that
   creates a .png image from a fragment shader
   https://github.com/=
mc-imperial/get-image

2. From a terminal, execute:

   /path/to/get_image/linux_out/install/bin/get_image original.frag

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

3. From a terminal, execute:

   /path/to/get_image/linux_out/install/bin/get_image 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 shader source files is the
addition of an if-else whose if block is empty and else block contains
the original code. We control the condition value to make sure it is
always false at runtime.

Diff:
```
27a28,29
> uniform vec2 injectionSwitch;
>
117a120,124
>     if(injectionSwitch.x > injectionSwitch.y)
>         {
>         }
>     else
>         {
129a137
>         }
```

The injectionSwitch uniform is always set to { 0.0, 1.0 }. The else
block contains the original code, untouched.

Actual Results:
-------------------------------
The shaders render different images, which they should not: the shadow
in the lower part of the ball disappears in the variant.

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

- CPU: AMD A10-7850K Radeon R7, 12 Compute Cores 4C+8G
- GPU: Advanced Micro Devices, Inc. [AMD/ATI] Tonga PRO [Radeon R9 285/380]
- Mesa: 17.1.0-devel (git-08df015)
- OS: Ubuntu 16.04, Linux 4.4.0-67-generic


You are receiving this mail because:
  • You are the assignee for the bug.
= --14901088690.12Fd4ABB7.25961-- --===============2041574581== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============2041574581==--