DO NOT MERGE CP vertex array test and warning fixes
authorJarkko Pöyry <jpoyry@google.com>
Wed, 20 May 2015 02:31:53 +0000 (19:31 -0700)
committerKalle Raita <kraita@google.com>
Tue, 19 Jul 2016 17:21:44 +0000 (10:21 -0700)
Cherry-pick fix to vertex array tests and a preceding conversion warning
fix for Marshmallow CTS for the files affected by the vertex array test fix.

8ed28c1e05f2325dc4b20c8f471067b29188c82f
Snap values to 3x3 grid in vertex array tests

This avoids cases where on small resolutions tests would fail because some
geometry was not visible or hidden in both result and reference.

Bug: 23495935

c8e526bfc2141e1cb7a269483fb55dc2a8e77c11
Fix -Wconversion warnings in glshared.

Bug: 21161908
Change-Id: If346e35335863344494c2513782e0b42d9a408e2

modules/glshared/glsVertexArrayTests.cpp
modules/glshared/glsVertexArrayTests.hpp

index e5ec808..4a2ad2c 100644 (file)
@@ -172,21 +172,21 @@ int Array::inputTypeSize (InputType type)
 {
        static const int size[] =
        {
-               sizeof(float),          // INPUTTYPE_FLOAT = 0,
-               sizeof(deInt32),        // INPUTTYPE_FIXED,
-               sizeof(double),         // INPUTTYPE_DOUBLE
+               (int)sizeof(float),                     // INPUTTYPE_FLOAT = 0,
+               (int)sizeof(deInt32),           // INPUTTYPE_FIXED,
+               (int)sizeof(double),            // INPUTTYPE_DOUBLE
 
-               sizeof(deInt8),         // INPUTTYPE_BYTE,
-               sizeof(deInt16),        // INPUTTYPE_SHORT,
+               (int)sizeof(deInt8),            // INPUTTYPE_BYTE,
+               (int)sizeof(deInt16),           // INPUTTYPE_SHORT,
 
-               sizeof(deUint8),        // INPUTTYPE_UNSIGNED_BYTE,
-               sizeof(deUint16),       // INPUTTYPE_UNSIGNED_SHORT,
+               (int)sizeof(deUint8),           // INPUTTYPE_UNSIGNED_BYTE,
+               (int)sizeof(deUint16),          // INPUTTYPE_UNSIGNED_SHORT,
 
-               sizeof(deInt32),                // INPUTTYPE_INT,
-               sizeof(deUint32),               // INPUTTYPE_UNSIGNED_INT,
-               sizeof(deFloat16),              // INPUTTYPE_HALF,
-               sizeof(deUint32) / 4,           // INPUTTYPE_UNSIGNED_INT_2_10_10_10,
-               sizeof(deUint32) / 4            // INPUTTYPE_INT_2_10_10_10,
+               (int)sizeof(deInt32),           // INPUTTYPE_INT,
+               (int)sizeof(deUint32),          // INPUTTYPE_UNSIGNED_INT,
+               (int)sizeof(deFloat16),         // INPUTTYPE_HALF,
+               (int)sizeof(deUint32) / 4,      // INPUTTYPE_UNSIGNED_INT_2_10_10_10,
+               (int)sizeof(deUint32) / 4       // INPUTTYPE_INT_2_10_10_10,
        };
 
        return de::getSizedArrayElement<Array::INPUTTYPE_LAST>(size, (int)type);
@@ -234,7 +234,7 @@ inline GLValue::Short getRandom (deRandom& rnd, GLValue::Short min, GLValue::Sho
        if (max < min)
                return min;
 
-       return GLValue::Short::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+       return GLValue::Short::create((min == max ? min : (deInt16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -243,7 +243,7 @@ inline GLValue::Ushort getRandom (deRandom& rnd, GLValue::Ushort min, GLValue::U
        if (max < min)
                return min;
 
-       return GLValue::Ushort::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+       return GLValue::Ushort::create((min == max ? min : (deUint16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -252,7 +252,7 @@ inline GLValue::Byte getRandom (deRandom& rnd, GLValue::Byte min, GLValue::Byte
        if (max < min)
                return min;
 
-       return GLValue::Byte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+       return GLValue::Byte::create((min == max ? min : (deInt8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -261,7 +261,7 @@ inline GLValue::Ubyte getRandom (deRandom& rnd, GLValue::Ubyte min, GLValue::Uby
        if (max < min)
                return min;
 
-       return GLValue::Ubyte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+       return GLValue::Ubyte::create((min == max ? min : (deUint8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
 }
 
 template<>
@@ -1308,12 +1308,12 @@ class RandomArrayGenerator
 {
 public:
        static char*    generateArray                   (int seed, GLValue min, GLValue max, int count, int componentCount, int stride, Array::InputType type);
-       static char*    generateQuads                   (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, Array::InputType type, GLValue min, GLValue max);
+       static char*    generateQuads                   (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, Array::InputType type, GLValue min, GLValue max, float gridSize);
        static char*    generatePerQuad                 (int seed, int count, int componentCount, int stride, Array::Primitive primitive, Array::InputType type, GLValue min, GLValue max);
 
 private:
        template<typename T>
-       static char*    createQuads             (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, T min, T max);
+       static char*    createQuads             (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, T min, T max, float gridSize);
        template<typename T>
        static char*    createPerQuads  (int seed, int count, int componentCount, int stride, Array::Primitive primitive, T min, T max);
        static char*    createQuadsPacked (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive);
@@ -1413,50 +1413,50 @@ char* RandomArrayGenerator::generateArray (int seed, GLValue min, GLValue max, i
        return data;
 }
 
-char* RandomArrayGenerator::generateQuads (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, Array::InputType type, GLValue min, GLValue max)
+char* RandomArrayGenerator::generateQuads (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, Array::InputType type, GLValue min, GLValue max, float gridSize)
 {
        char* data = DE_NULL;
 
        switch (type)
        {
                case Array::INPUTTYPE_FLOAT:
-                       data = createQuads<GLValue::Float>(seed, count, componentCount, offset, stride, primitive, min.fl, max.fl);
+                       data = createQuads<GLValue::Float>(seed, count, componentCount, offset, stride, primitive, min.fl, max.fl, gridSize);
                        break;
 
                case Array::INPUTTYPE_FIXED:
-                       data = createQuads<GLValue::Fixed>(seed, count, componentCount, offset, stride, primitive, min.fi, max.fi);
+                       data = createQuads<GLValue::Fixed>(seed, count, componentCount, offset, stride, primitive, min.fi, max.fi, gridSize);
                        break;
 
                case Array::INPUTTYPE_DOUBLE:
-                       data = createQuads<GLValue::Double>(seed, count, componentCount, offset, stride, primitive, min.d, max.d);
+                       data = createQuads<GLValue::Double>(seed, count, componentCount, offset, stride, primitive, min.d, max.d, gridSize);
                        break;
 
                case Array::INPUTTYPE_BYTE:
-                       data = createQuads<GLValue::Byte>(seed, count, componentCount, offset, stride, primitive, min.b, max.b);
+                       data = createQuads<GLValue::Byte>(seed, count, componentCount, offset, stride, primitive, min.b, max.b, gridSize);
                        break;
 
                case Array::INPUTTYPE_SHORT:
-                       data = createQuads<GLValue::Short>(seed, count, componentCount, offset, stride, primitive, min.s, max.s);
+                       data = createQuads<GLValue::Short>(seed, count, componentCount, offset, stride, primitive, min.s, max.s, gridSize);
                        break;
 
                case Array::INPUTTYPE_UNSIGNED_BYTE:
-                       data = createQuads<GLValue::Ubyte>(seed, count, componentCount, offset, stride, primitive, min.ub, max.ub);
+                       data = createQuads<GLValue::Ubyte>(seed, count, componentCount, offset, stride, primitive, min.ub, max.ub, gridSize);
                        break;
 
                case Array::INPUTTYPE_UNSIGNED_SHORT:
-                       data = createQuads<GLValue::Ushort>(seed, count, componentCount, offset, stride, primitive, min.us, max.us);
+                       data = createQuads<GLValue::Ushort>(seed, count, componentCount, offset, stride, primitive, min.us, max.us, gridSize);
                        break;
 
                case Array::INPUTTYPE_UNSIGNED_INT:
-                       data = createQuads<GLValue::Uint>(seed, count, componentCount, offset, stride, primitive, min.ui, max.ui);
+                       data = createQuads<GLValue::Uint>(seed, count, componentCount, offset, stride, primitive, min.ui, max.ui, gridSize);
                        break;
 
                case Array::INPUTTYPE_INT:
-                       data = createQuads<GLValue::Int>(seed, count, componentCount, offset, stride, primitive, min.i, max.i);
+                       data = createQuads<GLValue::Int>(seed, count, componentCount, offset, stride, primitive, min.i, max.i, gridSize);
                        break;
 
                case Array::INPUTTYPE_HALF:
-                       data = createQuads<GLValue::Half>(seed, count, componentCount, offset, stride, primitive, min.h, max.h);
+                       data = createQuads<GLValue::Half>(seed, count, componentCount, offset, stride, primitive, min.h, max.h, gridSize);
                        break;
 
                case Array::INPUTTYPE_INT_2_10_10_10:
@@ -1545,13 +1545,20 @@ char* RandomArrayGenerator::createQuadsPacked (int seed, int count, int componen
 }
 
 template<typename T>
-char* RandomArrayGenerator::createQuads (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, T min, T max)
+T roundTo (const T& step, const T& value)
+{
+       return value - (value % step);
+}
+
+template<typename T>
+char* RandomArrayGenerator::createQuads (int seed, int count, int componentCount, int offset, int stride, Array::Primitive primitive, T min, T max, float gridSize)
 {
        int componentStride = sizeof(T);
        int quadStride = 0;
 
        if (stride == 0)
                stride = componentCount * componentStride;
+
        DE_ASSERT(stride >= componentCount * componentStride);
 
        switch (primitive)
@@ -1576,6 +1583,11 @@ char* RandomArrayGenerator::createQuads (int seed, int count, int componentCount
        {
                case Array::PRIMITIVE_TRIANGLES:
                {
+                       const T minQuadSize     = T::fromFloat(deFloatAbs(max.template to<float>() - min.template to<float>()) * gridSize);
+                       const T minDiff         = minValue<T>() > minQuadSize
+                                                               ? minValue<T>()
+                                                               : minQuadSize;
+
                        for (int quadNdx = 0; quadNdx < count; ++quadNdx)
                        {
                                T x1, x2;
@@ -1585,22 +1597,22 @@ char* RandomArrayGenerator::createQuads (int seed, int count, int componentCount
                                // attempt to find a good (i.e not extremely small) quad
                                for (int attemptNdx = 0; attemptNdx < 4; ++attemptNdx)
                                {
-                                       x1 = getRandom<T>(rnd, min, max);
-                                       x2 = getRandom<T>(rnd, minValue<T>(), abs<T>(max - x1));
+                                       x1 = roundTo(minDiff, getRandom<T>(rnd, min, max));
+                                       x2 = roundTo(minDiff, getRandom<T>(rnd, minDiff, abs<T>(max - x1)));
 
-                                       y1 = getRandom<T>(rnd, min, max);
-                                       y2 = getRandom<T>(rnd, minValue<T>(), abs<T>(max - y1));
+                                       y1 = roundTo(minDiff, getRandom<T>(rnd, min, max));
+                                       y2 = roundTo(minDiff, getRandom<T>(rnd, minDiff, abs<T>(max - y1)));
 
-                                       z = (componentCount > 2) ? (getRandom<T>(rnd, min, max)) : (T::create(0));
-                                       w = (componentCount > 3) ? (getRandom<T>(rnd, min, max)) : (T::create(1));
+                                       z = (componentCount > 2) ? roundTo(minDiff, (getRandom<T>(rnd, min, max))) : (T::create(0));
+                                       w = (componentCount > 3) ? roundTo(minDiff, (getRandom<T>(rnd, min, max))) : (T::create(1));
 
                                        // no additional components, all is good
                                        if (componentCount <= 2)
                                                break;
 
                                        // The result quad is too thin?
-                                       if ((deFloatAbs(x2.template to<float>() + z.template to<float>()) < minValue<T>().template to<float>()) ||
-                                               (deFloatAbs(y2.template to<float>() + w.template to<float>()) < minValue<T>().template to<float>()))
+                                       if ((deFloatAbs(x2.template to<float>() + z.template to<float>()) < minDiff.template to<float>()) ||
+                                               (deFloatAbs(y2.template to<float>() + w.template to<float>()) < minDiff.template to<float>()))
                                                continue;
 
                                        // all ok
@@ -1758,9 +1770,9 @@ VertexArrayTest::VertexArrayTest (tcu::TestContext& testCtx, glu::RenderContext&
        , m_glArrayPack         (DE_NULL)
        , m_rrArrayPack         (DE_NULL)
        , m_isOk                        (false)
-       , m_maxDiffRed          (deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits))))
-       , m_maxDiffGreen        (deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits))))
-       , m_maxDiffBlue         (deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits))))
+       , m_maxDiffRed          (deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits))))
+       , m_maxDiffGreen        (deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits))))
+       , m_maxDiffBlue         (deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits))))
 {
 }
 
@@ -1843,9 +1855,9 @@ void VertexArrayTest::compare (void)
                                                        // Check reference pixel against screen pixel
                                                        {
                                                                tcu::RGBA       screenCmpPixel  = screen.getPixel(x+dx, y+dy);
-                                                               deUint8         r                               = deAbs32(refPixel.getRed()             - screenCmpPixel.getRed());
-                                                               deUint8         g                               = deAbs32(refPixel.getGreen()   - screenCmpPixel.getGreen());
-                                                               deUint8         b                               = deAbs32(refPixel.getBlue()    - screenCmpPixel.getBlue());
+                                                               deUint8         r                               = (deUint8)deAbs32(refPixel.getRed()    - screenCmpPixel.getRed());
+                                                               deUint8         g                               = (deUint8)deAbs32(refPixel.getGreen()  - screenCmpPixel.getGreen());
+                                                               deUint8         b                               = (deUint8)deAbs32(refPixel.getBlue()   - screenCmpPixel.getBlue());
 
                                                                if (r <= m_maxDiffRed && g <= m_maxDiffGreen && b <= m_maxDiffBlue)
                                                                        isOkPixel = true;
@@ -1854,9 +1866,9 @@ void VertexArrayTest::compare (void)
                                                        // Check screen pixels against reference pixel
                                                        {
                                                                tcu::RGBA       refCmpPixel             = ref.getPixel(x+dx, y+dy);
-                                                               deUint8         r                               = deAbs32(refCmpPixel.getRed()          - screenPixel.getRed());
-                                                               deUint8         g                               = deAbs32(refCmpPixel.getGreen()        - screenPixel.getGreen());
-                                                               deUint8         b                               = deAbs32(refCmpPixel.getBlue()         - screenPixel.getBlue());
+                                                               deUint8         r                               = (deUint8)deAbs32(refCmpPixel.getRed()         - screenPixel.getRed());
+                                                               deUint8         g                               = (deUint8)deAbs32(refCmpPixel.getGreen()       - screenPixel.getGreen());
+                                                               deUint8         b                               = (deUint8)deAbs32(refCmpPixel.getBlue()        - screenPixel.getBlue());
 
                                                                if (r <= m_maxDiffRed && g <= m_maxDiffGreen && b <= m_maxDiffBlue)
                                                                        isOkPixel = true;
@@ -2068,6 +2080,8 @@ MultiVertexArrayTest::IterateResult MultiVertexArrayTest::iterate (void)
                        const char*             data                    = DE_NULL;
                        const size_t    stride                  = (arraySpec.stride == 0) ? (arraySpec.componentCount * Array::inputTypeSize(arraySpec.inputType)) : (arraySpec.stride);
                        const size_t    bufferSize              = arraySpec.offset + stride * (m_spec.drawCount * primitiveSize - 1) + arraySpec.componentCount  * Array::inputTypeSize(arraySpec.inputType);
+                       // Snap values to at least 3x3 grid
+                       const float             gridSize                = 3.0f / (float)(de::min(m_renderCtx.getRenderTarget().getWidth(), m_renderCtx.getRenderTarget().getHeight()) - 1);
 
                        switch (m_spec.primitive)
                        {
@@ -2077,7 +2091,7 @@ MultiVertexArrayTest::IterateResult MultiVertexArrayTest::iterate (void)
                                case Array::PRIMITIVE_TRIANGLES:
                                        if (arrayNdx == 0)
                                        {
-                                               data = RandomArrayGenerator::generateQuads(seed, m_spec.drawCount, arraySpec.componentCount, arraySpec.offset, arraySpec.stride, m_spec.primitive, arraySpec.inputType, arraySpec.min, arraySpec.max);
+                                               data = RandomArrayGenerator::generateQuads(seed, m_spec.drawCount, arraySpec.componentCount, arraySpec.offset, arraySpec.stride, m_spec.primitive, arraySpec.inputType, arraySpec.min, arraySpec.max, gridSize);
                                        }
                                        else
                                        {
index 155bb6d..b7539d4 100644 (file)
@@ -31,6 +31,7 @@
 #include "tcuTestLog.hpp"
 #include "gluShaderProgram.hpp"
 #include "deFloat16.h"
+#include "deMath.h"
 #include "tcuFloat.hpp"
 #include "tcuPixelFormat.hpp"
 #include "sglrContext.hpp"
@@ -236,18 +237,19 @@ private:
 class GLValue
 {
 public:
-
        template<class Type>
        class WrappedType
        {
        public:
                static WrappedType<Type>        create                  (Type value)                                                    { WrappedType<Type> v; v.m_value = value; return v; }
+               static WrappedType<Type>        fromFloat               (float value)                                                   { WrappedType<Type> v; v.m_value = (Type)value; return v; }
                inline Type                                     getValue                (void) const                                                    { return m_value; }
 
-               inline WrappedType<Type>        operator+               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create(m_value + other.getValue()); }
-               inline WrappedType<Type>        operator*               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create(m_value * other.getValue()); }
-               inline WrappedType<Type>        operator/               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create(m_value / other.getValue()); }
-               inline WrappedType<Type>        operator-               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create(m_value - other.getValue()); }
+               inline WrappedType<Type>        operator+               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create((Type)(m_value + other.getValue())); }
+               inline WrappedType<Type>        operator*               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create((Type)(m_value * other.getValue())); }
+               inline WrappedType<Type>        operator/               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create((Type)(m_value / other.getValue())); }
+               inline WrappedType<Type>        operator%               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create((Type)(m_value % other.getValue())); }
+               inline WrappedType<Type>        operator-               (const WrappedType<Type>& other) const  { return WrappedType<Type>::create((Type)(m_value - other.getValue())); }
 
                inline WrappedType<Type>&       operator+=              (const WrappedType<Type>& other)                { m_value += other.getValue(); return *this; }
                inline WrappedType<Type>&       operator*=              (const WrappedType<Type>& other)                { m_value *= other.getValue(); return *this; }
@@ -268,27 +270,62 @@ public:
                Type    m_value;
        };
 
-       typedef WrappedType<deInt16>    Short;
-       typedef WrappedType<deUint16>   Ushort;
+       template<class Type>
+       class WrappedFloatType
+       {
+       public:
+               static WrappedFloatType<Type>   create                  (Type value)                                                    { WrappedFloatType<Type> v; v.m_value = value; return v; }
+               static WrappedFloatType<Type>   fromFloat               (float value)                                                   { WrappedFloatType<Type> v; v.m_value = (Type)value; return v; }
+               inline Type                                             getValue                (void) const                                                    { return m_value; }
+
+               inline WrappedFloatType<Type>   operator+               (const WrappedFloatType<Type>& other) const     { return WrappedFloatType<Type>::create((Type)(m_value + other.getValue())); }
+               inline WrappedFloatType<Type>   operator*               (const WrappedFloatType<Type>& other) const     { return WrappedFloatType<Type>::create((Type)(m_value * other.getValue())); }
+               inline WrappedFloatType<Type>   operator/               (const WrappedFloatType<Type>& other) const     { return WrappedFloatType<Type>::create((Type)(m_value / other.getValue())); }
+               inline WrappedFloatType<Type>   operator%               (const WrappedFloatType<Type>& other) const     { return WrappedFloatType<Type>::create((Type)(deMod(m_value, other.getValue()))); }
+               inline WrappedFloatType<Type>   operator-               (const WrappedFloatType<Type>& other) const     { return WrappedFloatType<Type>::create((Type)(m_value - other.getValue())); }
+
+               inline WrappedFloatType<Type>&  operator+=              (const WrappedFloatType<Type>& other)           { m_value += other.getValue(); return *this; }
+               inline WrappedFloatType<Type>&  operator*=              (const WrappedFloatType<Type>& other)           { m_value *= other.getValue(); return *this; }
+               inline WrappedFloatType<Type>&  operator/=              (const WrappedFloatType<Type>& other)           { m_value /= other.getValue(); return *this; }
+               inline WrappedFloatType<Type>&  operator-=              (const WrappedFloatType<Type>& other)           { m_value -= other.getValue(); return *this; }
+
+               inline bool                                             operator==              (const WrappedFloatType<Type>& other) const     { return m_value == other.m_value; }
+               inline bool                                             operator!=              (const WrappedFloatType<Type>& other) const     { return m_value != other.m_value; }
+               inline bool                                             operator<               (const WrappedFloatType<Type>& other) const     { return m_value < other.m_value; }
+               inline bool                                             operator>               (const WrappedFloatType<Type>& other) const     { return m_value > other.m_value; }
+               inline bool                                             operator<=              (const WrappedFloatType<Type>& other) const     { return m_value <= other.m_value; }
+               inline bool                                             operator>=              (const WrappedFloatType<Type>& other) const     { return m_value >= other.m_value; }
+
+               inline                                                  operator Type   (void) const                                                    { return m_value; }
+               template<class T>
+               inline T                                                to                              (void) const                                                    { return (T)m_value; }
+       private:
+               Type    m_value;
+       };
+
+       typedef WrappedType<deInt16>            Short;
+       typedef WrappedType<deUint16>           Ushort;
 
-       typedef WrappedType<deInt8>             Byte;
-       typedef WrappedType<deUint8>    Ubyte;
+       typedef WrappedType<deInt8>                     Byte;
+       typedef WrappedType<deUint8>            Ubyte;
 
-       typedef WrappedType<float>              Float;
-       typedef WrappedType<double>             Double;
+       typedef WrappedFloatType<float>         Float;
+       typedef WrappedFloatType<double>        Double;
 
-       typedef WrappedType<deInt32>    Int;
-       typedef WrappedType<deUint32>   Uint;
+       typedef WrappedType<deInt32>            Int;
+       typedef WrappedType<deUint32>           Uint;
 
        class Half
        {
        public:
                static Half                     create                  (float value)                           { Half h; h.m_value = floatToHalf(value); return h; }
+               static Half                     fromFloat               (float value)                           { Half h; h.m_value = floatToHalf(value); return h; }
                inline deFloat16        getValue                (void) const                            { return m_value; }
 
                inline Half                     operator+               (const Half& other) const       { return create(halfToFloat(m_value) + halfToFloat(other.getValue())); }
                inline Half                     operator*               (const Half& other) const       { return create(halfToFloat(m_value) * halfToFloat(other.getValue())); }
                inline Half                     operator/               (const Half& other) const       { return create(halfToFloat(m_value) / halfToFloat(other.getValue())); }
+               inline Half                     operator%               (const Half& other) const       { return create(deFloatMod(halfToFloat(m_value), halfToFloat(other.getValue()))); }
                inline Half                     operator-               (const Half& other) const       { return create(halfToFloat(m_value) - halfToFloat(other.getValue())); }
 
                inline Half&            operator+=              (const Half& other)                     { m_value = floatToHalf(halfToFloat(other.getValue()) + halfToFloat(m_value)); return *this; }
@@ -316,11 +353,13 @@ public:
        {
        public:
                static Fixed            create                  (deInt32 value)                         { Fixed v; v.m_value = value; return v; }
+               static Fixed            fromFloat               (float value)                           { Fixed v; v.m_value = (deInt32)(value * 32768.0f); return v; }
                inline deInt32          getValue                (void) const                            { return m_value; }
 
                inline Fixed            operator+               (const Fixed& other) const      { return create(m_value + other.getValue()); }
                inline Fixed            operator*               (const Fixed& other) const      { return create(m_value * other.getValue()); }
                inline Fixed            operator/               (const Fixed& other) const      { return create(m_value / other.getValue()); }
+               inline Fixed            operator%               (const Fixed& other) const      { return create(m_value % other.getValue()); }
                inline Fixed            operator-               (const Fixed& other) const      { return create(m_value - other.getValue()); }
 
                inline Fixed&           operator+=              (const Fixed& other)            { m_value += other.getValue(); return *this; }