fix deqp reference texture lookup not adhearing to the ES2.0 spec language
authorJames Hauxwell <hauxwell@broadcom.com>
Thu, 27 Feb 2020 14:23:12 +0000 (14:23 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 26 Mar 2020 08:34:40 +0000 (04:34 -0400)
"If the magnification filter is given by LINEAR and the minification
filter is given by NEAREST_MIPMAP_NEAREST or NEAREST_MIPMAP_LINEAR,
then c = 0.5. This is done to ensure that a minified texture does not
appear “sharper” than a magnified texture. Otherwise c = 0"

This was removed in ES3.0

The reference rasterizer is ES3, so it needs to get the version of the
device under test (DUT) and change its behaviour acordingly

Components: GLES2

VK-GL-CTS issue: #890

Affects:
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_nearest_linear_clamp_rgba8888
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_nearest_linear_repeat_rgba8888
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_nearest_linear_mirror_rgba8888
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_linear_linear_clamp_rgba8888
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_linear_linear_repeat_rgba8888
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_linear_linear_mirror_rgba8888
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_nearest_linear_repeat_etc1
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_nearest_linear_mirror_etc1
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_linear_linear_repeat_etc1
dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_linear_linear_mirror_etc1
dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_nearest_linear_clamp
dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_nearest_linear_repeat
dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_nearest_linear_mirror
dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_linear_linear_clamp
dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_linear_linear_repeat
dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_linear_linear_mirror

Change-Id: I43024a13e0f63eb929da60d02c9722900c46506c

12 files changed:
framework/common/tcuTexture.cpp
framework/common/tcuTexture.hpp
framework/common/tcuTextureUtil.cpp
framework/delibs/debase/deDefs.h
framework/opengl/gluRenderContext.hpp
framework/opengl/gluTexture.cpp
framework/opengl/gluTextureTestUtil.cpp
framework/opengl/simplereference/sglrReferenceContext.cpp
framework/opengl/simplereference/sglrReferenceContext.hpp
modules/gles2/functional/es2fReadPixelsTests.cpp
modules/gles2/functional/es2fTextureMipmapTests.cpp
modules/gles2/functional/es2fTextureUnitTests.cpp

index 34b92cd..7a88665 100644 (file)
@@ -2223,9 +2223,9 @@ Vec4 sampleLevelArray1D (const ConstPixelBufferAccess* levels, int numLevels, co
        return sampleLevelArray1DOffset(levels, numLevels, sampler, s, lod, IVec2(0, depth)); // y-offset in 1D textures is layer selector
 }
 
-Vec4 sampleLevelArray2D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, int depth, float lod)
+Vec4 sampleLevelArray2D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, int depth, float lod, bool es2)
 {
-       return sampleLevelArray2DOffset(levels, numLevels, sampler, s, t, lod, IVec3(0, 0, depth)); // z-offset in 2D textures is layer selector
+       return sampleLevelArray2DOffset(levels, numLevels, sampler, s, t, lod, IVec3(0, 0, depth), es2); // z-offset in 2D textures is layer selector
 }
 
 Vec4 sampleLevelArray3D (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float r, float lod)
@@ -2273,9 +2273,15 @@ Vec4 sampleLevelArray1DOffset (const ConstPixelBufferAccess* levels, int numLeve
        }
 }
 
-Vec4 sampleLevelArray2DOffset (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float lod, const IVec3& offset)
+Vec4 sampleLevelArray2DOffset (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float lod, const IVec3& offset, bool es2)
 {
-       bool                                    magnified       = lod <= sampler.lodThreshold;
+       bool                                    magnified;
+
+       if (es2 && sampler.magFilter == Sampler::LINEAR &&
+               (sampler.minFilter == Sampler::NEAREST_MIPMAP_NEAREST || sampler.minFilter == Sampler::NEAREST_MIPMAP_LINEAR))
+               magnified = lod <= 0.5;
+       else
+               magnified = lod <= sampler.lodThreshold;
        Sampler::FilterMode             filterMode      = magnified ? sampler.magFilter : sampler.minFilter;
 
        switch (filterMode)
@@ -3281,11 +3287,11 @@ void Texture1D::allocLevel (int levelNdx)
 
 // Texture2D
 
-Texture2D::Texture2D (const TextureFormat& format, int width, int height)
+Texture2D::Texture2D (const TextureFormat& format, int width, int height, bool es2)
        : TextureLevelPyramid   (format, computeMipPyramidLevels(width, height))
        , m_width                               (width)
        , m_height                              (height)
-       , m_view                                (getNumLevels(), getLevels())
+       , m_view                                (getNumLevels(), getLevels(), es2)
 {
 }
 
@@ -3301,7 +3307,7 @@ Texture2D::Texture2D (const Texture2D& other)
        : TextureLevelPyramid   (other)
        , m_width                               (other.m_width)
        , m_height                              (other.m_height)
-       , m_view                                (getNumLevels(), getLevels())
+       , m_view                                (getNumLevels(), getLevels(), other.getView().isES2())
 {
 }
 
@@ -3314,7 +3320,7 @@ Texture2D& Texture2D::operator= (const Texture2D& other)
 
        m_width         = other.m_width;
        m_height        = other.m_height;
-       m_view          = Texture2DView(getNumLevels(), getLevels());
+       m_view          = Texture2DView(getNumLevels(), getLevels(), other.getView().isES2());
 
        return *this;
 }
