oizma / angleproject

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

translator_hlsl ternary operator unfold bug #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Translate the attached minimal shader.
2. Notice the false branch is incorrect

What is the expected output? What do you see instead?
I expected the ternary operators to be unfolded correctly.
Instead, I saw the false branch mostly disappear.

What version of the product are you using? On what operating system?
r469, Win7 Pro

Please provide any additional information below.

I believe the solution is to change line 47 of UnfoldSelect.cpp in 
translator_hlsl to

node->getFalseBlock()->traverse(this);

instead of

node->getCondition()->traverse(this);

However, I have not analyzed this change beyond function call symmetry with the 
rest of UnfoldSelect::visitSelection and the fact that after this change the 
emitted HLSL /appears/ correct. I have not tested the resultant HLSL.

Original issue reported on code.google.com by she...@ashimaarts.com on 28 Oct 2010 at 11:06

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by dan...@transgaming.com on 29 Oct 2010 at 1:37

GoogleCodeExporter commented 9 years ago
Attached is a comparison of r469 behavior against the suggested change.

Original comment by she...@ashimaarts.com on 29 Oct 2010 at 8:46

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for detecting this and locating the bug! Your fix will be incorporated 
shortly.

Original comment by Nicolas....@gmail.com on 8 Nov 2010 at 6:06

GoogleCodeExporter commented 9 years ago
This fix has been incorporated in r474

Original comment by dan...@transgaming.com on 8 Nov 2010 at 1:50