Import several fixes from main repo:
authorPyry Haulos <phaulos@google.com>
Thu, 25 Sep 2014 01:39:44 +0000 (18:39 -0700)
committerPyry Haulos <phaulos@google.com>
Thu, 25 Sep 2014 01:39:44 +0000 (18:39 -0700)
 * Rounding of overflowed operation results in shader precision tests
 * GL object leak in glu::ObjectVector
 * False negatives due to ambiguous cube corner texel selection
 * x11_glx build from this repo (bonus)

Change-Id: Ifeb6570cad5dec961057decc4af85365c3054f1c

framework/common/tcuFloatFormat.cpp
framework/common/tcuFloatFormat.hpp
framework/opengl/gluObjectWrapper.cpp
modules/gles3/functional/es3fShaderTextureFunctionTests.cpp
modules/glshared/glsBuiltinPrecisionTests.cpp
targets/x11_glx/x11_glx.cmake

index 1083fc9..31f5907 100644 (file)
@@ -199,12 +199,27 @@ Interval FloatFormat::convert (const Interval& x) const
        return ret;
 }
 
-Interval FloatFormat::roundOut (const Interval& x) const
+double FloatFormat::roundOut (double d, bool upward, bool roundUnderOverflow) const
+{
+       int     exp     = 0;
+       deFractExp(d, &exp);
+
+       if (roundUnderOverflow && exp > m_maxExp && (upward == (d < 0.0)))
+               return deSign(d) * getMaxValue();
+       else
+               return round(d, upward);
+}
+
+//! Round output of an operation.
+//! \param roundUnderOverflow Can +/-inf rounded to min/max representable;
+//!                                                      should be false if any of operands was inf, true otherwise.
+Interval FloatFormat::roundOut (const Interval& x, bool roundUnderOverflow) const
 {
        Interval ret = x.nan();
 
        if (!x.empty())
-               ret |= Interval(round(x.lo(), false), round(x.hi(), true));
+               ret |= Interval(roundOut(x.lo(), false, roundUnderOverflow),
+                                               roundOut(x.hi(), true, roundUnderOverflow));
 
        return ret;
 }
index 398d608..f58a6c7 100644 (file)
@@ -58,8 +58,9 @@ public:
        YesNoMaybe                      hasSubnormal    (void) const { return m_hasSubnormal; }
 
        double                          ulp                             (double x, double count = 1.0) const;
-       Interval                        roundOut                (const Interval& x) const;
+       Interval                        roundOut                (const Interval& x, bool roundUnderOverflow) const;
        double                          round                   (double d, bool upward) const;
+       double                          roundOut                (double d, bool upward, bool roundUnderOverflow) const;
        Interval                        convert                 (const Interval& x) const;
 
        std::string                     floatToHex              (double x) const;
index b119561..c1f4320 100644 (file)
@@ -103,14 +103,14 @@ void ObjectVector::resize (size_t newSize)
        }
        else if (oldSize > newSize)
        {
-               (m_gl.*m_traits.genFunc)(glw::GLsizei(oldSize - newSize), &m_objects[newSize]);
+               (m_gl.*m_traits.deleteFunc)(glw::GLsizei(oldSize - newSize), &m_objects[newSize]);
                m_objects.resize(newSize);
        }
 }
 
 void ObjectVector::clear (void)
 {
-       (m_gl.*m_traits.genFunc)(glw::GLsizei(m_objects.size()), &m_objects.front());
+       (m_gl.*m_traits.deleteFunc)(glw::GLsizei(m_objects.size()), &m_objects.front());
        m_objects.clear();
 }
 
index a72950b..45444d5 100644 (file)
@@ -672,6 +672,7 @@ void ShaderTextureFunctionCase::initTexture (void)
                        float   levelStep               = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1);
                        Vec4    cScale                  = fmtInfo.valueMax-fmtInfo.valueMin;
                        Vec4    cBias                   = fmtInfo.valueMin;
