Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precision of constant variables is dropped during operation. #90

Open
themikelester opened this issue Mar 13, 2015 · 0 comments
Open

Precision of constant variables is dropped during operation. #90

themikelester opened this issue Mar 13, 2015 · 0 comments

Comments

@themikelester
Copy link

We have a case where a constant variable in an operation is being replaced with it's literal representation, dropping the precision qualifier. This variable was the only highp value in the operation, which means that the whole operation is now performed at mediump.

Here's the case (note that gl_FragCoord is mediump):

highp float time = 1.0;
highp float dither = dot( vec2( 171.0, 231.0 ), gl_FragCoord.xy + vec2( time ) );

is optimized to:

highp float tmpvar_17;
tmpvar_17 = dot (vec2(171.0, 231.0), (gl_FragCoord.xy + vec2(1.0, 1.0)));

The tmpvar_17 calculation now contains only one variable with precision, mediump gl_FragCoord, so the calculation is performed at mediump. Replacing the 1.0 literals with a highp float initialized to 1.0 fixes the issue. The bug here seems to be that constants are being replaced by literals without considering precision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant