xuxiandi / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

HLSL translator fails on multiple ternary operators in function call arguments #203

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using multiple ternary operators in function call arguments will cause linking 
to fail with an internal D3D shader compiler error:
Shader@.....: error X3003: redefinition of 't3'

Code doing such passes the validator and successfully links on OSX and Linux.

Example snippet that triggers the issue (add to any shader to repro):
  vec4 x = vec4(1.0);  vec4 y = vec4(1.0);
  vec4 z = vec4((x.r > 1.0) ? x.r : y.r, (x.g > 1.0) ? x.g : y.g, 1.0, 1.0);

Another, showing that the same thing happens when placed in macros:
  #define A(a, b) (a > 1.0) ? a : b
  vec4 x = vec4(1.0);  vec4 y = vec4(1.0);
  vec4 z = vec4(A(x.r, y.r), A(x.g, y.g), 1.0, 1.0);

Note that the following does NOT trigger the issue:
  vec4 x = vec4(1.0);  vec4 y = vec4(1.0);
  float a = (x.r > 1.0) ? x.r : y.r;
  float b = (x.g > 1.0) ? x.g : y.g;
  vec4 z = vec4(a, b, 1.0, 1.0);

Original issue reported on code.google.com by benvanik@google.com on 8 Sep 2011 at 12:32

GoogleCodeExporter commented 9 years ago

Original comment by kbr@chromium.org on 8 Sep 2011 at 2:49

GoogleCodeExporter commented 9 years ago
Is it any vendor specific?  NVIDIA?

Original comment by z...@google.com on 9 Sep 2011 at 1:00

GoogleCodeExporter commented 9 years ago
I don't think so, since it's coming from D3D's compiler. I'll check tomorrow 
what card is in my Windows box at work.

Original comment by ben.vanik on 9 Sep 2011 at 1:15

GoogleCodeExporter commented 9 years ago

Original comment by nicolas....@gmail.com on 27 Sep 2011 at 12:41

GoogleCodeExporter commented 9 years ago
Issue 208 has been merged into this issue.

Original comment by nicolas....@gmail.com on 3 Oct 2011 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by nicolas....@gmail.com on 4 Oct 2011 at 12:45

GoogleCodeExporter commented 9 years ago
Fixed in r784.

Original comment by nicolas....@gmail.com on 4 Oct 2011 at 7:00