@@ -3342,8 +3348,9 @@ TextureCubeView::TextureCubeView (void)
                m_levels[ndx] = DE_NULL;
 }
 
-TextureCubeView::TextureCubeView (int numLevels, const ConstPixelBufferAccess* const (&levels) [CUBEFACE_LAST])
+TextureCubeView::TextureCubeView (int numLevels, const ConstPixelBufferAccess* const (&levels) [CUBEFACE_LAST], bool es2)
        : m_numLevels(numLevels)
+       , m_es2(es2)
 {
        for (int ndx = 0; ndx < CUBEFACE_LAST; ndx++)
                m_levels[ndx] = levels[ndx];
@@ -3358,7 +3365,7 @@ tcu::Vec4 TextureCubeView::sample (const Sampler& sampler, float s, float t, flo
        if (sampler.seamlessCubeMap)
                return sampleLevelArrayCubeSeamless(m_levels, m_numLevels, coords.face, sampler, coords.s, coords.t, 0 /* depth */, lod);
        else
-               return sampleLevelArray2D(m_levels[coords.face], m_numLevels, sampler, coords.s, coords.t, 0 /* depth */, lod);
+               return sampleLevelArray2D(m_levels[coords.face], m_numLevels, sampler, coords.s, coords.t, 0 /* depth */, lod, m_es2);
 }
 
 float TextureCubeView::sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const
@@ -3424,7 +3431,7 @@ Vec4 TextureCubeView::gatherCompare (const Sampler& sampler, float ref, float s,
 
 // TextureCube
 
-TextureCube::TextureCube (const TextureFormat& format, int size)
+TextureCube::TextureCube (const TextureFormat& format, int size, bool es2)
        : m_format      (format)
        , m_size        (size)
 {
@@ -3438,7 +3445,7 @@ TextureCube::TextureCube (const TextureFormat& format, int size)
                levels[face] = &m_access[face][0];
        }
 
-       m_view = TextureCubeView(numLevels, levels);
+       m_view = TextureCubeView(numLevels, levels, es2);
 }
 
 TextureCube::TextureCube (const TextureCube& other)
@@ -3455,7 +3462,7 @@ TextureCube::TextureCube (const TextureCube& other)
                levels[face] = &m_access[face][0];
        }
 
