<div dir="ltr">Probably, the optimizer sees that there is second assignment, and skips the first, f=1.0. It never gets to second though.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 10, 2013 at 11:08 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 04/10/2013 12:20 PM, Vadim Girlin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
It seems there is a bug in the compiler. The problem may be reproduced<br>
with the following shader (complete shader_test file attached):<br>
<br>
void main()<br>
{<br>
float f = 0.0;<br>
while (true) {<br>
f = 1.0;<br>
break;<br>
f = 0.5;<br>
}<br>
gl_FragColor = vec4(1.0 - f, f, 0.0, 1.0);<br>
}<br>
<br>
The result of compilation is equal to:<br>
<br>
while (true) {<br>
break;<br>
}<br>
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);<br>
<br>
In other words, GLSL compiler eliminates both assignments to "f" in the<br>
loop body and the resulting value of the "f" variable is 0.<br>
</blockquote>
<br></div></div>
Blarg. I can believe it. The loop analysis code is a disaster. Part of the reason I'm (slowly) making changes to the IR is so that we can do more credible loop handling.<br>
<br>
I probably won't be able to get to this problem for quite some time. :(<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Vadim<br>
______________________________<u></u>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/mesa-dev</a><br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div>