Ignore padding bits in clCopyImage/clFillImage testing (#1184)

The CL_UNORM_SHORT_555 and CL_UNORM_INT_101010 formats contain padding
bits which need to be ignored in clCopyImage and clFillImage testing.

For clFillImage tests, padding was not ignored for the CL_UNORM_SHORT_555
format, and was ignored for CL_UNORM_INT_101010 by modifying actual and
reference data.  For clCopyImage tests, padding was not ignored, both for
CL_UNORM_SHORT_555 and for CL_UNORM_INT_101010.

Fix this by adding a new compare_scanlines() function, which is used for
both of these formats, and does not modify the actual or reference data.

Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
Stuart Brady
2021-05-24 16:59:03 +01:00
committed by GitHub
parent ed839ebf10
commit 0876ea10be
4 changed files with 64 additions and 27 deletions

View File

@@ -468,27 +468,19 @@ int test_fill_image_generic( cl_context context, cl_command_queue queue, image_d
{
for ( size_t y = 0; y < secondDim; y++ )
{
// If the data type is 101010 ignore bits 31 and 32 when comparing the row
if (imageInfo->format->image_channel_data_type == CL_UNORM_INT_101010) {
for (size_t w=0;w!=scanlineSize/4;++w) {
((cl_uint*)sourcePtr)[w] &= 0x3FFFFFFF;
((cl_uint*)destPtr)[w] &= 0x3FFFFFFF;
}
}
if (memcmp( sourcePtr, destPtr, scanlineSize ) != 0)
{
// Find the first missing pixel
// Find the first differing pixel
size_t pixel_size = get_pixel_size( imageInfo->format );
size_t where = 0;
for ( where = 0; where < imageInfo->width; where++ )
if ( memcmp( sourcePtr + pixel_size * where, destPtr + pixel_size * where, pixel_size) )
break;
size_t where = compare_scanlines(imageInfo, sourcePtr, destPtr);
print_first_pixel_difference_error(
where, sourcePtr + pixel_size * where,
destPtr + pixel_size * where, imageInfo, y, thirdDim);
return -1;
if (where < imageInfo->width)
{
print_first_pixel_difference_error(
where, sourcePtr + pixel_size * where,
destPtr + pixel_size * where, imageInfo, y, thirdDim);
return -1;
}
}
total_matched += scanlineSize;