[Mesa-dev] [Bug 62357] llvmpipe: Fragment Shader with "return" in main causes back output

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Mar 15 06:43:15 PDT 2013


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

--- Comment #7 from Roland Scheidegger <sroland at vmware.com> ---
After a quick look at the generated IR, it indeed seems broken.
However, it is broken the opposite way, that is the early exit path is ok but
if the path isn't taken it will pick zero as the output color.
So if you swap the test like so:
[test]
uniform vec4 v 1 0 1 0

Then it fails.

tgsi looks like this:
  0: SLT TEMP[0].x, CONST[0].xxxx, IMM[0].xxxx
  1: F2I TEMP[0].x, -TEMP[0]
  2: SLT TEMP[1].x, IMM[0].yyyy, CONST[0].yyyy
  3: F2I TEMP[1].x, -TEMP[1]
  4: OR TEMP[1].x, TEMP[0].xxxx, TEMP[1].xxxx
  5: SLT TEMP[2].x, CONST[0].zzzz, IMM[0].xxxx
  6: F2I TEMP[2].x, -TEMP[2]
  7: OR TEMP[1].x, TEMP[1].xxxx, TEMP[2].xxxx
  8: IF TEMP[1].xxxx :0
  9:   MOV_SAT OUT[0], CONST[0]
 10:   RET
 11: ENDIF
 12: ADD TEMP[0], IMM[0].xxxx, -CONST[0]
 13: MOV_SAT OUT[0], TEMP[0]
 14: END

And the IR part like this:
  %53 = fcmp une <8 x float> %52, zeroinitializer
  %54 = sext <8 x i1> %53 to <8 x i32>
// %54 is the result of the if condition of line 8
...
  %70 = call <8 x float> @llvm.x86.avx.max.ps.256(<8 x float> %57, <8 x float>
zeroinitializer)
  %71 = call <8 x float> @llvm.x86.avx.min.ps.256(<8 x float> %70, <8 x float>
<float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float
1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float
1.000000e+00>)
// %71 contains mov_sat of line 9
  %72 = bitcast <8 x i32> %54 to <8 x float>
// %72 is still condition of line 8 as float
  %73 = call <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float>
zeroinitializer, <8 x float> %71, <8 x float> %72)
// %73 contains the output going to color pack - you can see that if the
condition (%72) wasn't true, it simply selects zero.

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


More information about the mesa-dev mailing list