From: Jarkko Pöyry Date: Mon, 20 Apr 2015 20:35:51 +0000 (-0700) Subject: Add UNSIGNED_INT24 channel format. X-Git-Tag: upstream/0.1.0~1734 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db6ba452c1213fd1c2b03369fdf4c1d23f07cfad;p=platform%2Fupstream%2FVK-GL-CTS.git Add UNSIGNED_INT24 channel format. - Add UINT24 format to tcuTexture. - Use UINT24 format instead of a combined format in depth-stencil clear tests. Change-Id: Ib1ec54edd0c6ed114130fcfc63436298c4bb70c3 --- diff --git a/framework/common/tcuTexture.cpp b/framework/common/tcuTexture.cpp index 02e5007..a2d0f45 100644 --- a/framework/common/tcuTexture.cpp +++ b/framework/common/tcuTexture.cpp @@ -150,7 +150,7 @@ inline deUint32 convertSatRteUint24 (float f) 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) { @@ -166,6 +166,7 @@ int getChannelSize (TextureFormat::ChannelType 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; @@ -209,7 +210,7 @@ int getNumUsedChannels (TextureFormat::ChannelOrder order) 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) { @@ -225,6 +226,7 @@ inline float channelToFloat (const deUint8* value, TextureFormat::ChannelType ty 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); @@ -237,7 +239,7 @@ inline float channelToFloat (const deUint8* value, TextureFormat::ChannelType ty 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) { @@ -253,6 +255,7 @@ inline int channelToInt (const deUint8* value, TextureFormat::ChannelType 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); @@ -265,7 +268,7 @@ inline int channelToInt (const deUint8* value, TextureFormat::ChannelType 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 == 26); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 27); switch (type) { @@ -274,13 +277,14 @@ void floatToChannel (deUint8* dst, float src, TextureFormat::ChannelType type) case TextureFormat::SNORM_INT32: *((deInt32*)dst) = convertSatRte (src * 2147483647.0f); break; case TextureFormat::UNORM_INT8: *((deUint8*)dst) = convertSatRte (src * 255.0f); break; case TextureFormat::UNORM_INT16: *((deUint16*)dst) = convertSatRte (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 (src * 4294967295.0f); break; case TextureFormat::SIGNED_INT8: *((deInt8*)dst) = convertSatRte (src); break; case TextureFormat::SIGNED_INT16: *((deInt16*)dst) = convertSatRte (src); break; case TextureFormat::SIGNED_INT32: *((deInt32*)dst) = convertSatRte (src); break; case TextureFormat::UNSIGNED_INT8: *((deUint8*)dst) = convertSatRte (src); break; case TextureFormat::UNSIGNED_INT16: *((deUint16*)dst) = convertSatRte (src); break; + case TextureFormat::UNSIGNED_INT24: writeUint24(dst, convertSatRteUint24 (src)); break; case TextureFormat::UNSIGNED_INT32: *((deUint32*)dst) = convertSatRte (src); break; case TextureFormat::HALF_FLOAT: *((deFloat16*)dst) = deFloat32To16 (src); break; case TextureFormat::FLOAT: *((float*)dst) = src; break; @@ -320,7 +324,7 @@ static inline deUint32 convertSatUint24 (S src) 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) { @@ -328,12 +332,13 @@ void intToChannel (deUint8* dst, int src, TextureFormat::ChannelType type) case TextureFormat::SNORM_INT16: *((deInt16*)dst) = convertSat (src); break; case TextureFormat::UNORM_INT8: *((deUint8*)dst) = convertSat (src); break; case TextureFormat::UNORM_INT16: *((deUint16*)dst) = convertSat (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 (src); break; case TextureFormat::SIGNED_INT16: *((deInt16*)dst) = convertSat (src); break; case TextureFormat::SIGNED_INT32: *((deInt32*)dst) = convertSat (src); break; case TextureFormat::UNSIGNED_INT8: *((deUint8*)dst) = convertSat ((deUint32)src); break; case TextureFormat::UNSIGNED_INT16: *((deUint16*)dst) = convertSat ((deUint32)src); break; + case TextureFormat::UNSIGNED_INT24: writeUint24(dst, convertSatUint24 ((deUint32)src)); break; case TextureFormat::UNSIGNED_INT32: *((deUint32*)dst) = convertSat ((deUint32)src); break; case TextureFormat::HALF_FLOAT: *((deFloat16*)dst) = deFloat32To16((float)src); break; case TextureFormat::FLOAT: *((float*)dst) = (float)src; break; @@ -3365,6 +3370,7 @@ std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelType type) "SIGNED_INT32", "UNSIGNED_INT8", "UNSIGNED_INT16", + "UNSIGNED_INT24", "UNSIGNED_INT32", "HALF_FLOAT", "FLOAT", diff --git a/framework/common/tcuTexture.hpp b/framework/common/tcuTexture.hpp index 0d5189c..84a28b9 100644 --- a/framework/common/tcuTexture.hpp +++ b/framework/common/tcuTexture.hpp @@ -89,6 +89,7 @@ public: SIGNED_INT32, UNSIGNED_INT8, UNSIGNED_INT16, + UNSIGNED_INT24, UNSIGNED_INT32, HALF_FLOAT, FLOAT, diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp index a959ee2..64b31d0 100644 --- a/framework/common/tcuTextureUtil.cpp +++ b/framework/common/tcuTextureUtil.cpp @@ -81,7 +81,7 @@ bool isSRGB (TextureFormat format) 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; @@ -91,7 +91,7 @@ bool isCombinedDepthStencilType (TextureFormat::ChannelType type) 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) { @@ -117,6 +117,7 @@ TextureChannelClass getTextureChannelClass (TextureFormat::ChannelType channelTy 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; @@ -236,7 +237,7 @@ ConstPixelBufferAccess flipYAccess (const ConstPixelBufferAccess& access) 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; @@ -264,6 +265,7 @@ static Vec2 getChannelValueRange (TextureFormat::ChannelType channelType) 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; @@ -322,7 +324,7 @@ TextureFormatInfo getTextureFormatInfo (const TextureFormat& format) 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) { @@ -344,6 +346,7 @@ static IVec4 getChannelBitDepth (TextureFormat::ChannelType 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); @@ -377,7 +380,7 @@ IVec4 getTextureFormatBitDepth (const TextureFormat& format) 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) { @@ -399,6 +402,7 @@ static IVec4 getChannelMantissaBitDepth (TextureFormat::ChannelType 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: @@ -1021,7 +1025,7 @@ template 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; diff --git a/modules/gles2/functional/es2fDepthStencilClearTests.cpp b/modules/gles2/functional/es2fDepthStencilClearTests.cpp index d8867af..030a062 100644 --- a/modules/gles2/functional/es2fDepthStencilClearTests.cpp +++ b/modules/gles2/functional/es2fDepthStencilClearTests.cpp @@ -93,7 +93,7 @@ tcu::TextureFormat getDepthFormat (int depthBits) { 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"); @@ -106,7 +106,7 @@ tcu::TextureFormat getStencilFormat (int stencilBits) { 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"); diff --git a/modules/gles3/functional/es3fDepthStencilClearTests.cpp b/modules/gles3/functional/es3fDepthStencilClearTests.cpp index d58d48f..a7b773d 100644 --- a/modules/gles3/functional/es3fDepthStencilClearTests.cpp +++ b/modules/gles3/functional/es3fDepthStencilClearTests.cpp @@ -93,7 +93,7 @@ tcu::TextureFormat getDepthFormat (int depthBits) { 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"); @@ -106,7 +106,7 @@ tcu::TextureFormat getStencilFormat (int stencilBits) { 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");