Add CTS_ARB_gl_spirv test implementation
[platform/upstream/VK-GL-CTS.git] / modules / internal / ditTextureFormatTests.cpp
index 6cfa441..7cbc5f8 100644 (file)
@@ -1029,6 +1029,88 @@ static const deUint32 s_floatUnsignedInt248RevUintRef[] =
        0x000000b3, 0x00000000, 0x00000000, 0x00000001,
 };
 
+static const deUint8 s_unormShort10In[] =
+{
+       0x80, 0x84, 0x40, 0x3b,
+       0x40, 0xfd, 0x80, 0x1a,
+       0x80, 0x0c, 0x80, 0x15,
+       0x40, 0x11, 0x80, 0xc3,
+       0x80, 0xc8, 0x80, 0xd5,
+       0xc0, 0xf9, 0x00, 0x0a,
+       0xc0, 0x39, 0x40, 0xd5,
+       0xc0, 0x4d, 0xc0, 0x26
+};
+static const deUint32 s_unormShort10FloatRef[] =
+{
+       0x3f04a128, 0x3e6d3b4f,
+       0x3f7d7f60, 0x3dd4350d,
+       0x3d48320d, 0x3dac2b0b,
+       0x3d8a2289, 0x3f43b0ec,
+       0x3f48b22d, 0x3f55b56d,
+       0x3f79fe80, 0x3d20280a,
+       0x3e6739ce, 0x3f55755d,
+       0x3e9ba6ea, 0x3e1b26ca
+};
+static const deUint32 s_unormShort10UintRef[] =
+{
+       0x212, 0x0ed, 0x3f5, 0x06a,
+       0x032, 0x056, 0x045, 0x30e,
+       0x322, 0x356, 0x3e7, 0x028,
+       0x0e7, 0x355, 0x137, 0x09b,
+};
+static const deUint32 s_unormShort10IntRef[] =
+{
+       0x212, 0x0ed, 0x3f5, 0x06a,
+       0x032, 0x056, 0x045, 0x30e,
+       0x322, 0x356, 0x3e7, 0x028,
+       0x0e7, 0x355, 0x137, 0x09b,
+};
+
+static const deUint8 s_unormShort12In[] =
+{
+       0x30, 0x46, 0xf0, 0x38,
+       0x90, 0x85, 0xf0, 0x88,
+       0x90, 0x92, 0x30, 0x5d,
+       0x30, 0x3a, 0x00, 0xc9,
+       0x00, 0x64, 0xb0, 0x9b,
+       0x20, 0x71, 0xd0, 0x5b,
+       0xa0, 0xc5, 0x70, 0x27,
+       0x30, 0x0b, 0xa0, 0x53
+};
+static const deUint32 s_unormShort12FloatRef[] =
+{
+       0x3e8c68c7, 0x3e63ce3d,
+       0x3f05985a, 0x3f08f890,
+       0x3f12992a, 0x3eba6ba7,
+       0x3e68ce8d, 0x3f490c91,
+       0x3ec80c81, 0x3f1bb9bc,
+       0x3ee24e25, 0x3eb7ab7b,
+       0x3f45ac5b, 0x3e1dc9dd,
+       0x3d330b31, 0x3ea74a75
+};
+static const deUint32 s_unormShort12UintRef[] =
+{
+       0x463, 0x38f,
+       0x859, 0x88f,
+       0x929, 0x5d3,
+       0x3a3, 0xc90,
+       0x640, 0x9bb,
+       0x712, 0x5bd,
+       0xc5a, 0x277,
+       0x0b3, 0x53a
+};
+static const deUint32 s_unormShort12IntRef[] =
+{
+       0x463, 0x38f,
+       0x859, 0x88f,
+       0x929, 0x5d3,
+       0x3a3, 0xc90,
+       0x640, 0x9bb,
+       0x712, 0x5bd,
+       0xc5a, 0x277,
+       0x0b3, 0x53a
+};
+
 // \todo [2015-10-12 pyry] Collapse duplicate ref arrays
 
 static const struct
@@ -1085,6 +1167,9 @@ static const struct
        { s_floatIn,                                    DE_LENGTH_OF_ARRAY(s_floatIn),                                          s_floatFloatRef,                                        s_floatIntRef,                                  s_floatUintRef                                  },
        { s_float64In,                                  DE_LENGTH_OF_ARRAY(s_float64In),                                        s_float64FloatRef,                                      s_float64IntRef,                                s_float64IntRef                                 },
        { s_floatUnsignedInt248RevIn,   DE_LENGTH_OF_ARRAY(s_floatUnsignedInt248RevIn),         s_floatUnsignedInt248RevFloatRef,       DE_NULL,                                                s_floatUnsignedInt248RevUintRef },
+
+       { s_unormShort10In,                             DE_LENGTH_OF_ARRAY(s_unormShort10In),                           s_unormShort10FloatRef,                         s_unormShort10IntRef,                   s_unormShort10UintRef                   },
+       { s_unormShort12In,                             DE_LENGTH_OF_ARRAY(s_unormShort12In),                           s_unormShort12FloatRef,                         s_unormShort12IntRef,                   s_unormShort12UintRef                   },
 };
 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_formatData) == TextureFormat::CHANNELTYPE_LAST);
 
@@ -1324,13 +1409,18 @@ protected:
 
        void verifyRead (const ConstPixelBufferAccess& src)
        {
+               // \todo [2016-08-04 pyry] Overflow in float->int conversion is not defined and
+               //                                                 produces different results depending on arch.
+               const bool      isFloat32Or64   = src.getFormat().type == tcu::TextureFormat::FLOAT ||
+                                                                         src.getFormat().type == tcu::TextureFormat::FLOAT64;
+
                if (isAccessValid(src.getFormat(), tcu::TEXTUREACCESSTYPE_FLOAT))
                        verifyRead<float>(src);
 
-               if (isAccessValid(src.getFormat(), tcu::TEXTUREACCESSTYPE_UNSIGNED_INT))
+               if (isAccessValid(src.getFormat(), tcu::TEXTUREACCESSTYPE_UNSIGNED_INT) && !isFloat32Or64)
                        verifyRead<deUint32>(src);
 
-               if (isAccessValid(src.getFormat(), tcu::TEXTUREACCESSTYPE_SIGNED_INT))
+               if (isAccessValid(src.getFormat(), tcu::TEXTUREACCESSTYPE_SIGNED_INT) && !isFloat32Or64)
                        verifyRead<deInt32>(src);
        }