// Wait for sparse queue to become idle
deviceInterface.queueWaitIdle(sparseQueue.queueHandle);
- const deUint8* outputData = static_cast<const deUint8*>(outputBufferAlloc->getHostPtr());
+ const deUint8* outputData = static_cast<const deUint8*>(outputBufferAlloc->getHostPtr());
+ bool ignoreLsb6Bits = areLsb6BitsDontCare(imageSparseInfo.format);
+ bool ignoreLsb4Bits = areLsb4BitsDontCare(imageSparseInfo.format);
for (deUint32 planeNdx = 0; planeNdx < formatDescription.numPlanes; ++planeNdx)
{
}
}
- if (!is8bitSnormComponent)
+ for (size_t byteNdx = 0; byteNdx < mipLevelSizeInBytes; byteNdx++)
{
- 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;
+ const deUint8 res = *(outputData + bufferOffset + byteNdx);
+ const deUint8 ref = referenceData[bufferOffset + byteNdx];
- // 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");
+ deUint8 mask = 0xFF;
+
+ if (!(byteNdx & 0x01) && (ignoreLsb6Bits))
+ mask = 0xC0;
+ else if (!(byteNdx & 0x01) && (ignoreLsb4Bits))
+ mask = 0xF0;
+
+ if (((!is8bitSnormComponent) || (ref != 0x80)) && ((res & mask) != (ref & mask)))
+ {
+ return tcu::TestStatus::fail("Failed");
}
}
}
return result;
}
+bool areLsb6BitsDontCare(vk::VkFormat format)
+{
+ if ((format == vk::VK_FORMAT_R10X6_UNORM_PACK16) ||
+ (format == vk::VK_FORMAT_R10X6G10X6_UNORM_2PACK16) ||
+ (format == vk::VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16) ||
+ (format == vk::VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16) ||
+ (format == vk::VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16) ||
+ (format == vk::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool areLsb4BitsDontCare(vk::VkFormat format)
+{
+ if ((format == vk::VK_FORMAT_R12X4_UNORM_PACK16) ||
+ (format == vk::VK_FORMAT_R12X4G12X4_UNORM_2PACK16) ||
+ (format == vk::VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16) ||
+ (format == vk::VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16) ||
+ (format == vk::VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16) ||
+ (format == vk::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16) ||
+ (format == vk::VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16))
+ {
+ return true;
+ }
+
+ return false;
+}
+
} // sparse
} // vkt
vk::VkFormat getPlaneCompatibleFormatForWriting (const vk::PlanarFormatDescription& formatInfo,
deUint32 planeNdx);
+bool areLsb6BitsDontCare(vk::VkFormat format);
+
+bool areLsb4BitsDontCare(vk::VkFormat format);
+
template<typename T>
inline de::SharedPtr<vk::Unique<T> > makeVkSharedPtr (vk::Move<T> vkMove)
{