Lines Matching refs:Precision
127 inline bool supportsSignedZero (glu::Precision precision)
131 return precision == glu::PRECISION_HIGHP;
153 static int getMinMantissaBits (glu::Precision precision)
162 DE_ASSERT(de::inBounds<int>(precision, 0, DE_LENGTH_OF_ARRAY(bits)));
163 return bits[precision];
166 static int getMaxNormalizedValueExponent (glu::Precision precision)
175 DE_ASSERT(de::inBounds<int>(precision, 0, DE_LENGTH_OF_ARRAY(exponent)));
176 return exponent[precision];
179 static int getMinNormalizedValueExponent (glu::Precision precision)
188 DE_ASSERT(de::inBounds<int>(precision, 0, DE_LENGTH_OF_ARRAY(exponent)));
189 return exponent[precision];
192 static float makeFloatRepresentable (float f, glu::Precision precision)
194 if (precision == glu::PRECISION_HIGHP)
196 // \note: assuming f is not extended-precision
201 const int numMantissaBits = getMinMantissaBits(precision);
202 const int maxNormalizedValueExponent = getMaxNormalizedValueExponent(precision);
203 const int minNormalizedValueExponent = getMinNormalizedValueExponent(precision);
206 const bool zeroNotRepresentable = (precision == glu::PRECISION_LOWP);
464 static const char* getPrecisionPostfix (glu::Precision precision)
473 DE_ASSERT(de::inBounds<int>(precision, 0, DE_LENGTH_OF_ARRAY(s_postfix)));
474 return s_postfix[precision];
492 static std::string getCommonFuncCaseName (glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
494 return string(glu::getDataTypeName(baseType)) + getPrecisionPostfix(precision) + getShaderTypePostfix(shaderType);
500 AbsCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
501 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "abs", shaderType)
503 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
504 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
525 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
529 fillRandomScalars(rnd, floatRanges[precision].x(), floatRanges[precision].y(), values[0], numValues*scalarSize);
531 fillRandomScalars(rnd, intRanges[precision].x(), intRanges[precision].y(), values[0], numValues*scalarSize);
537 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
542 const int mantissaBits = getMinMantissaBits(precision);
582 SignCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
583 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "sign", shaderType)
585 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
586 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
607 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
616 fillRandomScalars(rnd, floatRanges[precision].x(), floatRanges[precision].y(), (float*)values[0] + scalarSize*3, (numValues-3)*scalarSize);
623 fillRandomScalars(rnd, intRanges[precision].x(), intRanges[precision].y(), (int*)values[0] + scalarSize*3, (numValues-3)*scalarSize);
630 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
636 const deUint32 maxUlpDiff = precision == glu::PRECISION_LOWP ? getMaxUlpDiffFromBits(getMinMantissaBits(precision)) : 0;
688 RoundEvenCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
689 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "roundEven", shaderType)
691 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
692 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
707 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
712 if (precision != glu::PRECISION_LOWP)
717 const float v = de::clamp(float(ndx) - 10.5f, ranges[precision].x(), ranges[precision].y());
724 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[0] + numSpecialCases*scalarSize, (numValues-numSpecialCases)*scalarSize);
726 // If precision is mediump, make sure values can be represented in fp16 exactly
727 if (precision == glu::PRECISION_MEDIUMP)
737 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
738 const bool hasSignedZero = supportsSignedZero(precision);
741 if (precision == glu::PRECISION_HIGHP || precision == glu::PRECISION_MEDIUMP)
761 const int mantissaBits = getMinMantissaBits(precision);
799 ModfCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
800 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "modf", shaderType)
802 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
803 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
804 m_spec.outputs.push_back(Symbol("out1", glu::VarType(baseType, precision)));
819 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
822 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), values[0], numValues*scalarSize);
828 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
829 const bool hasZeroSign = supportsSignedZero(precision);
832 const int mantissaBits = getMinMantissaBits(precision);
843 const int bitsLost = precision != glu::PRECISION_HIGHP ? numBitsLostInOp(in0, refOut0) : 0;
865 IsnanCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
866 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "isnan", shaderType)
873 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
882 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
884 const int mantissaBits = getMinMantissaBits(precision);
905 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
908 if (precision == glu::PRECISION_HIGHP)
924 else if (precision == glu::PRECISION_MEDIUMP || precision == glu::PRECISION_LOWP)
948 IsinfCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
949 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "isinf", shaderType)
956 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
965 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
967 const int mantissaBits = getMinMantissaBits(precision);
988 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
991 if (precision == glu::PRECISION_HIGHP)
1007 else if (precision == glu::PRECISION_MEDIUMP)
1032 FloatBitsToUintIntCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType, bool outIsSigned)
1033 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), outIsSigned ? "floatBitsToInt" : "floatBitsToUint", shaderType)
1039 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1055 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1058 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), values[0], numValues*scalarSize);
1064 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1067 const int mantissaBits = getMinMantissaBits(precision);
1092 FloatBitsToIntCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1093 : FloatBitsToUintIntCase(context, baseType, precision, shaderType, true)
1101 FloatBitsToUintCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1102 : FloatBitsToUintIntCase(context, baseType, precision, shaderType, false)
1160 FloorCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1161 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "floor", shaderType)
1163 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1164 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
1179 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1182 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[0], numValues*scalarSize);
1184 // If precision is mediump, make sure values can be represented in fp16 exactly
1185 if (precision == glu::PRECISION_MEDIUMP)
1195 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1198 if (precision == glu::PRECISION_HIGHP || precision == glu::PRECISION_MEDIUMP)
1218 const int mantissaBits = getMinMantissaBits(precision);
1256 TruncCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1257 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "trunc", shaderType)
1259 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1260 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
1275 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1288 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[0] + scalarSize*numSpecialCases, (numValues-numSpecialCases)*scalarSize);
1290 // If precision is mediump, make sure values can be represented in fp16 exactly
1291 if (precision == glu::PRECISION_MEDIUMP)
1301 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1304 if (precision == glu::PRECISION_HIGHP || precision == glu::PRECISION_MEDIUMP)
1326 const int mantissaBits = getMinMantissaBits(precision);
1364 RoundCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1365 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "round", shaderType)
1367 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1368 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
1383 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1388 if (precision != glu::PRECISION_LOWP)
1393 const float v = de::clamp(float(ndx) - 5.5f, ranges[precision].x(), ranges[precision].y());
1400 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[0] + numSpecialCases*scalarSize, (numValues-numSpecialCases)*scalarSize);
1402 // If precision is mediump, make sure values can be represented in fp16 exactly
1403 if (precision == glu::PRECISION_MEDIUMP)
1413 Precision precision = m_spec.inputs[0].varType.getPrecision();
1414 const bool hasZeroSign = supportsSignedZero(precision);
1417 if (precision == glu::PRECISION_HIGHP || precision == glu::PRECISION_MEDIUMP)
1454 const int mantissaBits = getMinMantissaBits(precision);
1492 CeilCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1493 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "ceil", shaderType)
1495 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1496 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
1511 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1515 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[0], numValues*scalarSize);
1517 // If precision is mediump, make sure values can be represented in fp16 exactly
1518 if (precision == glu::PRECISION_MEDIUMP)
1528 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1529 const bool hasZeroSign = supportsSignedZero(precision);
1532 if (precision == glu::PRECISION_HIGHP || precision == glu::PRECISION_MEDIUMP)
1552 const int mantissaBits = getMinMantissaBits(precision);
1597 FractCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1598 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "fract", shaderType)
1600 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1601 m_spec.outputs.push_back(Symbol("out0", glu::VarType(baseType, precision)));
1616 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1621 if (precision != glu::PRECISION_LOWP)
1626 const float v = de::clamp(float(ndx) - 5.5f, ranges[precision].x(), ranges[precision].y());
1633 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[0] + numSpecialCases*scalarSize, (numValues-numSpecialCases)*scalarSize);
1635 // If precision is mediump, make sure values can be represented in fp16 exactly
1636 if (precision == glu::PRECISION_MEDIUMP)
1646 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1647 const bool hasZeroSign = supportsSignedZero(precision);
1650 if (precision == glu::PRECISION_HIGHP || precision == glu::PRECISION_MEDIUMP)
1670 const int mantissaBits = getMinMantissaBits(precision);
1740 FrexpCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1741 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "frexp", shaderType)
1746 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1763 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1779 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[0] + 8*scalarSize, (numValues-8)*scalarSize);
1788 *valuePtr = makeFloatRepresentable(*valuePtr, precision);
1796 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1800 const int mantissaBits = getMinMantissaBits(precision);
1831 LdexpCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1832 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "ldexp", shaderType)
1837 m_spec.inputs.push_back(Symbol("in0", glu::VarType(baseType, precision)));
1854 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1881 const int numEasyRandomCases = precision == glu::PRECISION_HIGHP ? 50 : (numValues-valueNdx);
1888 precision].x(), ranges[precision].y());
1936 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
1939 const int mantissaBits = getMinMantissaBits(precision);
1967 FmaCase (Context& context, glu::DataType baseType, glu::Precision precision, glu::ShaderType shaderType)
1968 : CommonFunctionCase(context, getCommonFuncCaseName(baseType, precision, shaderType).c_str(), "fma", shaderType)
1970 m_spec.inputs.push_back(Symbol("a", glu::VarType(baseType, precision)));
1971 m_spec.inputs.push_back(Symbol("b", glu::VarType(baseType, precision)));
1972 m_spec.inputs.push_back(Symbol("c", glu::VarType(baseType, precision)));
1973 m_spec.outputs.push_back(Symbol("res", glu::VarType(baseType, precision)));
1997 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
2031 fillRandomScalars(rnd, ranges[precision].x(), ranges[precision].y(), (float*)values[inputNdx] + offs, numScalars);
2043 *valuePtr = makeFloatRepresentable(*valuePtr, precision);
2049 static tcu::Interval fma (glu::Precision precision, float a, float b, float c)
2058 const tcu::FloatFormat& format = de::getSizedArrayElement<glu::PRECISION_LAST>(formats, precision);
2086 const glu::Precision precision = m_spec.inputs[0].varType.getPrecision();
2095 const tcu::Interval ref = fma(precision, a, b, c);
2146 group->addChild(new TestClass(parent->getContext(), glu::DataType(scalarType + vecSize - 1), glu::Precision(prec), glu::ShaderType(shaderTypeNdx)));