case FMT_CASE(DS, UNSIGNED_INT_24_8_REV): return VK_FORMAT_D24_UNORM_S8_UINT;
case FMT_CASE(DS, FLOAT_UNSIGNED_INT_24_8_REV): return VK_FORMAT_D32_SFLOAT_S8_UINT;
-
case FMT_CASE(R, UNORM_SHORT_10): return VK_FORMAT_R10X6_UNORM_PACK16_KHR;
case FMT_CASE(RG, UNORM_SHORT_10): return VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR;
case FMT_CASE(RGBA, UNORM_SHORT_10): return VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR;
case FMT_CASE(RG, UNORM_SHORT_12): return VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR;
case FMT_CASE(RGBA, UNORM_SHORT_12): return VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR;
+ case FMT_CASE(R, USCALED_INT8): return VK_FORMAT_R8_USCALED;
+ case FMT_CASE(RG, USCALED_INT8): return VK_FORMAT_R8G8_USCALED;
+ case FMT_CASE(RGB, USCALED_INT8): return VK_FORMAT_R8G8B8_USCALED;
+ case FMT_CASE(RGBA, USCALED_INT8): return VK_FORMAT_R8G8B8A8_USCALED;
+
+ case FMT_CASE(R, USCALED_INT16): return VK_FORMAT_R16_USCALED;
+ case FMT_CASE(RG, USCALED_INT16): return VK_FORMAT_R16G16_USCALED;
+ case FMT_CASE(RGB, USCALED_INT16): return VK_FORMAT_R16G16B16_USCALED;
+ case FMT_CASE(RGBA, USCALED_INT16): return VK_FORMAT_R16G16B16A16_USCALED;
+
+ case FMT_CASE(R, SSCALED_INT8): return VK_FORMAT_R8_SSCALED;
+ case FMT_CASE(RG, SSCALED_INT8): return VK_FORMAT_R8G8_SSCALED;
+ case FMT_CASE(RGB, SSCALED_INT8): return VK_FORMAT_R8G8B8_SSCALED;
+ case FMT_CASE(RGBA, SSCALED_INT8): return VK_FORMAT_R8G8B8A8_SSCALED;
+
+ case FMT_CASE(R, SSCALED_INT16): return VK_FORMAT_R16_SSCALED;
+ case FMT_CASE(RG, SSCALED_INT16): return VK_FORMAT_R16G16_SSCALED;
+ case FMT_CASE(RGB, SSCALED_INT16): return VK_FORMAT_R16G16B16_SSCALED;
+ case FMT_CASE(RGBA, SSCALED_INT16): return VK_FORMAT_R16G16B16A16_SSCALED;
+
+ case FMT_CASE(RGBA, USCALED_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_USCALED_PACK32;
+ case FMT_CASE(RGBA, SSCALED_INT_1010102_REV): return VK_FORMAT_A2B10G10R10_SSCALED_PACK32;
+
default:
TCU_THROW(InternalError, "Unknown texture format");
}
case VK_FORMAT_R8_UNORM: return TextureFormat(TextureFormat::R, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8_SNORM: return TextureFormat(TextureFormat::R, TextureFormat::SNORM_INT8);
- case VK_FORMAT_R8_USCALED: return TextureFormat(TextureFormat::R, TextureFormat::UNSIGNED_INT8);
- case VK_FORMAT_R8_SSCALED: return TextureFormat(TextureFormat::R, TextureFormat::SIGNED_INT8);
+ case VK_FORMAT_R8_USCALED: return TextureFormat(TextureFormat::R, TextureFormat::USCALED_INT8);
+ case VK_FORMAT_R8_SSCALED: return TextureFormat(TextureFormat::R, TextureFormat::SSCALED_INT8);
case VK_FORMAT_R8_UINT: return TextureFormat(TextureFormat::R, TextureFormat::UNSIGNED_INT8);
case VK_FORMAT_R8_SINT: return TextureFormat(TextureFormat::R, TextureFormat::SIGNED_INT8);
case VK_FORMAT_R8_SRGB: return TextureFormat(TextureFormat::sR, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8G8_UNORM: return TextureFormat(TextureFormat::RG, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8G8_SNORM: return TextureFormat(TextureFormat::RG, TextureFormat::SNORM_INT8);
- case VK_FORMAT_R8G8_USCALED: return TextureFormat(TextureFormat::RG, TextureFormat::UNSIGNED_INT8);
- case VK_FORMAT_R8G8_SSCALED: return TextureFormat(TextureFormat::RG, TextureFormat::SIGNED_INT8);
+ case VK_FORMAT_R8G8_USCALED: return TextureFormat(TextureFormat::RG, TextureFormat::USCALED_INT8);
+ case VK_FORMAT_R8G8_SSCALED: return TextureFormat(TextureFormat::RG, TextureFormat::SSCALED_INT8);
case VK_FORMAT_R8G8_UINT: return TextureFormat(TextureFormat::RG, TextureFormat::UNSIGNED_INT8);
case VK_FORMAT_R8G8_SINT: return TextureFormat(TextureFormat::RG, TextureFormat::SIGNED_INT8);
case VK_FORMAT_R8G8_SRGB: return TextureFormat(TextureFormat::sRG, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8G8B8_UNORM: return TextureFormat(TextureFormat::RGB, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8G8B8_SNORM: return TextureFormat(TextureFormat::RGB, TextureFormat::SNORM_INT8);
- case VK_FORMAT_R8G8B8_USCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::UNSIGNED_INT8);
- case VK_FORMAT_R8G8B8_SSCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::SIGNED_INT8);
+ case VK_FORMAT_R8G8B8_USCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::USCALED_INT8);
+ case VK_FORMAT_R8G8B8_SSCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::SSCALED_INT8);
case VK_FORMAT_R8G8B8_UINT: return TextureFormat(TextureFormat::RGB, TextureFormat::UNSIGNED_INT8);
case VK_FORMAT_R8G8B8_SINT: return TextureFormat(TextureFormat::RGB, TextureFormat::SIGNED_INT8);
case VK_FORMAT_R8G8B8_SRGB: return TextureFormat(TextureFormat::sRGB, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8G8B8A8_UNORM: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8);
case VK_FORMAT_R8G8B8A8_SNORM: return TextureFormat(TextureFormat::RGBA, TextureFormat::SNORM_INT8);
- case VK_FORMAT_R8G8B8A8_USCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT8);
- case VK_FORMAT_R8G8B8A8_SSCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT8);
+ case VK_FORMAT_R8G8B8A8_USCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::USCALED_INT8);
+ case VK_FORMAT_R8G8B8A8_SSCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::SSCALED_INT8);
case VK_FORMAT_R8G8B8A8_UINT: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT8);
case VK_FORMAT_R8G8B8A8_SINT: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT8);
case VK_FORMAT_R8G8B8A8_SRGB: return TextureFormat(TextureFormat::sRGBA, TextureFormat::UNORM_INT8);
case VK_FORMAT_R16_UNORM: return TextureFormat(TextureFormat::R, TextureFormat::UNORM_INT16);
case VK_FORMAT_R16_SNORM: return TextureFormat(TextureFormat::R, TextureFormat::SNORM_INT16);
- case VK_FORMAT_R16_USCALED: return TextureFormat(TextureFormat::R, TextureFormat::UNSIGNED_INT16);
- case VK_FORMAT_R16_SSCALED: return TextureFormat(TextureFormat::R, TextureFormat::SIGNED_INT16);
+ case VK_FORMAT_R16_USCALED: return TextureFormat(TextureFormat::R, TextureFormat::USCALED_INT16);
+ case VK_FORMAT_R16_SSCALED: return TextureFormat(TextureFormat::R, TextureFormat::SSCALED_INT16);
case VK_FORMAT_R16_UINT: return TextureFormat(TextureFormat::R, TextureFormat::UNSIGNED_INT16);
case VK_FORMAT_R16_SINT: return TextureFormat(TextureFormat::R, TextureFormat::SIGNED_INT16);
case VK_FORMAT_R16_SFLOAT: return TextureFormat(TextureFormat::R, TextureFormat::HALF_FLOAT);
case VK_FORMAT_R16G16_UNORM: return TextureFormat(TextureFormat::RG, TextureFormat::UNORM_INT16);
case VK_FORMAT_R16G16_SNORM: return TextureFormat(TextureFormat::RG, TextureFormat::SNORM_INT16);
- case VK_FORMAT_R16G16_USCALED: return TextureFormat(TextureFormat::RG, TextureFormat::UNSIGNED_INT16);
- case VK_FORMAT_R16G16_SSCALED: return TextureFormat(TextureFormat::RG, TextureFormat::SIGNED_INT16);
+ case VK_FORMAT_R16G16_USCALED: return TextureFormat(TextureFormat::RG, TextureFormat::USCALED_INT16);
+ case VK_FORMAT_R16G16_SSCALED: return TextureFormat(TextureFormat::RG, TextureFormat::SSCALED_INT16);
case VK_FORMAT_R16G16_UINT: return TextureFormat(TextureFormat::RG, TextureFormat::UNSIGNED_INT16);
case VK_FORMAT_R16G16_SINT: return TextureFormat(TextureFormat::RG, TextureFormat::SIGNED_INT16);
case VK_FORMAT_R16G16_SFLOAT: return TextureFormat(TextureFormat::RG, TextureFormat::HALF_FLOAT);
case VK_FORMAT_R16G16B16_UNORM: return TextureFormat(TextureFormat::RGB, TextureFormat::UNORM_INT16);
case VK_FORMAT_R16G16B16_SNORM: return TextureFormat(TextureFormat::RGB, TextureFormat::SNORM_INT16);
- case VK_FORMAT_R16G16B16_USCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::UNSIGNED_INT16);
- case VK_FORMAT_R16G16B16_SSCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::SIGNED_INT16);
+ case VK_FORMAT_R16G16B16_USCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::USCALED_INT16);
+ case VK_FORMAT_R16G16B16_SSCALED: return TextureFormat(TextureFormat::RGB, TextureFormat::SSCALED_INT16);
case VK_FORMAT_R16G16B16_UINT: return TextureFormat(TextureFormat::RGB, TextureFormat::UNSIGNED_INT16);
case VK_FORMAT_R16G16B16_SINT: return TextureFormat(TextureFormat::RGB, TextureFormat::SIGNED_INT16);
case VK_FORMAT_R16G16B16_SFLOAT: return TextureFormat(TextureFormat::RGB, TextureFormat::HALF_FLOAT);
case VK_FORMAT_R16G16B16A16_UNORM: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT16);
case VK_FORMAT_R16G16B16A16_SNORM: return TextureFormat(TextureFormat::RGBA, TextureFormat::SNORM_INT16);
- case VK_FORMAT_R16G16B16A16_USCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT16);
- case VK_FORMAT_R16G16B16A16_SSCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT16);
+ case VK_FORMAT_R16G16B16A16_USCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::USCALED_INT16);
+ case VK_FORMAT_R16G16B16A16_SSCALED: return TextureFormat(TextureFormat::RGBA, TextureFormat::SSCALED_INT16);
case VK_FORMAT_R16G16B16A16_UINT: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT16);
case VK_FORMAT_R16G16B16A16_SINT: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT16);
case VK_FORMAT_R16G16B16A16_SFLOAT: return TextureFormat(TextureFormat::RGBA, TextureFormat::HALF_FLOAT);
case VK_FORMAT_B8G8R8_UNORM: return TextureFormat(TextureFormat::BGR, TextureFormat::UNORM_INT8);
case VK_FORMAT_B8G8R8_SNORM: return TextureFormat(TextureFormat::BGR, TextureFormat::SNORM_INT8);
- case VK_FORMAT_B8G8R8_USCALED: return TextureFormat(TextureFormat::BGR, TextureFormat::UNSIGNED_INT8);
- case VK_FORMAT_B8G8R8_SSCALED: return TextureFormat(TextureFormat::BGR, TextureFormat::SIGNED_INT8);
+ case VK_FORMAT_B8G8R8_USCALED: return TextureFormat(TextureFormat::BGR, TextureFormat::USCALED_INT8);
+ case VK_FORMAT_B8G8R8_SSCALED: return TextureFormat(TextureFormat::BGR, TextureFormat::SSCALED_INT8);
case VK_FORMAT_B8G8R8_UINT: return TextureFormat(TextureFormat::BGR, TextureFormat::UNSIGNED_INT8);
case VK_FORMAT_B8G8R8_SINT: return TextureFormat(TextureFormat::BGR, TextureFormat::SIGNED_INT8);
case VK_FORMAT_B8G8R8_SRGB: return TextureFormat(TextureFormat::sBGR, TextureFormat::UNORM_INT8);
case VK_FORMAT_B8G8R8A8_UNORM: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNORM_INT8);
case VK_FORMAT_B8G8R8A8_SNORM: return TextureFormat(TextureFormat::BGRA, TextureFormat::SNORM_INT8);
- case VK_FORMAT_B8G8R8A8_USCALED: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNSIGNED_INT8);
- case VK_FORMAT_B8G8R8A8_SSCALED: return TextureFormat(TextureFormat::BGRA, TextureFormat::SIGNED_INT8);
+ case VK_FORMAT_B8G8R8A8_USCALED: return TextureFormat(TextureFormat::BGRA, TextureFormat::USCALED_INT8);
+ case VK_FORMAT_B8G8R8A8_SSCALED: return TextureFormat(TextureFormat::BGRA, TextureFormat::SSCALED_INT8);
case VK_FORMAT_B8G8R8A8_UINT: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNSIGNED_INT8);
case VK_FORMAT_B8G8R8A8_SINT: return TextureFormat(TextureFormat::BGRA, TextureFormat::SIGNED_INT8);
case VK_FORMAT_B8G8R8A8_SRGB: return TextureFormat(TextureFormat::sBGRA, TextureFormat::UNORM_INT8);
#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
case VK_FORMAT_A8B8G8R8_UNORM_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8);
case VK_FORMAT_A8B8G8R8_SNORM_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SNORM_INT8);
- case VK_FORMAT_A8B8G8R8_USCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT8);
- case VK_FORMAT_A8B8G8R8_SSCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT8);
+ case VK_FORMAT_A8B8G8R8_USCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::USCALED_INT8);
+ case VK_FORMAT_A8B8G8R8_SSCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SSCALED_INT8);
case VK_FORMAT_A8B8G8R8_UINT_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT8);
case VK_FORMAT_A8B8G8R8_SINT_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT8);
case VK_FORMAT_A8B8G8R8_SRGB_PACK32: return TextureFormat(TextureFormat::sRGBA, TextureFormat::UNORM_INT8);
case VK_FORMAT_A2R10G10B10_UNORM_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNORM_INT_1010102_REV);
case VK_FORMAT_A2R10G10B10_SNORM_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::SNORM_INT_1010102_REV);
- case VK_FORMAT_A2R10G10B10_USCALED_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNSIGNED_INT_1010102_REV);
- case VK_FORMAT_A2R10G10B10_SSCALED_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::SIGNED_INT_1010102_REV);
+ case VK_FORMAT_A2R10G10B10_USCALED_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::USCALED_INT_1010102_REV);
+ case VK_FORMAT_A2R10G10B10_SSCALED_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::SSCALED_INT_1010102_REV);
case VK_FORMAT_A2R10G10B10_UINT_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::UNSIGNED_INT_1010102_REV);
case VK_FORMAT_A2R10G10B10_SINT_PACK32: return TextureFormat(TextureFormat::BGRA, TextureFormat::SIGNED_INT_1010102_REV);
case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT_1010102_REV);
case VK_FORMAT_A2B10G10R10_SNORM_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SNORM_INT_1010102_REV);
- case VK_FORMAT_A2B10G10R10_USCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT_1010102_REV);
- case VK_FORMAT_A2B10G10R10_SSCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT_1010102_REV);
+ case VK_FORMAT_A2B10G10R10_USCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::USCALED_INT_1010102_REV);
+ case VK_FORMAT_A2B10G10R10_SSCALED_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SSCALED_INT_1010102_REV);
case VK_FORMAT_A2B10G10R10_UINT_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT_1010102_REV);
case VK_FORMAT_A2B10G10R10_SINT_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT_1010102_REV);
case tcu::TextureFormat::HALF_FLOAT: typePart = "16f"; break;
case tcu::TextureFormat::UNSIGNED_INT32: typePart = "32ui"; break;
+ case tcu::TextureFormat::USCALED_INT16:
case tcu::TextureFormat::UNSIGNED_INT16: typePart = "16ui"; break;
+ case tcu::TextureFormat::USCALED_INT8:
case tcu::TextureFormat::UNSIGNED_INT8: typePart = "8ui"; break;
case tcu::TextureFormat::SIGNED_INT32: typePart = "32i"; break;
+ case tcu::TextureFormat::SSCALED_INT16:
case tcu::TextureFormat::SIGNED_INT16: typePart = "16i"; break;
+ case tcu::TextureFormat::SSCALED_INT8:
case tcu::TextureFormat::SIGNED_INT8: typePart = "8i"; break;
case tcu::TextureFormat::UNORM_INT16: typePart = "16"; break;
{
const tcu::TextureFormat textureFormat = mapVkFormat(format);
- DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELTYPE_LAST == 46);
switch (textureFormat.type)
{
case tcu::TextureFormat::UNSIGNED_INT_16_8_8:
case tcu::TextureFormat::UNSIGNED_INT_24_8:
case tcu::TextureFormat::UNSIGNED_INT_24_8_REV:
+ case tcu::TextureFormat::SSCALED_INT_1010102_REV:
+ case tcu::TextureFormat::USCALED_INT_1010102_REV:
return true;
default:
bool isPackedType (const TextureFormat::ChannelType type)
{
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (type)
{
case TextureFormat::UNORM_INT_101010:
case TextureFormat::SNORM_INT_1010102_REV:
case TextureFormat::UNORM_INT_1010102_REV:
+ case TextureFormat::SSCALED_INT_1010102_REV:
+ case TextureFormat::USCALED_INT_1010102_REV:
return true;
default:
IVec4& bitOffsets,
int& baseTypeBytes)
{
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (texFormat.type)
{
break;
case TextureFormat::SNORM_INT_1010102_REV:
+ case TextureFormat::SSCALED_INT_1010102_REV:
bitSizes = IVec4(2, 10, 10, 10);
bitOffsets = IVec4(0, 2, 12, 22);
baseTypeBytes = 4;
break;
case TextureFormat::UNORM_INT_1010102_REV:
+ case TextureFormat::USCALED_INT_1010102_REV:
bitSizes = IVec4(2, 10, 10, 10);
bitOffsets = IVec4(0, 2, 12, 22);
baseTypeBytes = 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 == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (type)
{
case TextureFormat::FLOAT64: return (float)*((const double*)value);
case TextureFormat::UNORM_SHORT_10: return (float)((*((const deUint16*)value)) >> 6u) / 1023.0f;
case TextureFormat::UNORM_SHORT_12: return (float)((*((const deUint16*)value)) >> 4u) / 4095.0f;
+ case TextureFormat::USCALED_INT8: return (float)*((const deUint8*)value);
+ case TextureFormat::USCALED_INT16: return (float)*((const deUint16*)value);
+ case TextureFormat::SSCALED_INT8: return (float)*((const deInt8*)value);
+ case TextureFormat::SSCALED_INT16: return (float)*((const deInt16*)value);
default:
DE_ASSERT(DE_FALSE);
return 0.0f;
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 == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (type)
{
case TextureFormat::FLOAT64: return (int)*((const double*)value);
case TextureFormat::UNORM_SHORT_10: return (int)((*(((const deUint16*)value))) >> 6u);
case TextureFormat::UNORM_SHORT_12: return (int)((*(((const deUint16*)value))) >> 4u);
+ case TextureFormat::USCALED_INT8: return (int)*((const deUint8*)value);
+ case TextureFormat::USCALED_INT16: return (int)*((const deUint16*)value);
+ case TextureFormat::SSCALED_INT8: return (int)*((const deInt8*)value);
+ case TextureFormat::SSCALED_INT16: return (int)*((const deInt16*)value);
default:
DE_ASSERT(DE_FALSE);
return 0;
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 == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (type)
{
case TextureFormat::FLOAT64: *((double*)dst) = (double)src; break;
case TextureFormat::UNORM_SHORT_10: *((deUint16*)dst) = (deUint16)(convertSatRteUint10(src * 1023.0f) << 6u); break;
case TextureFormat::UNORM_SHORT_12: *((deUint16*)dst) = (deUint16)(convertSatRteUint12(src * 4095.0f) << 4u); break;
+ case TextureFormat::USCALED_INT8: *((deUint8*)dst) = convertSatRte<deUint8> (src); break;
+ case TextureFormat::USCALED_INT16: *((deUint16*)dst) = convertSatRte<deUint16> (src); break;
+ case TextureFormat::SSCALED_INT8: *((deInt8*)dst) = convertSatRte<deInt8> (src); break;
+ case TextureFormat::SSCALED_INT16: *((deInt16*)dst) = convertSatRte<deInt16> (src); break;
default:
DE_ASSERT(DE_FALSE);
}
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 == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (type)
{
case TextureFormat::FLOAT64: *((double*)dst) = (double)src; break;
case TextureFormat::UNORM_SHORT_10: *((deUint16*)dst) = (deUint16)(convertSatUint10(src) << 6u); break;
case TextureFormat::UNORM_SHORT_12: *((deUint16*)dst) = (deUint16)(convertSatUint12(src) << 4u); break;
+ case TextureFormat::USCALED_INT8: *((deUint8*)dst) = convertSat<deUint8> ((deUint32)src); break;
+ case TextureFormat::USCALED_INT16: *((deUint16*)dst) = convertSat<deUint16> ((deUint32)src); break;
+ case TextureFormat::SSCALED_INT8: *((deInt8*)dst) = convertSat<deInt8> (src); break;
+ case TextureFormat::SSCALED_INT16: *((deInt16*)dst) = convertSat<deInt16> (src); break;
default:
DE_ASSERT(DE_FALSE);
}
case TextureFormat::UNORM_INT_1010102_REV:
case TextureFormat::SIGNED_INT_1010102_REV:
case TextureFormat::UNSIGNED_INT_1010102_REV:
+ case TextureFormat::USCALED_INT_1010102_REV:
+ case TextureFormat::SSCALED_INT_1010102_REV:
return format.order == TextureFormat::RGBA || format.order == TextureFormat::BGRA;
case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
case TextureFormat::SIGNED_INT8:
case TextureFormat::SIGNED_INT16:
case TextureFormat::SIGNED_INT32:
+ case TextureFormat::SSCALED_INT8:
+ case TextureFormat::SSCALED_INT16:
return isColor;
case TextureFormat::UNSIGNED_INT8:
case TextureFormat::UNSIGNED_INT16:
case TextureFormat::UNSIGNED_INT24:
case TextureFormat::UNSIGNED_INT32:
+ case TextureFormat::USCALED_INT8:
+ case TextureFormat::USCALED_INT16:
return isColor || format.order == TextureFormat::S;
case TextureFormat::HALF_FLOAT:
return 0u;
}
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
}
int getNumUsedChannels (TextureFormat::ChannelOrder order)
int getChannelSize (TextureFormat::ChannelType type)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (type)
{
case TextureFormat::FLOAT64: return 8;
case TextureFormat::UNORM_SHORT_10: return 2;
case TextureFormat::UNORM_SHORT_12: return 2;
+ case TextureFormat::USCALED_INT8: return 1;
+ case TextureFormat::USCALED_INT16: return 2;
+ case TextureFormat::SSCALED_INT8: return 1;
+ case TextureFormat::SSCALED_INT16: return 2;
default:
DE_ASSERT(DE_FALSE);
return 0;
DE_ASSERT(isValid(format));
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (type)
{
case TextureFormat::UNSIGNED_INT_24_8:
case TextureFormat::UNSIGNED_INT_24_8_REV:
case TextureFormat::UNSIGNED_INT_16_8_8:
+ case TextureFormat::USCALED_INT_1010102_REV:
+ case TextureFormat::SSCALED_INT_1010102_REV:
return 4;
case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
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)), 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::USCALED_INT_1010102_REV:
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::SSCALED_INT_1010102_REV:
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_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::USCALED_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)), m_format.order, TextureFormat::RGBA).cast<int>();
case TextureFormat::SNORM_INT_1010102_REV: // Fall-through
+ case TextureFormat::SSCALED_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)), m_format.order, TextureFormat::RGBA);
case TextureFormat::UNORM_SHORT_1555:
}
case TextureFormat::UNSIGNED_INT_1010102_REV:
+ case TextureFormat::USCALED_INT_1010102_REV:
{
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);
}
case TextureFormat::SIGNED_INT_1010102_REV:
+ case TextureFormat::SSCALED_INT_1010102_REV:
{
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);
case TextureFormat::UNORM_INT_1010102_REV:
case TextureFormat::UNSIGNED_INT_1010102_REV:
+ case TextureFormat::USCALED_INT_1010102_REV:
{
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);
case TextureFormat::SNORM_INT_1010102_REV:
case TextureFormat::SIGNED_INT_1010102_REV:
+ case TextureFormat::SSCALED_INT_1010102_REV:
{
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);
std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelType type)
{
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
+
const char* const typeStrings[] =
{
"SNORM_INT8",
"FLOAT64",
"FLOAT_UNSIGNED_INT_24_8_REV",
"UNORM_SHORT_10",
- "UNORM_SHORT_12"
+ "UNORM_SHORT_12",
+ "USCALED_INT8",
+ "USCALED_INT16",
+ "SSCALED_INT8",
+ "SSCALED_INT16",
+ "USCALED_INT_1010102_REV",
+ "SSCALED_INT_1010102_REV"
};
return str << de::getSizedArrayElement<TextureFormat::CHANNELTYPE_LAST>(typeStrings, type);
UNORM_SHORT_10,
UNORM_SHORT_12,
+ USCALED_INT8,
+ USCALED_INT16,
+ SSCALED_INT8,
+ SSCALED_INT16,
+ USCALED_INT_1010102_REV,
+ SSCALED_INT_1010102_REV,
+
CHANNELTYPE_LAST
};
bool isCombinedDepthStencilType (TextureFormat::ChannelType type)
{
// make sure to update this if type table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
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 == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (channelType)
{
case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV: return TEXTURECHANNELCLASS_LAST; //!< packed float32-pad24-uint8
case TextureFormat::UNORM_SHORT_10: return TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
case TextureFormat::UNORM_SHORT_12: return TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
+ case TextureFormat::USCALED_INT8: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
+ case TextureFormat::USCALED_INT16: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
+ case TextureFormat::SSCALED_INT8: return TEXTURECHANNELCLASS_SIGNED_INTEGER;
+ case TextureFormat::SSCALED_INT16: return TEXTURECHANNELCLASS_SIGNED_INTEGER;
+ case TextureFormat::USCALED_INT_1010102_REV: return TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
+ case TextureFormat::SSCALED_INT_1010102_REV: return TEXTURECHANNELCLASS_SIGNED_INTEGER;
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 == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
float cMin = 0.0f;
float cMax = 0.0f;
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;
+ case TextureFormat::USCALED_INT8: cMin = 0.0f; cMax = 255.0f; break;
+ case TextureFormat::USCALED_INT16: cMin = 0.0f; cMax = 65535.0f; break;
+ case TextureFormat::SSCALED_INT8: cMin = -128.0f; cMax = 127.0f; break;
+ case TextureFormat::SSCALED_INT16: cMin = -32768.0f; cMax = 32767.0f; break;
+ case TextureFormat::USCALED_INT_1010102_REV: cMin = 0.0f; cMax = 1023.0f; break;
+ case TextureFormat::SSCALED_INT_1010102_REV: cMin = -512.0f; cMax = 511.0f; break;
default:
DE_ASSERT(false);
{
DE_ASSERT(getTextureChannelClass(format.type) == TEXTURECHANNELCLASS_SIGNED_INTEGER);
- if (format == TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT_1010102_REV) ||
+ if (format == TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT_1010102_REV) ||
+ format == TextureFormat(TextureFormat::BGRA, TextureFormat::SSCALED_INT_1010102_REV) ||
+ format == TextureFormat(TextureFormat::RGBA, TextureFormat::SSCALED_INT_1010102_REV) ||
format == TextureFormat(TextureFormat::BGRA, TextureFormat::SIGNED_INT_1010102_REV))
return IVec4(511, 511, 511, 1);
case TextureFormat::SIGNED_INT16: return IVec4(std::numeric_limits<deInt16>::max());
case TextureFormat::SIGNED_INT32: return IVec4(std::numeric_limits<deInt32>::max());
+ case TextureFormat::SSCALED_INT8: return IVec4(std::numeric_limits<deInt8>::max());
+ case TextureFormat::SSCALED_INT16: return IVec4(std::numeric_limits<deInt16>::max());
+
default:
DE_FATAL("Invalid channel type");
return IVec4(0);
DE_ASSERT(getTextureChannelClass(format.type) == TEXTURECHANNELCLASS_UNSIGNED_INTEGER);
if (format == TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT_1010102_REV) ||
+ format == TextureFormat(TextureFormat::RGBA, TextureFormat::USCALED_INT_1010102_REV) ||
+ format == TextureFormat(TextureFormat::BGRA, TextureFormat::USCALED_INT_1010102_REV) ||
format == TextureFormat(TextureFormat::BGRA, TextureFormat::UNSIGNED_INT_1010102_REV))
return UVec4(1023u, 1023u, 1023u, 3u);
case TextureFormat::UNSIGNED_INT24: return UVec4(0xffffffu);
case TextureFormat::UNSIGNED_INT32: return UVec4(std::numeric_limits<deUint32>::max());
+ case TextureFormat::USCALED_INT8: return UVec4(std::numeric_limits<deUint8>::max());
+ case TextureFormat::USCALED_INT16: return UVec4(std::numeric_limits<deUint16>::max());
+
default:
DE_FATAL("Invalid channel type");
return UVec4(0);
static IVec4 getChannelBitDepth (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (channelType)
{
case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV: return IVec4(32,8,0,0);
case TextureFormat::UNORM_SHORT_10: return IVec4(10);
case TextureFormat::UNORM_SHORT_12: return IVec4(12);
+ case TextureFormat::USCALED_INT8: return IVec4(8);
+ case TextureFormat::USCALED_INT16: return IVec4(16);
+ case TextureFormat::SSCALED_INT8: return IVec4(8);
+ case TextureFormat::SSCALED_INT16: return IVec4(16);
+ case TextureFormat::USCALED_INT_1010102_REV: return IVec4(10,10,10,2);
+ case TextureFormat::SSCALED_INT_1010102_REV: return IVec4(10,10,10,2);
default:
DE_ASSERT(false);
return IVec4(0);
static IVec4 getChannelMantissaBitDepth (TextureFormat::ChannelType channelType)
{
// make sure this table is updated if format table is updated
- DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
switch (channelType)
{
case TextureFormat::UNSIGNED_INT_999_E5_REV:
case TextureFormat::UNORM_SHORT_10:
case TextureFormat::UNORM_SHORT_12:
+ case TextureFormat::USCALED_INT8:
+ case TextureFormat::USCALED_INT16:
+ case TextureFormat::SSCALED_INT8:
+ case TextureFormat::SSCALED_INT16:
+ case TextureFormat::USCALED_INT_1010102_REV:
+ case TextureFormat::SSCALED_INT_1010102_REV:
return getChannelBitDepth(channelType);
case TextureFormat::HALF_FLOAT: return IVec4(10);
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 == 40);
+ DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46);
if (!isCombinedDepthStencilType(baseAccess.getFormat().type))
return baseAccess;
{ 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 },
+
+ { s_unsignedInt8In, DE_LENGTH_OF_ARRAY(s_unsignedInt8In), s_unsignedInt8FloatRef, s_unsignedInt8IntRef, s_unsignedInt8UintRef },
+ { s_unsignedInt16In, DE_LENGTH_OF_ARRAY(s_unsignedInt16In), s_unsignedInt16FloatRef, s_unsignedInt16IntRef, s_unsignedInt16UintRef },
+ { s_signedInt8In, DE_LENGTH_OF_ARRAY(s_signedInt8In), s_signedInt8FloatRef, s_signedInt8IntRef, s_signedInt8UintRef },
+ { s_signedInt16In, DE_LENGTH_OF_ARRAY(s_signedInt16In), s_signedInt16FloatRef, s_signedInt16IntRef, s_signedInt16UintRef },
+ { s_unsignedInt1010102RevIn, DE_LENGTH_OF_ARRAY(s_unsignedInt1010102RevIn), s_unsignedInt1010102RevFloatRef, s_unsignedInt1010102RevIntRef, s_unsignedInt1010102RevIntRef },
+ { s_unsignedInt1010102RevIn, DE_LENGTH_OF_ARRAY(s_unsignedInt1010102RevIn), s_signedInt1010102RevFloatRef, s_signedInt1010102RevIntRef, s_signedInt1010102RevIntRef }
};
DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_formatData) == TextureFormat::CHANNELTYPE_LAST);