From 881517b3030a4ed1dcfdb241f67049d625fbd97f Mon Sep 17 00:00:00 2001 From: Michael Chock Date: Tue, 16 Jan 2018 14:57:49 -0800 Subject: [PATCH] Loosen color target tolerances for some tests 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 --- .../openglcts/modules/gl/gl4cIndirectParametersTests.cpp | 14 ++++++++------ .../modules/gl/gl4cShaderAtomicCounterOpsTests.cpp | 2 +- .../modules/gl/gl4cShaderViewportLayerArrayTests.cpp | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/external/openglcts/modules/gl/gl4cIndirectParametersTests.cpp b/external/openglcts/modules/gl/gl4cIndirectParametersTests.cpp index f5e7f85..c7b28d1 100644 --- a/external/openglcts/modules/gl/gl4cIndirectParametersTests.cpp +++ b/external/openglcts/modules/gl/gl4cIndirectParametersTests.cpp @@ -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; } } diff --git a/external/openglcts/modules/gl/gl4cShaderAtomicCounterOpsTests.cpp b/external/openglcts/modules/gl/gl4cShaderAtomicCounterOpsTests.cpp index 6913b2e..b35a109 100644 --- a/external/openglcts/modules/gl/gl4cShaderAtomicCounterOpsTests.cpp +++ b/external/openglcts/modules/gl/gl4cShaderAtomicCounterOpsTests.cpp @@ -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; diff --git a/external/openglcts/modules/gl/gl4cShaderViewportLayerArrayTests.cpp b/external/openglcts/modules/gl/gl4cShaderViewportLayerArrayTests.cpp index 7efa211..879435a 100644 --- a/external/openglcts/modules/gl/gl4cShaderViewportLayerArrayTests.cpp +++ b/external/openglcts/modules/gl/gl4cShaderViewportLayerArrayTests.cpp @@ -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 && -- 2.7.4