Do not clamp ambiguous snorms values on vkCmdCopy*() functions
authorSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Mon, 17 May 2021 08:04:01 +0000 (10:04 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 28 May 2021 08:33:49 +0000 (08:33 +0000)
As per Vulkan WG agreed, these functions perform a bit-for-bit copy
of the values, even if the result is unrepresentable.

Reverts:

* "Fixes sparse resource SNORM tests"
  -> 00e745999e771df2a604bf24d85594a69ad441fe

* "copies_and_blitting: fix ambiguous signed normalized 1.0 value"
  -> bce4ec47056a0473ccce9cf7951023da80c3b745

Affects:
dEQP-VK.api.copy_and_blit.*.image_to_image.all_formats.color.*.r32_sfloat.a8b8g8r8_snorm_pack32*
dEQP-VK.api.copy_and_blit.*.image_to_image.all_formats.color.*.r32_sfloat.r8g8b8a8_snorm.*
dEQP-VK.sparse_resources.image_sparse_binding.*snorm*
dEQP-VK.sparse_resources.mipmap_sparse_residency.*snorm*

VK-GL-CTS issue: 2917
Componentes: Vulkan

Change-Id: I5878379aa78e68ac7452a83c1a64abf01c9472c8
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageSparseBinding.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesMipmapSparseResidency.cpp

index 0c307a8..ea7f46b 100644 (file)
@@ -1258,31 +1258,6 @@ tcu::TestStatus CopyImageToImage::checkTestResult (tcu::ConstPixelBufferAccess r
                        if (!tcu::floatThresholdCompare(m_context.getTestContext().getLog(), "Compare", "Result comparison", m_expectedTextureLevel[0]->getAccess(), result, fThreshold, tcu::COMPARE_LOG_RESULT))
                                return tcu::TestStatus::fail("CopiesAndBlitting test");
                }
-               else if (isSnormFormat(mapTextureFormat(result.getFormat())))
-               {
-                       // There may be an ambiguity between two possible binary representations of 1.0.
-                       // Get rid of that by expanding the data to floats and re-normalizing again.
-
-                       tcu::TextureLevel resultSnorm   (result.getFormat(), result.getWidth(), result.getHeight(), result.getDepth());
-                       {
-                               tcu::TextureLevel resultFloat   (tcu::TextureFormat(resultSnorm.getFormat().order, tcu::TextureFormat::FLOAT), resultSnorm.getWidth(), resultSnorm.getHeight(), resultSnorm.getDepth());
-
-                               tcu::copy(resultFloat.getAccess(), result);
-                               tcu::copy(resultSnorm, resultFloat.getAccess());
-                       }
-
-                       tcu::TextureLevel expectedSnorm (m_expectedTextureLevel[0]->getFormat(), m_expectedTextureLevel[0]->getWidth(), m_expectedTextureLevel[0]->getHeight(), m_expectedTextureLevel[0]->getDepth());
-
-                       {
-                               tcu::TextureLevel expectedFloat (tcu::TextureFormat(expectedSnorm.getFormat().order, tcu::TextureFormat::FLOAT), expectedSnorm.getWidth(), expectedSnorm.getHeight(), expectedSnorm.getDepth());
-
-                               tcu::copy(expectedFloat.getAccess(), m_expectedTextureLevel[0]->getAccess());
-                               tcu::copy(expectedSnorm, expectedFloat.getAccess());
-                       }
-
-                       if (!tcu::intThresholdCompare(m_context.getTestContext().getLog(), "Compare", "Result comparison", expectedSnorm.getAccess(), resultSnorm.getAccess(), uThreshold, tcu::COMPARE_LOG_RESULT))
-                               return tcu::TestStatus::fail("CopiesAndBlitting test");
-               }
                else
                {
                        if (!tcu::intThresholdCompare(m_context.getTestContext().getLog(), "Compare", "Result comparison", m_expectedTextureLevel[0]->getAccess(), result, uThreshold, tcu::COMPARE_LOG_RESULT))
index c80367f..48446a0 100755 (executable)
@@ -428,24 +428,10 @@ tcu::TestStatus ImageSparseBindingInstance::iterate (void)
                {
                        for (deUint32 mipmapNdx = 0; mipmapNdx < imageSparseInfo.mipLevels; ++mipmapNdx)
                        {
-                               const deUint32  mipLevelSizeInBytes             = getImageMipLevelSizeInBytes(imageSparseInfo.extent, imageSparseInfo.arrayLayers, formatDescription, planeNdx, mipmapNdx);
-                               const deUint32  bufferOffset                    = static_cast<deUint32>(bufferImageCopy[ planeNdx * imageSparseInfo.mipLevels + mipmapNdx].bufferOffset);
-                               bool                    is8bitSnormComponent    = false;
+                               const deUint32 mipLevelSizeInBytes      = getImageMipLevelSizeInBytes(imageSparseInfo.extent, imageSparseInfo.arrayLayers, formatDescription, planeNdx, mipmapNdx);
+                               const deUint32 bufferOffset                     = static_cast<deUint32>(bufferImageCopy[ planeNdx * imageSparseInfo.mipLevels + mipmapNdx].bufferOffset);
 
                                // Validate results
-                               for (deUint32 channelNdx = 0; channelNdx < 4; ++channelNdx)
-                               {
-                                       if (!formatDescription.hasChannelNdx(channelNdx))
-                                               continue;
-
-                                       if ((formatDescription.channels[channelNdx].type == tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT) &&
-                                               (formatDescription.channels[channelNdx].sizeBits == 8))
-                                       {
-                                               is8bitSnormComponent = true;
-                                               break;
-                                       }
-                               }
-
                                for (size_t byteNdx = 0; byteNdx < mipLevelSizeInBytes; byteNdx++)
                                {
                                        const deUint8   res     = *(outputData + bufferOffset + byteNdx);
@@ -458,7 +444,7 @@ tcu::TestStatus ImageSparseBindingInstance::iterate (void)
                                        else if (!(byteNdx & 0x01) && (ignoreLsb4Bits))
                                                mask = 0xF0;
 
-                                       if (((!is8bitSnormComponent) || (ref != 0x80)) &&  ((res & mask) != (ref & mask)))
+                                       if ((res & mask) != (ref & mask))
                                        {
                                                return tcu::TestStatus::fail("Failed");
                                        }
index 5c02cc9..200c7de 100755 (executable)
@@ -551,40 +551,11 @@ tcu::TestStatus MipmapSparseResidencyInstance::iterate (void)
                {
                        for (deUint32 mipmapNdx = 0; mipmapNdx < imageSparseInfo.mipLevels; ++mipmapNdx)
                        {
-                               const deUint32  mipLevelSizeInBytes             = getImageMipLevelSizeInBytes(imageSparseInfo.extent, imageSparseInfo.arrayLayers, formatDescription, planeNdx, mipmapNdx);
-                               const deUint32  bufferOffset                    = static_cast<deUint32>(bufferImageCopy[planeNdx*imageSparseInfo.mipLevels + mipmapNdx].bufferOffset);
-                               bool                    is8bitSnormComponent    = false;
+                               const deUint32 mipLevelSizeInBytes      = getImageMipLevelSizeInBytes(imageSparseInfo.extent, imageSparseInfo.arrayLayers, formatDescription, planeNdx, mipmapNdx);
+                               const deUint32 bufferOffset                     = static_cast<deUint32>(bufferImageCopy[planeNdx*imageSparseInfo.mipLevels + mipmapNdx].bufferOffset);
 
-                               // Validate results
-                               for (deUint32 channelNdx = 0; channelNdx < 4; ++channelNdx)
-                               {
-                                       if (!formatDescription.hasChannelNdx(channelNdx))
-                                               continue;
-
-                                       if ((formatDescription.channels[channelNdx].type == tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT) &&
-                                               (formatDescription.channels[channelNdx].sizeBits == 8))
-                                       {
-                                               is8bitSnormComponent = true;
-                                               break;
-                                       }
-                               }
-
-                               if (!is8bitSnormComponent)
-                               {
-                                       if (deMemCmp(outputData + bufferOffset, &referenceData[bufferOffset], mipLevelSizeInBytes) != 0)
-                                               return tcu::TestStatus::fail("Failed");
-                               }
-                               else
-                               {
-                                       for (deUint32 byte = 0; byte < mipLevelSizeInBytes; byte++)
-                                       {
-                                               deUint32 entryOffset = bufferOffset + byte;
-
-                                               // Ignore 0x80 which is undefined data for a 8 bit snorm component
-                                               if ((referenceData[entryOffset] != 0x80) && (deMemCmp(outputData + entryOffset, &referenceData[entryOffset], 1) != 0))
-                                                       return tcu::TestStatus::fail("Failed");
-                                       }
-                               }
+                               if (deMemCmp(outputData + bufferOffset, &referenceData[bufferOffset], mipLevelSizeInBytes) != 0)
+                                       return tcu::TestStatus::fail("Failed");
                        }
                }
        }