From b79b96d13aeee6ba285d01f964464b4488c9fe15 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mika=20V=C3=A4in=C3=B6l=C3=A4?= Date: Tue, 27 Aug 2019 14:44:20 +0300 Subject: [PATCH] Enable roundtrip for scaled formats in TCU Currently some swizzle tests attempting to use scaled formats end up testing integer formats instead and pass even though the implementation does not actually support the required scaled format features. This CL adds scaled TCU TextureFormats which should behave identically to integer formats but enable scaled VkFormats to be mapped correctly. Affects: dEQP-VK.texture.swizzle.*scaled* Components: Framework, Vulkan VK-GL-CTS issue: 1752 Change-Id: I038f0f82448f3c44af8d4fec0b6f258013d90f5e --- .../vulkancts/framework/vulkan/vkImageUtil.cpp | 76 ++++++++++++++-------- .../modules/vulkan/image/vktImageTestsUtil.cpp | 8 ++- .../vulkan/texture/vktSampleVerifierUtil.cpp | 8 ++- framework/common/tcuTexture.cpp | 60 ++++++++++++++--- framework/common/tcuTexture.hpp | 7 ++ framework/common/tcuTextureUtil.cpp | 48 ++++++++++++-- modules/internal/ditTextureFormatTests.cpp | 7 ++ 7 files changed, 169 insertions(+), 45 deletions(-) diff --git a/external/vulkancts/framework/vulkan/vkImageUtil.cpp b/external/vulkancts/framework/vulkan/vkImageUtil.cpp index 68f2cbe..3882727 100644 --- a/external/vulkancts/framework/vulkan/vkImageUtil.cpp +++ b/external/vulkancts/framework/vulkan/vkImageUtil.cpp @@ -1739,7 +1739,6 @@ VkFormat mapTextureFormat (const tcu::TextureFormat& format) 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; @@ -1748,6 +1747,29 @@ VkFormat mapTextureFormat (const tcu::TextureFormat& format) 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"); } @@ -1849,64 +1871,64 @@ tcu::TextureFormat mapVkFormat (VkFormat 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); @@ -1937,16 +1959,16 @@ tcu::TextureFormat mapVkFormat (VkFormat format) 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); @@ -1966,8 +1988,8 @@ tcu::TextureFormat mapVkFormat (VkFormat format) #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); @@ -1977,15 +1999,15 @@ tcu::TextureFormat mapVkFormat (VkFormat format) 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); diff --git a/external/vulkancts/modules/vulkan/image/vktImageTestsUtil.cpp b/external/vulkancts/modules/vulkan/image/vktImageTestsUtil.cpp index 9cf9bfc..44e84a9 100644 --- a/external/vulkancts/modules/vulkan/image/vktImageTestsUtil.cpp +++ b/external/vulkancts/modules/vulkan/image/vktImageTestsUtil.cpp @@ -626,11 +626,15 @@ std::string getShaderImageFormatQualifier (const tcu::TextureFormat& format) 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; @@ -800,7 +804,7 @@ bool isPackedType (const vk::VkFormat format) { 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) { @@ -824,6 +828,8 @@ bool isPackedType (const vk::VkFormat format) 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: diff --git a/external/vulkancts/modules/vulkan/texture/vktSampleVerifierUtil.cpp b/external/vulkancts/modules/vulkan/texture/vktSampleVerifierUtil.cpp index e33869b..1b0d9d5 100644 --- a/external/vulkancts/modules/vulkan/texture/vktSampleVerifierUtil.cpp +++ b/external/vulkancts/modules/vulkan/texture/vktSampleVerifierUtil.cpp @@ -653,7 +653,7 @@ void convertNormalizedInt (deInt64 num, bool isPackedType (const TextureFormat::ChannelType type) { - DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); switch (type) { @@ -666,6 +666,8 @@ bool isPackedType (const TextureFormat::ChannelType 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: @@ -678,7 +680,7 @@ void getPackInfo (const TextureFormat texFormat, IVec4& bitOffsets, int& baseTypeBytes) { - DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); switch (texFormat.type) { @@ -725,12 +727,14 @@ void getPackInfo (const TextureFormat texFormat, 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; diff --git a/framework/common/tcuTexture.cpp b/framework/common/tcuTexture.cpp index f5c85b6..bda2575 100644 --- a/framework/common/tcuTexture.cpp +++ b/framework/common/tcuTexture.cpp @@ -274,7 +274,7 @@ inline deUint16 convertSatRteUint12 (float f) 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) { @@ -297,6 +297,10 @@ inline float channelToFloat (const deUint8* value, TextureFormat::ChannelType ty 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; @@ -306,7 +310,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 == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); switch (type) { @@ -329,6 +333,10 @@ inline int channelToInt (const deUint8* value, TextureFormat::ChannelType 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; @@ -338,7 +346,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 == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); switch (type) { @@ -361,6 +369,10 @@ void floatToChannel (deUint8* dst, float src, TextureFormat::ChannelType 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 (src); break; + case TextureFormat::USCALED_INT16: *((deUint16*)dst) = convertSatRte (src); break; + case TextureFormat::SSCALED_INT8: *((deInt8*)dst) = convertSatRte (src); break; + case TextureFormat::SSCALED_INT16: *((deInt16*)dst) = convertSatRte (src); break; default: DE_ASSERT(DE_FALSE); } @@ -425,7 +437,7 @@ static inline deUint16 convertSatUint12 (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 == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); switch (type) { @@ -446,6 +458,10 @@ void intToChannel (deUint8* dst, int src, TextureFormat::ChannelType 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 ((deUint32)src); break; + case TextureFormat::USCALED_INT16: *((deUint16*)dst) = convertSat ((deUint32)src); break; + case TextureFormat::SSCALED_INT8: *((deInt8*)dst) = convertSat (src); break; + case TextureFormat::SSCALED_INT16: *((deInt16*)dst) = convertSat (src); break; default: DE_ASSERT(DE_FALSE); } @@ -602,6 +618,8 @@ bool isValid (TextureFormat format) 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: @@ -618,12 +636,16 @@ bool isValid (TextureFormat format) 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: @@ -643,7 +665,7 @@ bool isValid (TextureFormat format) return 0u; } - DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); } int getNumUsedChannels (TextureFormat::ChannelOrder order) @@ -683,7 +705,7 @@ 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) { @@ -706,6 +728,10 @@ int getChannelSize (TextureFormat::ChannelType 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; @@ -721,7 +747,7 @@ int getPixelSize (TextureFormat format) 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) { @@ -749,6 +775,8 @@ int getPixelSize (TextureFormat format) 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: @@ -1017,7 +1045,9 @@ Vec4 ConstPixelBufferAccess::getPixel (int x, int y, int z) const 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(); + 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(); case TextureFormat::UNSIGNED_INT_999_E5_REV: return unpackRGB999E5(*((const deUint32*)pixelPtr)); @@ -1111,8 +1141,10 @@ IVec4 ConstPixelBufferAccess::getPixelInt (int x, int y, int z) const case TextureFormat::UNORM_SHORT_5551: return swizzleRB(UVec4(U16(11, 5), U16( 6, 5), U16( 1, 5), U16( 0, 1)).cast(), m_format.order, TextureFormat::RGBA); case TextureFormat::UNORM_INT_101010: return UVec4(U32(22, 10), U32(12, 10), U32( 2, 10), 1).cast(); 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(); 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: @@ -1347,6 +1379,7 @@ void PixelBufferAccess::setPixel (const Vec4& color, int x, int y, int z) const } case TextureFormat::UNSIGNED_INT_1010102_REV: + case TextureFormat::USCALED_INT_1010102_REV: { const UVec4 u = swizzleRB(color.cast(), 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); @@ -1354,6 +1387,7 @@ void PixelBufferAccess::setPixel (const Vec4& color, int x, int y, int z) const } case TextureFormat::SIGNED_INT_1010102_REV: + case TextureFormat::SSCALED_INT_1010102_REV: { const IVec4 u = swizzleRB(color.cast(), 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); @@ -1464,6 +1498,7 @@ void PixelBufferAccess::setPixel (const IVec4& color, int x, int y, int z) const 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); @@ -1472,6 +1507,7 @@ void PixelBufferAccess::setPixel (const IVec4& color, int x, int y, int z) const 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); @@ -3828,6 +3864,8 @@ std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelOrder order) std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelType type) { + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); + const char* const typeStrings[] = { "SNORM_INT8", @@ -3869,7 +3907,13 @@ std::ostream& operator<< (std::ostream& str, TextureFormat::ChannelType type) "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(typeStrings, type); diff --git a/framework/common/tcuTexture.hpp b/framework/common/tcuTexture.hpp index b8d2be0..a0fdff5 100644 --- a/framework/common/tcuTexture.hpp +++ b/framework/common/tcuTexture.hpp @@ -113,6 +113,13 @@ public: UNORM_SHORT_10, UNORM_SHORT_12, + USCALED_INT8, + USCALED_INT16, + SSCALED_INT8, + SSCALED_INT16, + USCALED_INT_1010102_REV, + SSCALED_INT_1010102_REV, + CHANNELTYPE_LAST }; diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp index 215442b..04d9bf4 100644 --- a/framework/common/tcuTextureUtil.cpp +++ b/framework/common/tcuTextureUtil.cpp @@ -120,7 +120,7 @@ tcu::Vec4 linearToSRGBIfNeeded (const TextureFormat& format, const tcu::Vec4& co 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 || @@ -162,7 +162,7 @@ bool hasDepthComponent (TextureFormat::ChannelOrder order) 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) { @@ -206,6 +206,12 @@ TextureChannelClass getTextureChannelClass (TextureFormat::ChannelType channelTy 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; @@ -349,7 +355,7 @@ ConstPixelBufferAccess flipYAccess (const ConstPixelBufferAccess& access) 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; @@ -393,6 +399,12 @@ static Vec2 getFloatChannelValueRange (TextureFormat::ChannelType channelType) 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); @@ -478,7 +490,9 @@ IVec4 getFormatMaxIntValue (const TextureFormat& format) { 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); @@ -488,6 +502,9 @@ IVec4 getFormatMaxIntValue (const TextureFormat& format) case TextureFormat::SIGNED_INT16: return IVec4(std::numeric_limits::max()); case TextureFormat::SIGNED_INT32: return IVec4(std::numeric_limits::max()); + case TextureFormat::SSCALED_INT8: return IVec4(std::numeric_limits::max()); + case TextureFormat::SSCALED_INT16: return IVec4(std::numeric_limits::max()); + default: DE_FATAL("Invalid channel type"); return IVec4(0); @@ -499,6 +516,8 @@ UVec4 getFormatMaxUintValue (const TextureFormat& format) 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); @@ -509,6 +528,9 @@ UVec4 getFormatMaxUintValue (const TextureFormat& format) case TextureFormat::UNSIGNED_INT24: return UVec4(0xffffffu); case TextureFormat::UNSIGNED_INT32: return UVec4(std::numeric_limits::max()); + case TextureFormat::USCALED_INT8: return UVec4(std::numeric_limits::max()); + case TextureFormat::USCALED_INT16: return UVec4(std::numeric_limits::max()); + default: DE_FATAL("Invalid channel type"); return UVec4(0); @@ -518,7 +540,7 @@ UVec4 getFormatMaxUintValue (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 == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); switch (channelType) { @@ -562,6 +584,12 @@ static IVec4 getChannelBitDepth (TextureFormat::ChannelType 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); @@ -587,7 +615,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 == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); switch (channelType) { @@ -626,6 +654,12 @@ static IVec4 getChannelMantissaBitDepth (TextureFormat::ChannelType 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); @@ -1264,7 +1298,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 == 40); + DE_STATIC_ASSERT(TextureFormat::CHANNELTYPE_LAST == 46); if (!isCombinedDepthStencilType(baseAccess.getFormat().type)) return baseAccess; diff --git a/modules/internal/ditTextureFormatTests.cpp b/modules/internal/ditTextureFormatTests.cpp index 7cbc5f8..e8bcf81 100644 --- a/modules/internal/ditTextureFormatTests.cpp +++ b/modules/internal/ditTextureFormatTests.cpp @@ -1170,6 +1170,13 @@ static const struct { 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); -- 2.7.4