-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Function already defined (error C1013) on minifying a working GLSL shader #316
Comments
Thanks for the report, this is surprising. |
I tested a few more things and it does compile if I replace the 'dd' with some single-letters: tried all from 'a' to 'z' and about 6-7 of them work. As additional information, the original shader does not contain any preprocessor directives: so no #if #ifdef #ifndef #define If I come up with any new information or with an example that I can post here I will let you know. On my side the workaround is to replace that function in 2 places every time i generate a minified shader using different versions of my original code (I have to generate about 8-16 shaders, and once that's done I'm all good to use the minified ones). |
Thanks for the report, this is very useful! Workaround: use curly braces after each case: switch (array)
{
case aSDFRotY: { fRepRot(q.zx, step.w, step.xy); break; }
} |
The switch/case issue should be fixed with #319. |
Thank you for the case fix! As for the issue with duplicate functions I managed to bypass it. I simply renamed the ones returning a vec2 with vOp*** and that fixed it. Anyway, thanks again for all the help and a great piece of software. |
I have a rather big shader with lots of small functions (600+ lines) that is working correctly before running the minifying tool on it. When I minify it I get this error of duplicate functions:
0(434) : error C1013: function "d" is already defined at 0(427)
Those are literally two consecutive functions in the file and the second function is calling the first one.
If I rename the second function to 'dd' in the minified file the code compiles ok.
Unfortunately I cannot provide the whole code and I couldn't yet reproduce it in a simpler example.
Could it be that it's running out of symbols/letters?
vec2 d(float v,float i,float z,inout int y,int f)
{
if(v<i)
y=f;
float m=clamp(.5-.5*(i-v)/z,0.,1.);
return vec2(max(i,v)+z*min(m,1.-m),1-m);
}
vec2 d(float v,float i,float f,inout int z,int y)
{
return d(v,-i,f,z,y);
}
The text was updated successfully, but these errors were encountered: