- Add UINT24 format to tcuTexture.
- Use UINT24 format instead of a combined format in depth-stencil clear
tests.
Change-Id: Ib1ec54edd0c6ed114130fcfc63436298c4bb70c3
int getChannelSize (TextureFormat::ChannelType type)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (type)
{
case TextureFormat::SIGNED_INT32: return 4;
case TextureFormat::UNSIGNED_INT8: return 1;
case TextureFormat::UNSIGNED_INT16: return 2;
+ case TextureFormat::UNSIGNED_INT24: return 3;
case TextureFormat::UNSIGNED_INT32: return 4;
case TextureFormat::HALF_FLOAT: return 2;
case TextureFormat::FLOAT: return 4;
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 == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (type)
{
case TextureFormat::SIGNED_INT32: return (float)*((const deInt32*)value);
case TextureFormat::UNSIGNED_INT8: return (float)*((const deUint8*)value);
case TextureFormat::UNSIGNED_INT16: return (float)*((const deUint16*)value);
+ case TextureFormat::UNSIGNED_INT24: return (float)readUint24(value);
case TextureFormat::UNSIGNED_INT32: return (float)*((const deUint32*)value);
case TextureFormat::HALF_FLOAT: return deFloat16To32(*(const deFloat16*)value);
case TextureFormat::FLOAT: return *((const float*)value);
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 == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (type)
{
case TextureFormat::SIGNED_INT32: return (int)*((const deInt32*)value);
case TextureFormat::UNSIGNED_INT8: return (int)*((const deUint8*)value);
case TextureFormat::UNSIGNED_INT16: return (int)*((const deUint16*)value);
+ case TextureFormat::UNSIGNED_INT24: return (int)readUint24(value);
case TextureFormat::UNSIGNED_INT32: return (int)*((const deUint32*)value);
case TextureFormat::HALF_FLOAT: return (int)deFloat16To32(*(const deFloat16*)value);
case TextureFormat::FLOAT: return (int)*((const float*)value);
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 == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (type)
{
case TextureFormat::SNORM_INT32: *((deInt32*)dst) = convertSatRte<deInt32> (src * 2147483647.0f); break;
case TextureFormat::UNORM_INT8: *((deUint8*)dst) = convertSatRte<deUint8> (src * 255.0f); break;
case TextureFormat::UNORM_INT16: *((deUint16*)dst) = convertSatRte<deUint16> (src * 65535.0f); break;
- case TextureFormat::UNORM_INT24: writeUint24(dst, convertSatRteUint24(src * 16777215.0f)); break;
+ case TextureFormat::UNORM_INT24: writeUint24(dst, convertSatRteUint24 (src * 16777215.0f)); break;
case TextureFormat::UNORM_INT32: *((deUint32*)dst) = convertSatRte<deUint32> (src * 4294967295.0f); break;
case TextureFormat::SIGNED_INT8: *((deInt8*)dst) = convertSatRte<deInt8> (src); break;
case TextureFormat::SIGNED_INT16: *((deInt16*)dst) = convertSatRte<deInt16> (src); break;
case TextureFormat::SIGNED_INT32: *((deInt32*)dst) = convertSatRte<deInt32> (src); break;
case TextureFormat::UNSIGNED_INT8: *((deUint8*)dst) = convertSatRte<deUint8> (src); break;
case TextureFormat::UNSIGNED_INT16: *((deUint16*)dst) = convertSatRte<deUint16> (src); break;
+ case TextureFormat::UNSIGNED_INT24: writeUint24(dst, convertSatRteUint24 (src)); break;
case TextureFormat::UNSIGNED_INT32: *((deUint32*)dst) = convertSatRte<deUint32> (src); break;
case TextureFormat::HALF_FLOAT: *((deFloat16*)dst) = deFloat32To16 (src); break;
case TextureFormat::FLOAT: *((float*)dst) = src; break;
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 == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (type)
{
case TextureFormat::SNORM_INT16: *((deInt16*)dst) = convertSat<deInt16> (src); break;
case TextureFormat::UNORM_INT8: *((deUint8*)dst) = convertSat<deUint8> (src); break;
case TextureFormat::UNORM_INT16: *((deUint16*)dst) = convertSat<deUint16> (src); break;
- case TextureFormat::UNORM_INT24: writeUint24(dst, convertSatUint24(src)); break;
+ case TextureFormat::UNORM_INT24: writeUint24(dst, convertSatUint24 (src)); break;
case TextureFormat::SIGNED_INT8: *((deInt8*)dst) = convertSat<deInt8> (src); break;
case TextureFormat::SIGNED_INT16: *((deInt16*)dst) = convertSat<deInt16> (src); break;
case TextureFormat::SIGNED_INT32: *((deInt32*)dst) = convertSat<deInt32> (src); break;
case TextureFormat::UNSIGNED_INT8: *((deUint8*)dst) = convertSat<deUint8> ((deUint32)src); break;
case TextureFormat::UNSIGNED_INT16: *((deUint16*)dst) = convertSat<deUint16> ((deUint32)src); break;
+ case TextureFormat::UNSIGNED_INT24: writeUint24(dst, convertSatUint24 ((deUint32)src)); break;
case TextureFormat::UNSIGNED_INT32: *((deUint32*)dst) = convertSat<deUint32> ((deUint32)src); break;
case TextureFormat::HALF_FLOAT: *((deFloat16*)dst) = deFloat32To16((float)src); break;
case TextureFormat::FLOAT: *((float*)dst) = (float)src; break;
"SIGNED_INT32",
"UNSIGNED_INT8",
"UNSIGNED_INT16",
+ "UNSIGNED_INT24",
"UNSIGNED_INT32",
"HALF_FLOAT",
"FLOAT",
SIGNED_INT32,
UNSIGNED_INT8,
UNSIGNED_INT16,
+ UNSIGNED_INT24,
UNSIGNED_INT32,
HALF_FLOAT,
FLOAT,
bool isCombinedDepthStencilType (TextureFormat::ChannelType type)
{
// make sure to update this if type table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
return type == TextureFormat::UNSIGNED_INT_24_8 ||
type == TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV;
TextureChannelClass getTextureChannelClass (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (channelType)
{
case TextureFormat::SIGNED_INT32: return TEXTURECHANNELCLASS_SIGNED_INTEGER;
case TextureFormat::UNSIGNED_INT8: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
case TextureFormat::UNSIGNED_INT16: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
+ case TextureFormat::UNSIGNED_INT24: 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;
static Vec2 getChannelValueRange (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
float cMin = 0.0f;
float cMax = 0.0f;
case TextureFormat::SIGNED_INT32: cMin = -2147483648.0f; cMax = 2147483647.0f; break;
case TextureFormat::UNSIGNED_INT8: cMin = 0.0f; cMax = 255.0f; break;
case TextureFormat::UNSIGNED_INT16: cMin = 0.0f; cMax = 65535.0f; break;
+ case TextureFormat::UNSIGNED_INT24: cMin = 0.0f; cMax = 16777215.0f; break;
case TextureFormat::UNSIGNED_INT32: cMin = 0.0f; cMax = 4294967295.f; break;
case TextureFormat::HALF_FLOAT: cMin = -1e3f; cMax = 1e3f; break;
case TextureFormat::FLOAT: cMin = -1e5f; cMax = 1e5f; break;
static IVec4 getChannelBitDepth (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (channelType)
{
case TextureFormat::SIGNED_INT32: return IVec4(32);
case TextureFormat::UNSIGNED_INT8: return IVec4(8);
case TextureFormat::UNSIGNED_INT16: return IVec4(16);
+ case TextureFormat::UNSIGNED_INT24: return IVec4(24);
case TextureFormat::UNSIGNED_INT32: return IVec4(32);
case TextureFormat::UNSIGNED_INT_1010102_REV: return IVec4(10,10,10,2);
case TextureFormat::UNSIGNED_INT_24_8: return IVec4(24,8,0,0);
static IVec4 getChannelMantissaBitDepth (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
switch (channelType)
{
case TextureFormat::SIGNED_INT32:
case TextureFormat::UNSIGNED_INT8:
case TextureFormat::UNSIGNED_INT16:
+ case TextureFormat::UNSIGNED_INT24:
case TextureFormat::UNSIGNED_INT32:
case TextureFormat::UNSIGNED_INT_1010102_REV:
case TextureFormat::UNSIGNED_INT_24_8:
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 == 26);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27);
if (!isCombinedDepthStencilType(baseAccess.getFormat().type))
return baseAccess;
{
case 8: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNORM_INT8);
case 16: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNORM_INT16);
- case 24: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNSIGNED_INT_24_8);
+ case 24: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNORM_INT24);
case 32: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::FLOAT);
default:
TCU_FAIL("Can't map depth buffer format");
{
case 8: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT8);
case 16: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT16);
- case 24: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT_24_8);
+ case 24: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT24);
case 32: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT32);
default:
TCU_FAIL("Can't map depth buffer format");
{
case 8: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNORM_INT8);
case 16: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNORM_INT16);
- case 24: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNSIGNED_INT_24_8);
+ case 24: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::UNORM_INT24);
case 32: return tcu::TextureFormat(tcu::TextureFormat::D, tcu::TextureFormat::FLOAT);
default:
TCU_FAIL("Can't map depth buffer format");
{
case 8: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT8);
case 16: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT16);
- case 24: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT_24_8);
+ case 24: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT24);
case 32: return tcu::TextureFormat(tcu::TextureFormat::S, tcu::TextureFormat::UNSIGNED_INT32);
default:
TCU_FAIL("Can't map depth buffer format");