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

Loss of constant precision #114

Closed
therontarigo opened this issue Nov 8, 2021 · 1 comment · Fixed by #117
Closed

Loss of constant precision #114

therontarigo opened this issue Nov 8, 2021 · 1 comment · Fixed by #117

Comments

@therontarigo
Copy link
Contributor

therontarigo commented Nov 8, 2021

My application requires the full IEEE754 precision as supported by the GPUs I target (with precision highp float). I have a constant in the shader source:
float pi = 3.1415927;
Shader Minifier translates this to
float M=3.14159;
resulting in measurably altered results.

Furthermore there is another bug when trying to use a workaround:

float pi =
//[
3.1415927;
//]

results in a parse error. I must wrap the entirety of the constant definition in //[ //] which has the unwanted effect of preventing Shader Minifier from shortening these constant names.

For the example case here, I can use acos(-1.) as my pi constant, but for other high precision constants the limitation stands.

@laurentlb
Copy link
Owner

Thanks for the report. That's indeed a bug that we should look into.

As a workaround, you can define a macro:

#define pi 3.1415927

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

Successfully merging a pull request may close this issue.

2 participants