-       m_view = TextureCubeView(numLevels, levels);
+       m_view = TextureCubeView(numLevels, levels, other.getView().isES2());
 
        for (int levelNdx = 0; levelNdx < numLevels; levelNdx++)
        {
@@ -3488,7 +3495,7 @@ TextureCube& TextureCube::operator= (const TextureCube& other)
 
        m_format        = other.m_format;
        m_size          = other.m_size;
-       m_view          = TextureCubeView(numLevels, levels);
+       m_view          = TextureCubeView(numLevels, levels, other.getView().isES2());
 
        for (int levelNdx = 0; levelNdx < numLevels; levelNdx++)
        {
@@ -3532,7 +3539,7 @@ void TextureCube::clearLevel (tcu::CubeFace face, int levelNdx)
 
 // Texture1DArrayView
 
-Texture1DArrayView::Texture1DArrayView (int numLevels, const ConstPixelBufferAccess* levels)
+Texture1DArrayView::Texture1DArrayView (int numLevels, const ConstPixelBufferAccess* levels, bool es2 DE_UNUSED_ATTR)
        : m_numLevels   (numLevels)
        , m_levels              (levels)
 {
@@ -3566,7 +3573,7 @@ float Texture1DArrayView::sampleCompareOffset (const Sampler& sampler, float ref
 
 // Texture2DArrayView
 
-Texture2DArrayView::Texture2DArrayView (int numLevels, const ConstPixelBufferAccess* levels)
+Texture2DArrayView::Texture2DArrayView (int numLevels, const ConstPixelBufferAccess* levels, bool es2 DE_UNUSED_ATTR)
        : m_numLevels   (numLevels)
        , m_levels              (levels)
 {
@@ -3704,7 +3711,7 @@ void Texture2DArray::allocLevel (int levelNdx)
 
 // Texture3DView
 
-Texture3DView::Texture3DView (int numLevels, const ConstPixelBufferAccess* levels)
+Texture3DView::Texture3DView (int numLevels, const ConstPixelBufferAccess* levels, bool es2 DE_UNUSED_ATTR)
        : m_numLevels   (numLevels)
        , m_levels              (levels)
 {
@@ -3762,7 +3769,7 @@ void Texture3D::allocLevel (int levelNdx)
 
 // TextureCubeArrayView
 
-TextureCubeArrayView::TextureCubeArrayView (int numLevels, const ConstPixelBufferAccess* levels)
+TextureCubeArrayView::TextureCubeArrayView (int numLevels, const ConstPixelBufferAccess* levels, bool es2 DE_UNUSED_ATTR)
        : m_numLevels   (numLevels)
        , m_levels              (levels)
 {
index 722cd11..752204c 100644 (file)
@@ -465,11 +465,11 @@ private:
 } DE_WARN_UNUSED_TYPE;
 
 Vec4   sampleLevelArray1D                              (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, int level, float lod);
-Vec4   sampleLevelArray2D                              (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, int depth, float lod);
+Vec4   sampleLevelArray2D                              (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, int depth, float lod, bool es2 = false);
 Vec4   sampleLevelArray3D                              (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float r, float lod);
 
 Vec4   sampleLevelArray1DOffset                (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float lod, const IVec2& offset);
-Vec4   sampleLevelArray2DOffset                (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float lod, const IVec3& offset);
+Vec4   sampleLevelArray2DOffset                (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float lod, const IVec3& offset, bool es2 = false);
 Vec4   sampleLevelArray3DOffset                (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float s, float t, float r, float lod, const IVec3& offset);
 
 float  sampleLevelArray1DCompare               (const ConstPixelBufferAccess* levels, int numLevels, const Sampler& sampler, float ref, float s, float lod, const IVec2& offset);
@@ -518,12 +518,13 @@ CubeFaceIntCoords         remapCubeEdgeCoords             (const CubeFaceIntCoords& coords, int si
 class Texture1DView
 {
 public:
-                                                                       Texture1DView           (int numLevels, const ConstPixelBufferAccess* levels);
+                                                                       Texture1DView           (int numLevels, const ConstPixelBufferAccess* levels, bool es2);
 
        int                                                             getNumLevels            (void) const    { return m_numLevels;                                                                           }
        int                                                             getWidth                        (void) const    { return m_numLevels > 0 ? m_levels[0].getWidth()       : 0;    }
        const ConstPixelBufferAccess&   getLevel                        (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx];   }
        const ConstPixelBufferAccess*   getLevels                       (void) const    { return m_levels;                                                                                      }
+       bool                                                            isES2                                   (void) const    { return false;                                                                                         }
 
        Vec4                                                    sample                          (const Sampler& sampler, float s, float lod) const;
        Vec4                                                    sampleOffset            (const Sampler& sampler, float s, float lod, deInt32 offset) const;
@@ -535,7 +536,7 @@ protected:
        const ConstPixelBufferAccess*   m_levels;
 } DE_WARN_UNUSED_TYPE;
 
-inline Texture1DView::Texture1DView (int numLevels, const ConstPixelBufferAccess* levels)
+inline Texture1DView::Texture1DView (int numLevels, const ConstPixelBufferAccess* levels, bool es2 DE_UNUSED_ATTR = false)
        : m_numLevels   (numLevels)
        , m_levels              (levels)
 {
@@ -568,13 +569,14 @@ inline float Texture1DView::sampleCompareOffset (const Sampler& sampler, float r
 class Texture2DView
 {
 public:
-                                                                       Texture2DView           (int numLevels, const ConstPixelBufferAccess* levels);
+                                                                       Texture2DView           (int numLevels, const ConstPixelBufferAccess* levels, bool es2 = false);
 
        int                                                             getNumLevels            (void) const    { return m_numLevels;                                                                           }
        int                                                             getWidth                        (void) const    { return m_numLevels > 0 ? m_levels[0].getWidth()       : 0;    }
        int                                                             getHeight                       (void) const    { return m_numLevels > 0 ? m_levels[0].getHeight()      : 0;    }
        const ConstPixelBufferAccess&   getLevel                        (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx];   }
        const ConstPixelBufferAccess*   getLevels                       (void) const    { return m_levels;                                                                                      }
+       bool                                                            isES2                                   (void) const    { return m_es2;                                                                                         }
 
        Vec4                                                    sample                          (const Sampler& sampler, float s, float t, float lod) const;
        Vec4                                                    sampleOffset            (const Sampler& sampler, float s, float t, float lod, const IVec2& offset) const;
@@ -587,18 +589,20 @@ public:
 protected:
        int                                                             m_numLevels;
        const ConstPixelBufferAccess*   m_levels;
+       bool                                                            m_es2;
 } DE_WARN_UNUSED_TYPE;
 
-inline Texture2DView::Texture2DView (int numLevels, const ConstPixelBufferAccess* levels)
+inline Texture2DView::Texture2DView (int numLevels, const ConstPixelBufferAccess* levels, bool es2)
        : m_numLevels   (numLevels)
        , m_levels              (levels)
+       , m_es2                 (es2)
 {
        DE_ASSERT(m_numLevels >= 0 && ((m_numLevels == 0) == !m_levels));
 }
 
 inline Vec4 Texture2DView::sample (const Sampler& sampler, float s, float t, float lod) const
 {
-       return sampleLevelArray2D(m_levels, m_numLevels, sampler, s, t, 0 /* depth */, lod);
+       return sampleLevelArray2D(m_levels, m_numLevels, sampler, s, t, 0 /* depth */, lod, m_es2);
 }
 
 inline Vec4 Texture2DView::sampleOffset (const Sampler& sampler, float s, float t, float lod, const IVec2& offset) const
@@ -721,7 +725,7 @@ inline float Texture1D::sampleCompareOffset (const Sampler& sampler, float ref,
 class Texture2D : private TextureLevelPyramid
 {
 public:
-                                                                       Texture2D                       (const TextureFormat& format, int width, int height);
+                                                                       Texture2D                       (const TextureFormat& format, int width, int height, bool es2 = false);
                                                                        Texture2D                       (const TextureFormat& format, int width, int height, int mipmaps);
                                                                        Texture2D                       (const Texture2D& other);
                                                                        ~Texture2D                      (void);
@@ -794,9 +798,10 @@ class TextureCubeView
 {
 public:
                                                                        TextureCubeView         (void);
-                                                                       TextureCubeView         (int numLevels, const ConstPixelBufferAccess* const (&levels)[CUBEFACE_LAST]);
+                                                                       TextureCubeView         (int numLevels, const ConstPixelBufferAccess* const (&levels)[CUBEFACE_LAST], bool es2 = false);
 
        int                                                             getNumLevels            (void) const    { return m_numLevels;                                                                           }
+       bool                                                            isES2                                   (void) const    { return m_es2;                                                                                         }
        int                                                             getSize                         (void) const    { return m_numLevels > 0 ? m_levels[0][0].getWidth() : 0;       }
        const ConstPixelBufferAccess&   getLevelFace            (int ndx, CubeFace face) const  { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[face][ndx];     }
        const ConstPixelBufferAccess*   getFaceLevels           (CubeFace face) const                   { return m_levels[face];                                        }
@@ -810,6 +815,7 @@ public:
 protected:
        int                                                             m_numLevels;
        const ConstPixelBufferAccess*   m_levels[CUBEFACE_LAST];
+       bool                                                            m_es2;
 } DE_WARN_UNUSED_TYPE;
 
 /*--------------------------------------------------------------------*//*!
@@ -818,12 +824,13 @@ protected:
 class TextureCube
 {
 public:
-                                                                       TextureCube                     (const TextureFormat& format, int size);
+                                                                       TextureCube                     (const TextureFormat& format, int size, bool es2 = false);
                                                                        TextureCube                     (const TextureCube& other);
                                                                        ~TextureCube            (void);
 
        const TextureFormat&                    getFormat                       (void) const    { return m_format;      }
        int                                                             getSize                         (void) const    { return m_size;        }
+       const TextureCubeView&          getView                         (void) const    { return m_view;        }
 
        int                                                             getNumLevels            (void) const                                    { return (int)m_access[0].size();       }
        const ConstPixelBufferAccess&   getLevelFace            (int ndx, CubeFace face) const  { DE_ASSERT(de::inBounds(ndx, 0, getNumLevels())); return m_access[face][(size_t)ndx];  }
@@ -879,13 +886,14 @@ inline Vec4 TextureCube::gatherCompare (const Sampler& sampler, float ref, float
 class Texture1DArrayView
 {
 public:
-                                                                       Texture1DArrayView      (int numLevels, const ConstPixelBufferAccess* levels);
+                                                                       Texture1DArrayView      (int numLevels, const ConstPixelBufferAccess* levels, bool es2 = false);
 
        int                                                             getWidth                        (void) const    { return m_numLevels > 0 ? m_levels[0].getWidth()       : 0;    }
        int                                                             getNumLayers            (void) const    { return m_numLevels > 0 ? m_levels[0].getHeight()      : 0;    }
        int                                                             getNumLevels            (void) const    { return m_numLevels;                                                                           }
        const ConstPixelBufferAccess&   getLevel                        (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx];   }
        const ConstPixelBufferAccess*   getLevels                       (void) const    { return m_levels;                                                                                      }
+       bool                                                            isES2                                           (void) const    { return false;                                                                                         }
 
        Vec4                                                    sample                          (const Sampler& sampler, float s, float t, float lod) const;
        Vec4                                                    sampleOffset            (const Sampler& sampler, float s, float t, float lod, deInt32 offset) const;
@@ -905,7 +913,7 @@ protected:
 class Texture2DArrayView
 {
 public:
-                                                                       Texture2DArrayView      (int numLevels, const ConstPixelBufferAccess* levels);
+                                                                       Texture2DArrayView      (int numLevels, const ConstPixelBufferAccess* levels, bool es2 = false);
 
        int                                                             getWidth                        (void) const    { return m_numLevels > 0 ? m_levels[0].getWidth()       : 0;    }
        int                                                             getHeight                       (void) const    { return m_numLevels > 0 ? m_levels[0].getHeight()      : 0;    }
@@ -913,6 +921,7 @@ public:
        int                                                             getNumLevels            (void) const    { return m_numLevels;                                                                           }
        const ConstPixelBufferAccess&   getLevel                        (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx];   }
        const ConstPixelBufferAccess*   getLevels                       (void) const    { return m_levels;                                                                                      }
+       bool                                                            isES2                                           (void) const    { return false;                                                                                         }
 
        Vec4                                                    sample                          (const Sampler& sampler, float s, float t, float r, float lod) const;
        Vec4                                                    sampleOffset            (const Sampler& sampler, float s, float t, float r, float lod, const IVec2& offset) const;
@@ -1062,7 +1071,7 @@ inline Vec4 Texture2DArray::gatherOffsetsCompare (const Sampler& sampler, float
 class Texture3DView
 {
 public:
-                                                                       Texture3DView           (int numLevels, const ConstPixelBufferAccess* levels);
+                                                                       Texture3DView           (int numLevels, const ConstPixelBufferAccess* levels, bool es2 = false);
 
        int                                                             getWidth                        (void) const    { return m_numLevels > 0 ? m_levels[0].getWidth()       : 0;    }
        int                                                             getHeight                       (void) const    { return m_numLevels > 0 ? m_levels[0].getHeight()      : 0;    }
@@ -1070,6 +1079,7 @@ public:
        int                                                             getNumLevels            (void) const    { return m_numLevels;                                                                           }
        const ConstPixelBufferAccess&   getLevel                        (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx];   }
        const ConstPixelBufferAccess*   getLevels                       (void) const    { return m_levels;                                                                                      }
+       bool                                                            isES2                                           (void) const    { return false;                                                                                         }
 
        Vec4                                                    sample                          (const Sampler& sampler, float s, float t, float r, float lod) const;
        Vec4                                                    sampleOffset            (const Sampler& sampler, float s, float t, float r, float lod, const IVec3& offset) const;
@@ -1141,7 +1151,7 @@ inline Vec4 Texture3D::sampleOffset (const Sampler& sampler, float s, float t, f
 class TextureCubeArrayView
 {
 public:
-                                                                       TextureCubeArrayView    (int numLevels, const ConstPixelBufferAccess* levels);
+                                                                       TextureCubeArrayView    (int numLevels, const ConstPixelBufferAccess* levels, bool es2 = false);
 
        int                                                             getSize                                 (void) const    { return m_numLevels > 0 ? m_levels[0].getWidth()       : 0;    }
        int                                                             getDepth                                (void) const    { return m_numLevels > 0 ? m_levels[0].getDepth()       : 0;    }
@@ -1149,6 +1159,7 @@ public:
        int                                                             getNumLevels                    (void) const    { return m_numLevels;                                                                           }
        const ConstPixelBufferAccess&   getLevel                                (int ndx) const { DE_ASSERT(de::inBounds(ndx, 0, m_numLevels)); return m_levels[ndx];   }
        const ConstPixelBufferAccess*   getLevels                               (void) const    { return m_levels;                                                                                      }
+       bool                                                                    isES2                                           (void) const    { return false;                                                                                         }
 
        Vec4                                                    sample                                  (const Sampler& sampler, float s, float t, float r, float q, float lod) const;
        Vec4                                                    sampleOffset                    (const Sampler& sampler, float s, float t, float r, float q, float lod, const IVec2& offset) const;
index 4687713..47623e8 100644 (file)
@@ -1465,7 +1465,7 @@ ViewType getEffectiveTView (const ViewType& src, std::vector<tcu::ConstPixelBuff
 {
        storage.resize(src.getNumLevels());
 
-       ViewType view = ViewType(src.getNumLevels(), &storage[0]);
+       ViewType view = ViewType(src.getNumLevels(), &storage[0], src.isES2());
 
        for (int levelNdx = 0; levelNdx < src.getNumLevels(); ++levelNdx)
                storage[levelNdx] = tcu::getEffectiveDepthStencilAccess(src.getLevel(levelNdx), sampler.depthStencilMode);
@@ -1487,7 +1487,7 @@ tcu::TextureCubeView getEffectiveTView (const tcu::TextureCubeView& src, std::ve
                &storage[5 * src.getNumLevels()],
        };
 
-       tcu::TextureCubeView view = tcu::TextureCubeView(src.getNumLevels(), storagePtrs);
+       tcu::TextureCubeView view = tcu::TextureCubeView(src.getNumLevels(), storagePtrs, false);
 
        for (int faceNdx = 0; faceNdx < tcu::CUBEFACE_LAST; ++faceNdx)
        for (int levelNdx = 0; levelNdx < src.getNumLevels(); ++levelNdx)
index 4edc5e8..314d2ad 100644 (file)
@@ -305,14 +305,14 @@ DE_INLINE deBool deGetTrue (void) { return DE_TRUE; }
 
 #if (DE_COMPILER == DE_COMPILER_GCC) || (DE_COMPILER == DE_COMPILER_CLANG)
        /* GCC 4.8 and newer warns about unused typedefs. */
-#      define DE_UNUSED_TYPEDEF_ATTR __attribute__((unused))
+#      define DE_UNUSED_ATTR __attribute__((unused))
 #else
-#      define DE_UNUSED_TYPEDEF_ATTR
+#      define DE_UNUSED_ATTR
 #endif
 
 /** Compile-time assertion macro. */
-#define DE_STATIC_ASSERT(X)                                            typedef char DE_UNIQUE_NAME[(X) ? 1 : -1] DE_UNUSED_TYPEDEF_ATTR
-#define DE_HEADER_STATIC_ASSERT(HEADERTOKEN, X)        typedef char DE_HEADER_UNIQUE_NAME(HEADERTOKEN)[(X) ? 1 : -1] DE_UNUSED_TYPEDEF_ATTR
+#define DE_STATIC_ASSERT(X)                                            typedef char DE_UNIQUE_NAME[(X) ? 1 : -1] DE_UNUSED_ATTR
+#define DE_HEADER_STATIC_ASSERT(HEADERTOKEN, X)        typedef char DE_HEADER_UNIQUE_NAME(HEADERTOKEN)[(X) ? 1 : -1] DE_UNUSED_ATTR
 
 #define DE_UNIQUE_NAME                                         DE_MAKE_NAME(__LINE__, hoax)
 #define DE_HEADER_UNIQUE_NAME(HEADERTOKEN)     DE_MAKE_NAME(__LINE__, HEADERTOKEN)
index e17cb59..2fd4fb4 100644 (file)
@@ -191,6 +191,7 @@ inline deUint32 ContextType::pack (deUint32 apiBits, ContextFlags flags)
 inline bool            isContextTypeES                         (ContextType type)      { return type.getAPI().getProfile() == PROFILE_ES;                              }
 inline bool            isContextTypeGLCore                     (ContextType type)      { return type.getAPI().getProfile() == PROFILE_CORE;                    }
 inline bool            isContextTypeGLCompatibility(ContextType type)  { return type.getAPI().getProfile() == PROFILE_COMPATIBILITY;   }
+inline bool            isES2Context                            (ContextType type)      { return isContextTypeES(type) && type.getMajorVersion() == 2; }
 bool                   contextSupports                         (ContextType ctxType, ApiType requiredApiType);
 
 const char*            getApiTypeDescription           (ApiType type);
index dc1ba0c..daf2bb4 100644 (file)
@@ -106,7 +106,7 @@ Texture2D::Texture2D (const RenderContext& context, deUint32 format, deUint32 da
        : m_context                     (context)
        , m_isCompressed        (false)
        , m_format                      (format)
-       , m_refTexture          (mapGLTransferFormat(format, dataType), width, height)
+       , m_refTexture          (mapGLTransferFormat(format, dataType), width, height, isES2Context(context.getType()))
        , m_glTexture           (0)
 {
        const glw::Functions& gl = context.getFunctions();
@@ -118,7 +118,7 @@ Texture2D::Texture2D (const RenderContext& context, deUint32 sizedFormat, int wi
        : m_context                     (context)
        , m_isCompressed        (false)
        , m_format                      (sizedFormat)
-       , m_refTexture          (mapGLInternalFormat(sizedFormat), width, height)
+       , m_refTexture          (mapGLInternalFormat(sizedFormat), width, height, isES2Context(context.getType()))
        , m_glTexture           (0)
 {
        const glw::Functions& gl = context.getFunctions();
@@ -130,7 +130,7 @@ Texture2D::Texture2D (const RenderContext& context, const ContextInfo& contextIn
        : m_context                     (context)
        , m_isCompressed        (true)
        , m_format                      (getGLFormat(levels[0].getFormat()))
-       , m_refTexture          (getUncompressedFormat(levels[0].getFormat()), levels[0].getWidth(), levels[0].getHeight())
+       , m_refTexture          (getUncompressedFormat(levels[0].getFormat()), levels[0].getWidth(), levels[0].getHeight(), isES2Context(context.getType()))
        , m_glTexture           (0)
 {
        const glw::Functions& gl = context.getFunctions();
@@ -323,7 +323,7 @@ TextureCube::TextureCube (const RenderContext& context, const ContextInfo& conte
        : m_context                     (context)
        , m_isCompressed        (true)
        , m_format                      (getGLFormat(levels[0].getFormat()))
-       , m_refTexture          (getUncompressedFormat(levels[0].getFormat()), levels[0].getWidth())
+       , m_refTexture          (getUncompressedFormat(levels[0].getFormat()), levels[0].getWidth(), isES2Context(context.getType()))
        , m_glTexture           (0)
 {
        const glw::Functions& gl = m_context.getFunctions();
@@ -351,7 +351,7 @@ TextureCube::TextureCube (const RenderContext& context, deUint32 format, deUint3
        : m_context                     (context)
        , m_isCompressed        (false)
        , m_format                      (format)
-       , m_refTexture          (mapGLTransferFormat(format, dataType), size)
+       , m_refTexture          (mapGLTransferFormat(format, dataType), size, isES2Context(context.getType()))
        , m_glTexture           (0)
 {
        const glw::Functions& gl = m_context.getFunctions();
@@ -363,7 +363,7 @@ TextureCube::TextureCube (const RenderContext& context, deUint32 internalFormat,
        : m_context                     (context)
        , m_isCompressed        (false)
        , m_format                      (internalFormat)
-       , m_refTexture          (mapGLInternalFormat(internalFormat), size)
+       , m_refTexture          (mapGLInternalFormat(internalFormat), size, isES2Context(context.getType()))
        , m_glTexture           (0)
 {
        const glw::Functions& gl = m_context.getFunctions();
index 6d21b48..7f8a3e9 100644 (file)
@@ -113,7 +113,7 @@ static tcu::Texture2DView getSubView (const tcu::Texture2DView& view, int baseLe
        const int       clampedBase     = de::clamp(baseLevel, 0, view.getNumLevels()-1);
        const int       clampedMax      = de::clamp(maxLevel, clampedBase, view.getNumLevels()-1);
        const int       numLevels       = clampedMax-clampedBase+1;
-       return tcu::Texture2DView(numLevels, view.getLevels()+clampedBase);
+       return tcu::Texture2DView(numLevels, view.getLevels()+clampedBase, view.isES2());
 }
 
 static tcu::TextureCubeView getSubView (const tcu::TextureCubeView& view, int baseLevel, int maxLevel)
index 01efe1d..d781b81 100644 (file)
@@ -324,7 +324,7 @@ ReferenceContext::ReferenceContext (const ReferenceContextLimits& limits, const
        , m_activeTexture                                       (0)
        , m_textureUnits                                        (m_limits.maxTextureImageUnits)
        , m_emptyTex1D                                          ()
-       , m_emptyTex2D                                          ()
+       , m_emptyTex2D                                          (isES2Context(limits.contextType))
        , m_emptyTexCube                                        ()
        , m_emptyTex2DArray                                     ()
        , m_emptyTex3D                                          ()
@@ -4825,9 +4825,9 @@ void Texture1D::updateView (tcu::Sampler::DepthStencilMode mode)
                m_view = tcu::Texture2DView(0, DE_NULL);
 }
 
-Texture2D::Texture2D (deUint32 name)
+Texture2D::Texture2D (deUint32 name, bool es2)
        : Texture       (name, TYPE_2D)
-       , m_view        (0, DE_NULL)
+       , m_view        (0, DE_NULL, es2)
 {
 }
 
index 1cf88f2..b9aca1a 100644 (file)
@@ -167,7 +167,7 @@ private:
 class Texture2D : public Texture
 {
 public:
-                                                                               Texture2D               (deUint32 name = 0);
+                                                                               Texture2D               (deUint32 name = 0, bool es2 = false);
        virtual                                                         ~Texture2D              (void);
 
        void                                                            clearLevels             (void) { m_levels.clear(); }
index b71274b..9a49611 100644 (file)
@@ -181,7 +181,7 @@ TestCase::IterateResult ReadPixelsTest::iterate (void)
        getFormatInfo(format, glFormat, glType, pixelSize);
        m_testCtx.getLog() << tcu::TestLog::Message << "Format: " << glu::getTextureFormatStr(glFormat) << ", Type: " << glu::getTypeStr(glType) << tcu::TestLog::EndMessage;
 
-       tcu::Texture2D reference(format, width, height);
+       tcu::Texture2D reference(format, width, height, glu::isES2Context(m_context.getRenderContext().getType()));
        reference.allocLevel(0);
 
        GLU_CHECK_CALL(glViewport(0, 0, width, height));
@@ -221,8 +221,8 @@ TestCase::IterateResult ReadPixelsTest::iterate (void)
                const deUint8           alphaThreshold  = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits,     formatBitDepths.w()))));
 
                // bilinearCompare only accepts RGBA, UINT8
-               tcu::Texture2D          referenceRGBA8  (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), width, height);
-               tcu::Texture2D          resultRGBA8             (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), width, height);
+               tcu::Texture2D          referenceRGBA8  (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), width, height, glu::isES2Context(m_context.getRenderContext().getType()));
+               tcu::Texture2D          resultRGBA8             (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), width, height, glu::isES2Context(m_context.getRenderContext().getType()));
 
                referenceRGBA8.allocLevel(0);
                resultRGBA8.allocLevel(0);
index 6ba4c5f..bbf9cd6 100644 (file)
@@ -821,7 +821,7 @@ Texture2DGenMipmapCase::IterateResult Texture2DGenMipmapCase::iterate (void)
 
        const int                               numLevels                       = deLog2Floor32(de::max(m_width, m_height))+1;
 
-       tcu::Texture2D                  resultTexture           (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_texture->getRefTexture().getWidth(), m_texture->getRefTexture().getHeight());
+       tcu::Texture2D                  resultTexture           (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_texture->getRefTexture().getWidth(), m_texture->getRefTexture().getHeight(), isES2Context(m_renderCtx.getType()));
 
        vector<float>                   texCoord;
 
index 439b2e8..1af1c3c 100644 (file)
@@ -672,7 +672,7 @@ void TextureUnitCase::init (void)
                        if (is2d)
                        {
                                m_ndx2dOrCube.push_back((int)m_textures2d.size()); // Remember the index this texture has in the 2d array.
-                               m_textures2d.push_back(new tcu::Texture2D(glu::mapGLTransferFormat(params.format, params.dataType), texWidth, texHeight));
+                               m_textures2d.push_back(new tcu::Texture2D(glu::mapGLTransferFormat(params.format, params.dataType), texWidth, texHeight, isES2Context(m_context.getRenderContext().getType())));
                        }
                        else
                        {