From c214f65602ccd453afeeeb2c674ba121e7a9f8af Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Thu, 19 Mar 2015 10:15:42 -0700 Subject: [PATCH] Use highp interpolation in fragment_out tests Bug: 19380820 Change-Id: I7133e8ccdff5db1247b69068560de9b54653cef0 --- .../gles3/functional/es3fFragmentOutputTests.cpp | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/modules/gles3/functional/es3fFragmentOutputTests.cpp b/modules/gles3/functional/es3fFragmentOutputTests.cpp index 71f8422..1dc1415 100644 --- a/modules/gles3/functional/es3fFragmentOutputTests.cpp +++ b/modules/gles3/functional/es3fFragmentOutputTests.cpp @@ -181,26 +181,27 @@ static glu::ShaderProgram* createProgram (const glu::RenderContext& context, con const FragmentOutput& output = outputs[outNdx]; bool isArray = output.arrayLength > 0; const char* typeName = glu::getDataTypeName(output.type); - const char* precName = glu::getPrecisionName(output.precision); + const char* outputPrec = glu::getPrecisionName(output.precision); bool isFloat = glu::isDataTypeFloatOrVec(output.type); const char* interp = isFloat ? "smooth" : "flat"; + const char* interpPrec = isFloat ? "highp" : outputPrec; if (isArray) { for (int elemNdx = 0; elemNdx < output.arrayLength; elemNdx++) { - vtx << "in " << precName << " " << typeName << " in" << outNdx << "_" << elemNdx << ";\n" - << interp << " out " << precName << " " << typeName << " var" << outNdx << "_" << elemNdx << ";\n"; - frag << interp << " in " << precName << " " << typeName << " var" << outNdx << "_" << elemNdx << ";\n"; + vtx << "in " << interpPrec << " " << typeName << " in" << outNdx << "_" << elemNdx << ";\n" + << interp << " out " << interpPrec << " " << typeName << " var" << outNdx << "_" << elemNdx << ";\n"; + frag << interp << " in " << interpPrec << " " << typeName << " var" << outNdx << "_" << elemNdx << ";\n"; } - frag << "layout(location = " << output.location << ") out " << precName << " " << typeName << " out" << outNdx << "[" << output.arrayLength << "];\n"; + frag << "layout(location = " << output.location << ") out " << outputPrec << " " << typeName << " out" << outNdx << "[" << output.arrayLength << "];\n"; } else { - vtx << "in " << precName << " " << typeName << " in" << outNdx << ";\n" - << interp << " out " << precName << " " << typeName << " var" << outNdx << ";\n"; - frag << interp << " in " << precName << " " << typeName << " var" << outNdx << ";\n" - << "layout(location = " << output.location << ") out " << precName << " " << typeName << " out" << outNdx << ";\n"; + vtx << "in " << interpPrec << " " << typeName << " in" << outNdx << ";\n" + << interp << " out " << interpPrec << " " << typeName << " var" << outNdx << ";\n"; + frag << interp << " in " << interpPrec << " " << typeName << " var" << outNdx << ";\n" + << "layout(location = " << output.location << ") out " << outputPrec << " " << typeName << " out" << outNdx << ";\n"; } } @@ -891,9 +892,10 @@ FragmentOutputCase::IterateResult FragmentOutputCase::iterate (void) { case tcu::TEXTURECHANNELCLASS_FLOATING_POINT: { - UVec4 formatThreshold; //!< Threshold computed based on format. - deUint32 precThreshold = 0; //!< Threshold computed based on output type precision - UVec4 finalThreshold; + const deUint32 interpThreshold = 4; //!< 4 ULP interpolation threshold (interpolation always in highp) + deUint32 outTypeThreshold = 0; //!< Threshold based on output type + UVec4 formatThreshold; //!< Threshold computed based on format. + UVec4 finalThreshold; // 1 ULP rounding error is allowed for smaller floating-point formats switch (format.type) @@ -906,17 +908,17 @@ FragmentOutputCase::IterateResult FragmentOutputCase::iterate (void) break; } - // 4 ULP interpolation + // 1 ULP rounding error for highp -> output precision cast switch (outPrecision) { - case glu::PRECISION_LOWP: precThreshold = (4<<(23-8)); break; - case glu::PRECISION_MEDIUMP: precThreshold = (4<<(23-10)); break; - case glu::PRECISION_HIGHP: precThreshold = 4; break; + case glu::PRECISION_LOWP: outTypeThreshold = (1<<(23-8)); break; + case glu::PRECISION_MEDIUMP: outTypeThreshold = (1<<(23-10)); break; + case glu::PRECISION_HIGHP: outTypeThreshold = 0; break; default: DE_ASSERT(false); } - finalThreshold = select(max(formatThreshold, UVec4(precThreshold)), UVec4(~0u), cmpMask); + finalThreshold = select(max(formatThreshold, UVec4(deMax32(interpThreshold, outTypeThreshold))), UVec4(~0u), cmpMask); isOk = tcu::floatUlpThresholdCompare(log, name.c_str(), desc.c_str(), reference, rendered, finalThreshold, tcu::COMPARE_LOG_RESULT); break; -- 2.7.4