Attempting to set a sampler uniform will lead to writing garbage to uniform locations other than the location of the sampler when we have a sampler uniform array. (for non-arrays the behavior is undefined as the count is mandated to be 1 by the spec)
UniformValue(Qt3DCore::QNodeId) calls the default UniformValue() implementation that does:
thus making value.byteSize() 16.
"Promoting" the UniformValue's internal data to ints suitable for samplers happens in RenderView, and its uniformArraySize calculation expects that value.byteSize() == elementCount * sizeof(QNodeId). This is not true with m_data(4) above.
For example, attempting to set a single sampler uniform will lead to uniformArraySize = 16 / 8 = 2 which is incorrect as it should be 1.
The correct approach is to avoid all the trouble caused by calling UniformValue():
thus making sure m_data.count() matches the actual data.