Fixed format threshold calculation caused division by zero
whenever less than four channels were used by the format.
This change uses threshold zero for the empty channels.
VK-GL-CTS Issue: 3332
Affects:
dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.*
Components: OpenGL ES
Change-Id: Ib6c8ee6ee0fa82d1f0514b639938c61ed7762381
const tcu::IVec4 srcBits = tcu::getTextureFormatBitDepth(sourceFormat);
const tcu::IVec4 readBits = tcu::getTextureFormatBitDepth(readPixelsFormat);
- return Vec4(3.0f) / ((tcu::Vector<deUint64, 4>(1) << (tcu::min(srcBits, readBits).cast<deUint64>())) - tcu::Vector<deUint64, 4>(1)).cast<float>();
+ Vec4 threshold = Vec4(0.0f);
+
+ for (int i = 0; i < 4; i++)
+ {
+ const int bits = de::min(srcBits[i], readBits[i]);
+
+ if (bits > 0)
+ {
+ threshold[i] = 3.0f / static_cast<float>(((1ul << bits) - 1ul));
+ }
+ }
+
+ return threshold;
}
UVec4 getFloatULPThreshold (const tcu::TextureFormat& sourceFormat, const tcu::TextureFormat& readPixelsFormat)