Valgrind fix for uninitialized values in Render::Sampler
Valgrind reported conditional jump depends on uninit values in:
if( mSampler.mBitField != oldSampler.mBitField ) // Texture::ApplySampler
Problem was down to Sampler having a anonymous union:
union
{
unsigned int mBitfield;
struct
{
FilterMode mMinificationFilter : 4; ///< The minify filter
FilterMode mMagnificationFilter : 4; ///< The magnify filter
WrapMode mSWrapMode : 4; ///< The horizontal wrap mode
WrapMode mTWrapMode : 4; ///< The vertical wrap mode
WrapMode mRWrapMode : 4; ///< The vertical wrap mode
};
};
Fundamentally the size of the bit field struct
can be larger than the size of the unsigned int mBitfield, so using mBitfield to compare Samplers
isn't reliable.
The issue valgrind picked up on is, only 20 bits of the
mBitfield are being set in the sampler constructor
Sampler()
:mMinificationFilter(FilterMode::DEFAULT),
mMagnificationFilter(FilterMode::DEFAULT),
mSWrapMode(WrapMode::DEFAULT),
mTWrapMode(WrapMode::DEFAULT),
mRWrapMode(WrapMode::DEFAULT)
{}
Solution is to remove the union
Change-Id: Id66afc05d21377a1363448ef10654cd1ab4bb365