Sign in to follow this  
Geometrian

Simple GLSL Error

Recommended Posts

Geometrian    1810
Hi, Simple error, hopefully simple solution. The test code is as follows:
abs(float(4)); //This line works
float(abs(4)); //This line does not
The specific error I'm getting is: error C1101: ambiguous overloaded function reference "abs" <stdlib>(605) : ps fixed absfixed(fixed) <stdlib>(604) : ps half abshalf(half) Ideas? Thanks, -G

Share this post


Link to post
Share on other sites
Geometrian    1810
In the code, the "4" would be replaced by a variable. I reduced it down to this code just to see why switching the order of the functions makes a difference?
-G

Share this post


Link to post
Share on other sites
bobofjoe    322
because the conversion from int to either half or fixed are neither worse or better than the other. So, when you write abs(4); it sees the two conversions, can't decide between the two, and fails to compile with an ambiguous overload error.

However, in the case of using abs(float(4)), you convert 4 to a float, which calls abs() with a float argument, instead of attempting to convert.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this