+                       Vec4    cCorner                 = cBias + cScale*0.5f;
                        int             baseCellSize    = de::min(m_textureSpec.width/4, m_textureSpec.height/4);
 
                        DE_ASSERT(m_textureSpec.width == m_textureSpec.height);
@@ -698,10 +699,10 @@ void ShaderTextureFunctionCase::initTexture (void)
                                                tcu::fillWithGrid(access, de::max(1, baseCellSize>>level), colorA, colorB);
 
                                                // Ensure all corners have identical colors in order to avoid dealing with ambiguous corner texel filtering
-                                               access.setPixel(colorA, 0, 0);
-                                               access.setPixel(colorA, 0, lastPix);
-                                               access.setPixel(colorA, lastPix, 0);
-                                               access.setPixel(colorA, lastPix, lastPix);
+                                               access.setPixel(cCorner, 0, 0);
+                                               access.setPixel(cCorner, 0, lastPix);
+                                               access.setPixel(cCorner, lastPix, 0);
+                                               access.setPixel(cCorner, lastPix, lastPix);
                                        }
                                }
                        }
index 7a3be4c..2a2ecc3 100644 (file)
@@ -309,7 +309,7 @@ struct ScalarTraits
 
        static Interval         doRound                 (const FloatFormat& fmt, T value)
        {
-               return fmt.roundOut(double(value));
+               return fmt.roundOut(double(value), false);
        }
 };
 
@@ -1784,7 +1784,7 @@ protected:
 
                // Allow either representable number on both sides of the exact value,
                // but require exactly representable values to be preserved.
-               return ctx.format.roundOut(exact);
+               return ctx.format.roundOut(exact, !deIsInf(x) && !deIsInf(y));
        }
 
        double                  precision               (const EvalContext&, double, double, double) const
@@ -1859,7 +1859,7 @@ public:
                        TCU_SET_INTERVAL_BOUNDS(ret, sum,
                                                                        sum = iargs.a.lo() + iargs.b.lo(),
                                                                        sum = iargs.a.hi() + iargs.b.hi());
-                       return ctx.format.convert(ctx.format.roundOut(ret));
+                       return ctx.format.convert(ctx.format.roundOut(ret, true));
                }
                return this->applyMonotone(ctx, iargs.a, iargs.b);
        }
@@ -1893,14 +1893,14 @@ public:
                                TCU_SET_INTERVAL_BOUNDS(ret, prod,
                                                                                prod = iargs.a.lo() * iargs.b.lo(),
                                                                                prod = iargs.a.hi() * iargs.b.hi());
-                               return ctx.format.convert(ctx.format.roundOut(ret));
+                               return ctx.format.convert(ctx.format.roundOut(ret, true));
                        }
                        if (a.lo() >= 0 && b.hi() <= 0)
                        {
                                TCU_SET_INTERVAL_BOUNDS(ret, prod,
                                                                                prod = iargs.a.hi() * iargs.b.lo(),
                                                                                prod = iargs.a.lo() * iargs.b.hi());
-                               return ctx.format.convert(ctx.format.roundOut(ret));
+                               return ctx.format.convert(ctx.format.roundOut(ret, true));
                        }
                }
                return this->applyMonotone(ctx, iargs.a, iargs.b);
@@ -1935,7 +1935,7 @@ public:
                        TCU_SET_INTERVAL_BOUNDS(ret, diff,
                                                                        diff = iargs.a.lo() - iargs.b.hi(),
                                                                        diff = iargs.a.hi() - iargs.b.lo());
-                       return ctx.format.convert(ctx.format.roundOut(ret));
+                       return ctx.format.convert(ctx.format.roundOut(ret, true));
 
                }
                else
index 0b6ecb7..6759ed6 100644 (file)
@@ -1,7 +1,6 @@
 
 message("*** Using X11 GLX target")
 set(DEQP_TARGET_NAME   "X11 GLX")
-set(DEQP_RUNTIME_LINK  ON)
 set(DEQP_SUPPORT_GLES2 ON)
 set(DEQP_SUPPORT_GLES3 ON)
 set(DEQP_SUPPORT_OPENGL        ON)