KalebDark / angleproject

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

Move global variable initialization with ternary ops into a function with D3D backend #819

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
So 
https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/misc/ternary-o
perators-in-global-initializers.html may pass

Original issue reported on code.google.com by z...@google.com on 3 Nov 2014 at 6:52

GoogleCodeExporter commented 9 years ago
I don't think that moving the initialization to a function is necessary to pass 
that test, simply folding the ternary operator always when the condition is 
constant is sufficient. This can be done since only one of the 2nd and 3rd 
sub-expressions is evaluated (ESSL spec section 5.9).

The test is also slightly bugged in light of the current spec, see 
https://github.com/KhronosGroup/WebGL/pull/940 . However, rather than changing 
the test, the spec might actually need to be changed to preserve compatibility.

Original comment by oetu...@nvidia.com on 15 Apr 2015 at 1:03

GoogleCodeExporter commented 9 years ago
I might have spoken too soon when I though that ternary operators can be folded 
when only the condition is constant. That would probably mess with ANGLE's 
tracking of what is a constant expression and what is not - if one of the 
2nd/3rd sub-expressions is not a constant expression, it will affect the 
"constant-expressionness" of the ternary operator even if it is never 
evaluated. This makes things considerably trickier, though it would still be 
possible to fold more aggressively if the tracking of expression qualifiers is 
sophisticated enough.

Original comment by oetu...@nvidia.com on 15 Apr 2015 at 1:43

GoogleCodeExporter commented 9 years ago
Remove myself as owner because I probably won't come around to work on this any 
time soon.

I still think using a function is easier.  We already have a mechanism to 
expand the ternary operators into conditional branches for D3D. Implementation 
wise, it seems to me the easier path. However, if someone wants to implement 
otherwise, I have no objections as far as it's correct.

Original comment by z...@google.com on 15 Apr 2015 at 9:22

GoogleCodeExporter commented 9 years ago
This is blocked on making global variable init constant.

Original comment by jmad...@chromium.org on 29 Apr 2015 at 2:55