Loosen color target tolerances for some tests
authorMichael Chock <mchock@nvidia.com>
Tue, 16 Jan 2018 22:57:49 +0000 (14:57 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 1 Feb 2018 11:57:54 +0000 (06:57 -0500)
Some tests verify the results of glReadPixels within two bits of
tolerance. However, some pixel formats (e.g., RGB 565) cannot support
such precision. Loosen hard-coded tolerances, such that tests can pass
with 5-bit color channels.

Additionally change the types of some variables from GLubyte to int. Log
messages constructed through stream operators would treat such values as
characters, rather than numeric quantities.

Components: OpenGL

VK-GL-CTS issue: 950

Affects:
KHR-GL46.indirect_parameters_tests.MultiDrawArraysIndirectCount
KHR-GL46.indirect_parameters_tests.MultiDrawElementsIndirectCount
KHR-GL46.shader_atomic_counter_ops_tests.*
KHR-GL46.shader_viewport_layer_array.*

Change-Id: I7da30842004caf1698d83128678c1bda82fff787

external/openglcts/modules/gl/gl4cIndirectParametersTests.cpp
external/openglcts/modules/gl/gl4cShaderAtomicCounterOpsTests.cpp
external/openglcts/modules/gl/gl4cShaderViewportLayerArrayTests.cpp

index f5e7f85..c7b28d1 100644 (file)
@@ -287,12 +287,13 @@ bool VertexArrayIndirectDrawingBaseCase::verify()
        {
                for (int x = 2; x < width / 2 - 2; ++x)
                {
-                       GLubyte value = pixels[x + y * width];
-                       if (value < 190 || value > 194)
+                       int value = pixels[x + y * width];
+                       // Support 5-bit precision for the framebuffer, re-quantized to 8-bits from glReadPixels.
+                       if (value < 189 || value > 197)
                        {
                                m_testCtx.getLog() << tcu::TestLog::Message << "First quad verification failed. "
                                                                   << "Wrong value read from framebuffer at " << x << "/" << y << " value: " << value
-                                                                  << ", expected: <190-194>" << tcu::TestLog::EndMessage;
+                                                                  << ", expected: <189-197>" << tcu::TestLog::EndMessage;
                                return false;
                        }
                }
@@ -303,12 +304,13 @@ bool VertexArrayIndirectDrawingBaseCase::verify()
        {
                for (int x = width / 2 + 2; x < width - 2; ++x)
                {
-                       GLubyte value = pixels[x + y * width];
-                       if (value < 126 || value > 130)
+                       int value = pixels[x + y * width];
+                       // Support 5-bit precision for the framebuffer, re-quantized to 8-bits from glReadPixels.
+                       if (value < 123 || value > 132)
                        {
                                m_testCtx.getLog() << tcu::TestLog::Message << "Second quad verification failed. "
                                                                   << "Wrong value read from framebuffer at " << x << "/" << y << " value: " << value
-                                                                  << ", expected: <126-130>" << tcu::TestLog::EndMessage;
+                                                                  << ", expected: <123-132>" << tcu::TestLog::EndMessage;
                                return false;
                        }
                }
index 6913b2e..b35a109 100644 (file)
@@ -452,7 +452,7 @@ void ShaderAtomicCounterOpsTestBase::bindBuffers()
 
 bool ShaderAtomicCounterOpsTestBase::validateColor(tcu::Vec4 testedColor, tcu::Vec4 desiredColor)
 {
-       const float epsilon = 0.008f;
+       const float epsilon = 1.1f / 31.0f; // Accommodate framebuffers with 5-bit channels.
        return de::abs(testedColor.x() - desiredColor.x()) < epsilon &&
                   de::abs(testedColor.y() - desiredColor.y()) < epsilon &&
                   de::abs(testedColor.z() - desiredColor.z()) < epsilon;
index 7efa211..879435a 100644 (file)
@@ -259,7 +259,7 @@ void ShaderViewportLayerArrayUtils::renderQuad(const glu::RenderContext& context
 
 bool ShaderViewportLayerArrayUtils::validateColor(tcu::Vec4 renderedColor, tcu::Vec4 referenceColor)
 {
-       const float epsilon = 0.008f;
+       const float epsilon = 1.1f / 31.0f; // Accommodate framebuffers with 5-bit channels.
        return de::abs(renderedColor.x() - referenceColor.x()) < epsilon &&
                   de::abs(renderedColor.y() - referenceColor.y()) < epsilon &&
                   de::abs(renderedColor.z() - referenceColor.z()) < epsilon &&