Is it safe to compare two structs of the same type by using the classic equality operator? I haven't found any information about this and there is no option to overload this operator in GLSL. So does GLSL compare two structs component-wise by default?
struct sith
{
int forceLevel;
vec3 saberColor;
};
...
sith vader = sith(100,vec3(1.0,0.0,0.0));
sith anakin = sith(100,vec3(1.0,0.0,0.0));
...
if (vader == anakin)
//is the force strong with this one?
When using the equality operators, two structures are equal if and only if all the fields are component-wise equal, and two arrays are equal if and only if all the elements are element-wise equal
- GLSL 1.30 Specification, Page 46, Section 5.7 "Structure and Array Operations"