Code documentation & information ?

Code documentation & information ?


I'm currently discovering the Embree code and have a few questions, because there is no documentation on some functions:

1) signmsk
2) xorf
3)  rcp

BTW, if I understand, in the file "triangle1v_intersector_pluecker".h there is the following code :

const float sgnDet = signmsk(det);
const float U = xorf(dot(cross(v2+v0,e0),D),sgnDet); 

Is it equivalent to : const float U = copysign(dot(cross(v2+v0,e0),D), det);

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

1) signmask takes a floating point number and and sets every bit to zero, except for the sign bit (topmost bit).

2) xorf simply calculates a bitwise xor of the bit representation of two floating point numbers

The mask returned by signmask can be used to efficiently flip the sign bit of another floating point number by using the xorf instruction.For instance xorf(signmask(-6),10) = -10. The intersection algorithm uses a sequence like this to flip some signs if the triangle is hit from the back.

3) rcp calculates the reciprocal of a floating point number, rcp(x) = 1/x

The sequence does not copy the sign, but flip the sign of dot(cross(v2+v0,e0),D) if det < 0


Yes, I see... ingenious :-)

Leave a Comment

Please sign in to add a comment. Not a member? Join today