Page 1 of 1
setMaterialFlag(ETC_FOO) causes undefined behavior
Posted: Wed Jul 31, 2013 1:21 pm
by hendu
Bool is only guaranteed to be one bit long. So passing any of the texture clamping values through that turns them all to 0 or 1 on some platforms. Not what was intended, with CLAMP clamping to border color.
This bug should be fixed by changing the parameter to an u32 from bool, in SMaterial.setFlag and all its wrappers.
Re: setMaterialFlag(ETC_FOO) causes undefined behavior
Posted: Thu Aug 08, 2013 10:26 pm
by hybrid
The set function should work properly in all cases - as the function always maps false to the "OFF" enum and all other values to one distinct value chosen from all possible values. We should probably add an overloaded function which works for all enum values as expected, though. However, this would break backward compatibility. So we will probably have to invent a new name

Re: setMaterialFlag(ETC_FOO) causes undefined behavior
Posted: Fri Aug 09, 2013 11:35 am
by hendu
The ETC texture clamp flags are cast, it's not an ON/OFF case. So if you do setMaterialFlag(ETC_CLAMP_TO_EDGE), it actually gets set to ETC_CLAMP.