int getChannelSize (TextureFormat::ChannelType type)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (type)
{
inline float channelToFloat (const deUint8* value, TextureFormat::ChannelType type)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (type)
{
inline int channelToInt (const deUint8* value, TextureFormat::ChannelType type)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (type)
{
void floatToChannel (deUint8* dst, float src, TextureFormat::ChannelType type)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (type)
{
void intToChannel (deUint8* dst, int src, TextureFormat::ChannelType type)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (type)
{
case TextureFormat::UNSIGNED_SHORT_5551:
return format.order == TextureFormat::RGBA || format.order == TextureFormat::BGRA;
+ case TextureFormat::UNORM_SHORT_1555:
+ return format.order == TextureFormat::ARGB;
+
case TextureFormat::UNORM_INT_101010:
return format.order == TextureFormat::RGB;
return 0u;
}
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
}
/** Get pixel size in bytes. */
DE_ASSERT(isValid(format));
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (type)
{
case TextureFormat::UNORM_SHORT_555:
case TextureFormat::UNORM_SHORT_4444:
case TextureFormat::UNORM_SHORT_5551:
+ case TextureFormat::UNORM_SHORT_1555:
case TextureFormat::UNSIGNED_SHORT_565:
case TextureFormat::UNSIGNED_SHORT_4444:
case TextureFormat::UNSIGNED_SHORT_5551:
{
case TextureFormat::UNORM_BYTE_44: return Vec4(UN8 (4, 4), UN8 ( 0, 4), 0.0f, 1.0f);
case TextureFormat::UNSIGNED_BYTE_44: return UVec4(UI8 (4, 4), UI8 ( 0, 4), 0u, 1u).cast<float>();
- case TextureFormat::UNORM_SHORT_565: return swizzleRB( Vec4(UN16(11, 5), UN16( 5, 6), UN16( 0, 5), 1.0f), TextureFormat::RGB, m_format.order);
- case TextureFormat::UNSIGNED_SHORT_565: return swizzleRB(UVec4(UI16(11, 5), UI16( 5, 6), UI16( 0, 5), 1u), TextureFormat::RGB, m_format.order).cast<float>();
- case TextureFormat::UNORM_SHORT_555: return swizzleRB( Vec4(UN16(10, 5), UN16( 5, 5), UN16( 0, 5), 1.0f), TextureFormat::RGB, m_format.order);
- case TextureFormat::UNORM_SHORT_4444: return swizzleRB( Vec4(UN16(12, 4), UN16( 8, 4), UN16( 4, 4), UN16( 0, 4)), TextureFormat::RGBA, m_format.order);
- case TextureFormat::UNSIGNED_SHORT_4444: return swizzleRB(UVec4(UI16(12, 4), UI16( 8, 4), UI16( 4, 4), UI16( 0, 4)), TextureFormat::RGBA, m_format.order).cast<float>();
- case TextureFormat::UNORM_SHORT_5551: return swizzleRB( Vec4(UN16(11, 5), UN16( 6, 5), UN16( 1, 5), UN16( 0, 1)), TextureFormat::RGBA, m_format.order);
- case TextureFormat::UNSIGNED_SHORT_5551: return swizzleRB(UVec4(UI16(11, 5), UI16( 6, 5), UI16( 1, 5), UI16( 0, 1)), TextureFormat::RGBA, m_format.order).cast<float>();
+ case TextureFormat::UNORM_SHORT_565: return swizzleRB( Vec4(UN16(11, 5), UN16( 5, 6), UN16( 0, 5), 1.0f), m_format.order, TextureFormat::RGB);
+ case TextureFormat::UNSIGNED_SHORT_565: return swizzleRB(UVec4(UI16(11, 5), UI16( 5, 6), UI16( 0, 5), 1u), m_format.order, TextureFormat::RGB).cast<float>();
+ case TextureFormat::UNORM_SHORT_555: return swizzleRB( Vec4(UN16(10, 5), UN16( 5, 5), UN16( 0, 5), 1.0f), m_format.order, TextureFormat::RGB);
+ case TextureFormat::UNORM_SHORT_4444: return swizzleRB( Vec4(UN16(12, 4), UN16( 8, 4), UN16( 4, 4), UN16( 0, 4)), m_format.order, TextureFormat::RGBA);
+ case TextureFormat::UNSIGNED_SHORT_4444: return swizzleRB(UVec4(UI16(12, 4), UI16( 8, 4), UI16( 4, 4), UI16( 0, 4)), m_format.order, TextureFormat::RGBA).cast<float>();
+ case TextureFormat::UNORM_SHORT_5551: return swizzleRB( Vec4(UN16(11, 5), UN16( 6, 5), UN16( 1, 5), UN16( 0, 1)), m_format.order, TextureFormat::RGBA);
+ case TextureFormat::UNSIGNED_SHORT_5551: return swizzleRB(UVec4(UI16(11, 5), UI16( 6, 5), UI16( 1, 5), UI16( 0, 1)), m_format.order, TextureFormat::RGBA).cast<float>();
case TextureFormat::UNORM_INT_101010: return Vec4(UN32(22, 10), UN32(12, 10), UN32( 2, 10), 1.0f);
- case TextureFormat::UNORM_INT_1010102_REV: return swizzleRB( Vec4(UN32( 0, 10), UN32(10, 10), UN32(20, 10), UN32(30, 2)), TextureFormat::RGBA, m_format.order);
- case TextureFormat::SNORM_INT_1010102_REV: return swizzleRB( Vec4(SN32( 0, 10), SN32(10, 10), SN32(20, 10), SN32(30, 2)), TextureFormat::RGBA, m_format.order);
- case TextureFormat::UNSIGNED_INT_1010102_REV: return swizzleRB( UVec4(UI32(0, 10), UI32(10, 10), UI32(20, 10), UI32(30, 2)), TextureFormat::RGBA, m_format.order).cast<float>();
- case TextureFormat::SIGNED_INT_1010102_REV: return swizzleRB( UVec4(SI32(0, 10), SI32(10, 10), SI32(20, 10), SI32(30, 2)), TextureFormat::RGBA, m_format.order).cast<float>();
+ case TextureFormat::UNORM_INT_1010102_REV: return swizzleRB( Vec4(UN32( 0, 10), UN32(10, 10), UN32(20, 10), UN32(30, 2)), m_format.order, TextureFormat::RGBA);
+ case TextureFormat::SNORM_INT_1010102_REV: return swizzleRB( Vec4(SN32( 0, 10), SN32(10, 10), SN32(20, 10), SN32(30, 2)), m_format.order, TextureFormat::RGBA);
+ case TextureFormat::UNSIGNED_INT_1010102_REV: return swizzleRB( UVec4(UI32(0, 10), UI32(10, 10), UI32(20, 10), UI32(30, 2)), m_format.order, TextureFormat::RGBA).cast<float>();
+ case TextureFormat::SIGNED_INT_1010102_REV: return swizzleRB( UVec4(SI32(0, 10), SI32(10, 10), SI32(20, 10), SI32(30, 2)), m_format.order, TextureFormat::RGBA).cast<float>();
case TextureFormat::UNSIGNED_INT_999_E5_REV: return unpackRGB999E5(*((const deUint32*)pixelPtr));
+ case TextureFormat::UNORM_SHORT_1555:
+ DE_ASSERT(m_format.order == TextureFormat::ARGB);
+ return Vec4(UN16(15, 1), UN16(10, 5), UN16(5, 5), UN16(0, 5)).swizzle(1,2,3,0); // ARGB -> RGBA
+
case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
return Vec4(Float11(UI32(0, 11)).asFloat(), Float11(UI32(11, 11)).asFloat(), Float10(UI32(22, 10)).asFloat(), 1.0f);
case TextureFormat::UNSIGNED_BYTE_44: // Fall-through
case TextureFormat::UNORM_BYTE_44: return UVec4(U8 ( 4, 4), U8 ( 0, 4), 0u, 1u).cast<int>();
case TextureFormat::UNSIGNED_SHORT_565: // Fall-through
- case TextureFormat::UNORM_SHORT_565: return swizzleRB(UVec4(U16(11, 5), U16( 5, 6), U16( 0, 5), 1).cast<int>(), TextureFormat::RGB, m_format.order);
- case TextureFormat::UNORM_SHORT_555: return swizzleRB(UVec4(U16(10, 5), U16( 5, 5), U16( 0, 5), 1).cast<int>(), TextureFormat::RGB, m_format.order);
+ case TextureFormat::UNORM_SHORT_565: return swizzleRB(UVec4(U16(11, 5), U16( 5, 6), U16( 0, 5), 1).cast<int>(), m_format.order, TextureFormat::RGB);
+ case TextureFormat::UNORM_SHORT_555: return swizzleRB(UVec4(U16(10, 5), U16( 5, 5), U16( 0, 5), 1).cast<int>(), m_format.order, TextureFormat::RGB);
case TextureFormat::UNSIGNED_SHORT_4444: // Fall-through
- case TextureFormat::UNORM_SHORT_4444: return swizzleRB(UVec4(U16(12, 4), U16( 8, 4), U16( 4, 4), U16( 0, 4)).cast<int>(), TextureFormat::RGBA, m_format.order);
+ case TextureFormat::UNORM_SHORT_4444: return swizzleRB(UVec4(U16(12, 4), U16( 8, 4), U16( 4, 4), U16( 0, 4)).cast<int>(), m_format.order, TextureFormat::RGBA);
case TextureFormat::UNSIGNED_SHORT_5551: // Fall-through
- case TextureFormat::UNORM_SHORT_5551: return swizzleRB(UVec4(U16(11, 5), U16( 6, 5), U16( 1, 5), U16( 0, 1)).cast<int>(), TextureFormat::RGBA, m_format.order);
+ case TextureFormat::UNORM_SHORT_5551: return swizzleRB(UVec4(U16(11, 5), U16( 6, 5), U16( 1, 5), U16( 0, 1)).cast<int>(), m_format.order, TextureFormat::RGBA);
case TextureFormat::UNORM_INT_101010: return UVec4(U32(22, 10), U32(12, 10), U32( 2, 10), 1).cast<int>();
case TextureFormat::UNORM_INT_1010102_REV: // Fall-through
- case TextureFormat::UNSIGNED_INT_1010102_REV: return swizzleRB(UVec4(U32( 0, 10), U32(10, 10), U32(20, 10), U32(30, 2)), TextureFormat::RGBA, m_format.order).cast<int>();
+ case TextureFormat::UNSIGNED_INT_1010102_REV: return swizzleRB(UVec4(U32( 0, 10), U32(10, 10), U32(20, 10), U32(30, 2)), m_format.order, TextureFormat::RGBA).cast<int>();
case TextureFormat::SNORM_INT_1010102_REV: // Fall-through
- case TextureFormat::SIGNED_INT_1010102_REV: return swizzleRB(IVec4(S32( 0, 10), S32(10, 10), S32(20, 10), S32(30, 2)), TextureFormat::RGBA, m_format.order);
+ case TextureFormat::SIGNED_INT_1010102_REV: return swizzleRB(IVec4(S32( 0, 10), S32(10, 10), S32(20, 10), S32(30, 2)), m_format.order, TextureFormat::RGBA);
+
+ case TextureFormat::UNORM_SHORT_1555:
+ DE_ASSERT(m_format.order == TextureFormat::ARGB);
+ return UVec4(U16(15, 1), U16(10, 5), U16(5, 5), U16(0, 5)).cast<int>().swizzle(1,2,3,0); // ARGB -> RGBA
default:
break; // To generic path.
case TextureFormat::UNORM_SHORT_565:
{
- const Vec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGB);
+ const Vec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PN(swizzled[0], 11, 5) | PN(swizzled[1], 5, 6) | PN(swizzled[2], 0, 5));
break;
}
case TextureFormat::UNSIGNED_SHORT_565:
{
- const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), m_format.order, TextureFormat::RGB);
+ const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), TextureFormat::RGB, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 11, 5) | PU(swizzled[1], 5, 6) | PU(swizzled[2], 0, 5));
break;
}
case TextureFormat::UNORM_SHORT_555:
{
- const Vec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGB);
+ const Vec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PN(swizzled[0], 10, 5) | PN(swizzled[1], 5, 5) | PN(swizzled[2], 0, 5));
break;
}
case TextureFormat::UNORM_SHORT_4444:
{
- const Vec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const Vec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PN(swizzled[0], 12, 4) | PN(swizzled[1], 8, 4) | PN(swizzled[2], 4, 4) | PN(swizzled[3], 0, 4));
break;
}
case TextureFormat::UNSIGNED_SHORT_4444:
{
- const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), m_format.order, TextureFormat::RGBA);
+ const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), TextureFormat::RGBA, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 12, 4) | PU(swizzled[1], 8, 4) | PU(swizzled[2], 4, 4) | PU(swizzled[3], 0, 4));
break;
}
case TextureFormat::UNORM_SHORT_5551:
{
- const Vec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const Vec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PN(swizzled[0], 11, 5) | PN(swizzled[1], 6, 5) | PN(swizzled[2], 1, 5) | PN(swizzled[3], 0, 1));
break;
}
+ case TextureFormat::UNORM_SHORT_1555:
+ {
+ const Vec4 swizzled = color.swizzle(3,0,1,2); // RGBA -> ARGB
+ *((deUint16*)pixelPtr) = (deUint16)(PN(swizzled[0], 15, 1) | PN(swizzled[1], 10, 5) | PN(swizzled[2], 5, 5) | PN(swizzled[3], 0, 5));
+ break;
+ }
+
case TextureFormat::UNSIGNED_SHORT_5551:
{
- const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), m_format.order, TextureFormat::RGBA);
+ const UVec4 swizzled = swizzleRB(color.cast<deUint32>(), TextureFormat::RGBA, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 11, 5) | PU(swizzled[1], 6, 5) | PU(swizzled[2], 1, 5) | PU(swizzled[3], 0, 1));
break;
}
case TextureFormat::UNORM_INT_1010102_REV:
{
- const Vec4 u = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const Vec4 u = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint32*)pixelPtr) = PN(u[0], 0, 10) | PN(u[1], 10, 10) | PN(u[2], 20, 10) | PN(u[3], 30, 2);
break;
}
case TextureFormat::SNORM_INT_1010102_REV:
{
- const Vec4 u = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const Vec4 u = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint32*)pixelPtr) = PS(u[0], 0, 10) | PS(u[1], 10, 10) | PS(u[2], 20, 10) | PS(u[3], 30, 2);
break;
}
case TextureFormat::UNSIGNED_INT_1010102_REV:
{
- const UVec4 u = swizzleRB(color.cast<deUint32>(), m_format.order, TextureFormat::RGBA);
+ const UVec4 u = swizzleRB(color.cast<deUint32>(), TextureFormat::RGBA, m_format.order);
*((deUint32*)pixelPtr) = PU(u[0], 0, 10) | PU(u[1], 10, 10) | PU(u[2], 20, 10) | PU(u[3], 30, 2);
break;
}
case TextureFormat::SIGNED_INT_1010102_REV:
{
- const IVec4 u = swizzleRB(color.cast<deInt32>(), m_format.order, TextureFormat::RGBA);
+ const IVec4 u = swizzleRB(color.cast<deInt32>(), TextureFormat::RGBA, m_format.order);
*((deUint32*)pixelPtr) = PI(u[0], 0, 10) | PI(u[1], 10, 10) | PI(u[2], 20, 10) | PI(u[3], 30, 2);
break;
}
case TextureFormat::UNORM_SHORT_565:
case TextureFormat::UNSIGNED_SHORT_565:
{
- const IVec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGB);
+ const IVec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 11, 5) | PU(swizzled[1], 5, 6) | PU(swizzled[2], 0, 5));
break;
}
case TextureFormat::UNORM_SHORT_555:
{
- const IVec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGB);
+ const IVec4 swizzled = swizzleRB(color, TextureFormat::RGB, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 10, 5) | PU(swizzled[1], 5, 5) | PU(swizzled[2], 0, 5));
break;
}
case TextureFormat::UNORM_SHORT_4444:
case TextureFormat::UNSIGNED_SHORT_4444:
{
- const IVec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 12, 4) | PU(swizzled[1], 8, 4) | PU(swizzled[2], 4, 4) | PU(swizzled[3], 0, 4));
break;
}
case TextureFormat::UNORM_SHORT_5551:
case TextureFormat::UNSIGNED_SHORT_5551:
{
- const IVec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 11, 5) | PU(swizzled[1], 6, 5) | PU(swizzled[2], 1, 5) | PU(swizzled[3], 0, 1));
break;
}
+ case TextureFormat::UNORM_SHORT_1555:
+ {
+ const IVec4 swizzled = color.swizzle(3,0,1,2); // RGBA -> ARGB
+ *((deUint16*)pixelPtr) = (deUint16)(PU(swizzled[0], 15, 1) | PU(swizzled[1], 10, 5) | PU(swizzled[2], 5, 5) | PU(swizzled[3], 0, 5));
+ break;
+ }
+
case TextureFormat::UNORM_INT_1010102_REV:
case TextureFormat::UNSIGNED_INT_1010102_REV:
{
- const IVec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint32*)pixelPtr) = PU(swizzled[0], 0, 10) | PU(swizzled[1], 10, 10) | PU(swizzled[2], 20, 10) | PU(swizzled[3], 30, 2);
break;
}
case TextureFormat::SNORM_INT_1010102_REV:
case TextureFormat::SIGNED_INT_1010102_REV:
{
- const IVec4 swizzled = swizzleRB(color, m_format.order, TextureFormat::RGBA);
+ const IVec4 swizzled = swizzleRB(color, TextureFormat::RGBA, m_format.order);
*((deUint32*)pixelPtr) = PI(swizzled[0], 0, 10) | PI(swizzled[1], 10, 10) | PI(swizzled[2], 20, 10) | PI(swizzled[3], 30, 2);
break;
}
"UNORM_SHORT_555",
"UNORM_SHORT_4444",
"UNORM_SHORT_5551",
+ "UNORM_SHORT_1555",
"UNORM_INT_101010",
"SNORM_INT_1010102_REV",
"UNORM_INT_1010102_REV",
bool isCombinedDepthStencilType (TextureFormat::ChannelType type)
{
// make sure to update this if type table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
return type == TextureFormat::UNSIGNED_INT_16_8_8 ||
type == TextureFormat::UNSIGNED_INT_24_8 ||
TextureChannelClass getTextureChannelClass (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (channelType)
{
case TextureFormat::UNORM_SHORT_555: return TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
case TextureFormat::UNORM_SHORT_4444: return TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
case TextureFormat::UNORM_SHORT_5551: return TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
+ case TextureFormat::UNORM_SHORT_1555: return TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
case TextureFormat::UNSIGNED_BYTE_44: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
case TextureFormat::UNSIGNED_SHORT_565: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
case TextureFormat::UNSIGNED_SHORT_4444: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
case TextureFormat::UNSIGNED_INT32: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
case TextureFormat::HALF_FLOAT: return TEXTURECHANNELCLASS_FLOATING_POINT;
case TextureFormat::FLOAT: return TEXTURECHANNELCLASS_FLOATING_POINT;
- case TextureFormat::FLOAT64: return TEXTURECHANNELCLASS_FLOATING_POINT;
+ case TextureFormat::FLOAT64: return TEXTURECHANNELCLASS_FLOATING_POINT;
case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV: return TEXTURECHANNELCLASS_LAST; //!< packed float32-pad24-uint8
- default: return TEXTURECHANNELCLASS_LAST;
+ default:
+ DE_FATAL("Unknown channel type");
+ return TEXTURECHANNELCLASS_LAST;
}
}
static Vec2 getFloatChannelValueRange (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
float cMin = 0.0f;
float cMax = 0.0f;
case TextureFormat::UNORM_SHORT_555:
case TextureFormat::UNORM_SHORT_4444:
case TextureFormat::UNORM_SHORT_5551:
+ case TextureFormat::UNORM_SHORT_1555:
case TextureFormat::UNORM_INT_101010:
case TextureFormat::UNORM_INT_1010102_REV: cMin = 0.0f; cMax = 1.0f; break;
case TextureFormat::FLOAT64: cMin = -1e5f; cMax = 1e5f; break;
case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV: cMin = 0.0f; cMax = 1e4f; break;
case TextureFormat::UNSIGNED_INT_999_E5_REV: cMin = 0.0f; cMax = 1e5f; break;
+ case TextureFormat::UNSIGNED_BYTE_44: cMin = 0.0f; cMax = 15.f; break;
+ case TextureFormat::UNSIGNED_SHORT_4444: cMin = 0.0f; cMax = 15.f; break;
default:
DE_ASSERT(false);
TextureFormatInfo getTextureFormatInfo (const TextureFormat& format)
{
// Special cases.
- if (format == TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT_1010102_REV))
- return TextureFormatInfo(Vec4( 0.0f, 0.0f, 0.0f, 0.0f),
- Vec4( 1023.0f, 1023.0f, 1023.0f, 3.0f),
+ if (format.type == TextureFormat::UNSIGNED_INT_1010102_REV)
+ return TextureFormatInfo(Vec4( 0.0f, 0.0f, 0.0f, 0.0f),
+ Vec4( 1023.0f, 1023.0f, 1023.0f, 3.0f),
+ Vec4(1.0f/1023.f, 1.0f/1023.0f, 1.0f/1023.0f, 1.0f/3.0f),
+ Vec4( 0.0f, 0.0f, 0.0f, 0.0f));
+ if (format.type == TextureFormat::SIGNED_INT_1010102_REV)
+ return TextureFormatInfo(Vec4( -512.0f, -512.0f, -512.0f, -2.0f),
+ Vec4( 511.0f, 511.0f, 511.0f, 1.0f),
Vec4(1.0f/1023.f, 1.0f/1023.0f, 1.0f/1023.0f, 1.0f/3.0f),
- Vec4( 0.0f, 0.0f, 0.0f, 0.0f));
+ Vec4( 0.5f, 0.5f, 0.5f, 0.5f));
else if (format.order == TextureFormat::D || format.order == TextureFormat::DS)
return TextureFormatInfo(Vec4(0.0f, 0.0f, 0.0f, 0.0f),
Vec4(1.0f, 1.0f, 1.0f, 0.0f),
Vec4(1.0f, 1.0f, 1.0f, 1.5f),
Vec4(1.0f, 1.0f, 1.0f, 1.0f),
Vec4(0.0f, 0.0f, 0.0f, 0.0f));
+ else if (format.type == TextureFormat::UNSIGNED_SHORT_5551)
+ return TextureFormatInfo(Vec4( 0.0f, 0.0f, 0.0f, 0.0f),
+ Vec4( 31.0f, 31.0f, 31.0f, 1.0f),
+ Vec4(1.0f/31.f, 1.0f/31.0f, 1.0f/31.0f, 1.0f),
+ Vec4( 0.0f, 0.0f, 0.0f, 0.0f));
+ else if (format.type == TextureFormat::UNSIGNED_SHORT_565)
+ return TextureFormatInfo(Vec4( 0.0f, 0.0f, 0.0f, 0.0f),
+ Vec4( 31.0f, 63.0f, 31.0f, 0.0f),
+ Vec4(1.0f/31.f, 1.0f/63.0f, 1.0f/31.0f, 1.0f),
+ Vec4( 0.0f, 0.0f, 0.0f, 0.0f));
const Vec2 cRange = getFloatChannelValueRange(format.type);
const TextureSwizzle::Channel* map = getChannelReadSwizzle(format.order).components;
static IVec4 getChannelBitDepth (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (channelType)
{
case TextureFormat::UNORM_SHORT_4444: return IVec4(4);
case TextureFormat::UNORM_SHORT_555: return IVec4(5,5,5,0);
case TextureFormat::UNORM_SHORT_5551: return IVec4(5,5,5,1);
+ case TextureFormat::UNORM_SHORT_1555: return IVec4(1,5,5,5);
case TextureFormat::UNSIGNED_BYTE_44: return IVec4(4,4,0,0);
case TextureFormat::UNSIGNED_SHORT_565: return IVec4(5,6,5,0);
case TextureFormat::UNSIGNED_SHORT_4444: return IVec4(4);
static IVec4 getChannelMantissaBitDepth (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
switch (channelType)
{
case TextureFormat::UNORM_SHORT_4444:
case TextureFormat::UNORM_SHORT_555:
case TextureFormat::UNORM_SHORT_5551:
+ case TextureFormat::UNORM_SHORT_1555:
case TextureFormat::UNSIGNED_BYTE_44:
case TextureFormat::UNSIGNED_SHORT_565:
case TextureFormat::UNSIGNED_SHORT_4444:
static AccessType toSamplerAccess (const AccessType& baseAccess, Sampler::DepthStencilMode mode)
{
// make sure to update this if type table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 37);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 38);
if (!isCombinedDepthStencilType(baseAccess.getFormat().type))
return baseAccess;
case TextureFormat::sRG: swizzle = &RG; break;
case TextureFormat::sRGB: swizzle = &RGB; break;
case TextureFormat::sRGBA: swizzle = &RGBA; break;
+ case TextureFormat::sBGR: swizzle = &RGB; break;
+ case TextureFormat::sBGRA: swizzle = &RGBA; break;
case TextureFormat::D: swizzle = &D; break;
case TextureFormat::S: swizzle = &S; break;