You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code: float distance=100000; if (other_value < distance * distance) {....}
will be minified to something like: if(a < 10000000000) {...}
which trigger an "integer constant overflow" opengl error at shader compile time
if I add a point to my float declaration to "force" it to be a float: float distance=100000.; if (other_value < distance * distance) {....}
it will be minified to something like: if(a < 1e10) {...}
and no longer be an issue
To be honest, this variable was gonna be animated later, so the issue would have probably disappeared once no longer a constant, but it took me a while to understand why it happened
The text was updated successfully, but these errors were encountered:
I can see how it's hard to check for all those cases, and maybe it's not so bad to have something smaller 99% of the time than disabling an optimisation for the sake of a few fringes cases. It took me a while to find only because my debugging tools were bad and broken, but now I made it so I can easily use the minified shader in my editor, with proper error reporting, so it should be easier to work out those kind of mistakes in the future.
On this topic, I wonder if it would be possible for shaderminifier to generate some kind of log, maybe try to compile the shader by itself so it can report if there is an error somewhere... but I'm pretty sure nobody would look at the log anyway haha so it's probably a bad idea
The following code:
float distance=100000; if (other_value < distance * distance) {....}
will be minified to something like:
if(a < 10000000000) {...}
which trigger an "integer constant overflow" opengl error at shader compile time
if I add a point to my float declaration to "force" it to be a float:
float distance=100000.; if (other_value < distance * distance) {....}
it will be minified to something like:
if(a < 1e10) {...}
and no longer be an issue
To be honest, this variable was gonna be animated later, so the issue would have probably disappeared once no longer a constant, but it took me a while to understand why it happened
The text was updated successfully, but these errors were encountered: