<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Adding a single, meaningless if-else to a shader source leads to different image"
href="https://bugs.freedesktop.org/show_bug.cgi?id=100303">100303</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Adding a single, meaningless if-else to a shader source leads to different image
</td>
</tr>
<tr>
<th>Product</th>
<td>Mesa
</td>
</tr>
<tr>
<th>Version</th>
<td>git
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Drivers/Gallium/radeonsi
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dri-devel@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>h.evrard@imperial.ac.uk
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>dri-devel@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=130352" name="attach_130352" title="Zip archive with files to reproduce">attachment 130352</a> <a href="attachment.cgi?id=130352&action=edit" title="Zip archive with files to reproduce">[details]</a></span>
Zip archive with files to reproduce
See: <a href="https://github.com/mc-imperial/shader-compiler-bugs/issues/62">https://github.com/mc-imperial/shader-compiler-bugs/issues/62</a>
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
<a href="https://github.com/mc-imperial/get-image">https://github.com/mc-imperial/get-image</a>
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
<span class="quote">> uniform vec2 injectionSwitch;</span >
>
117a120,124
<span class="quote">> if(injectionSwitch.x > injectionSwitch.y)
> {
> }
> else
> {</span >
129a137
<span class="quote">> }</span >
```
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>