mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Fix snorm (#2033)
When comparing scanlines for SNORM images, take into account that -1.0 can be exactly represented in two different ways. --------- Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
This commit is contained in:
@@ -490,6 +490,32 @@ size_t compare_scanlines(const image_descriptor *imageInfo, const char *aPtr,
|
||||
}
|
||||
break;
|
||||
|
||||
case CL_SNORM_INT8: {
|
||||
cl_uchar aPixel = *(cl_uchar *)aPtr;
|
||||
cl_uchar bPixel = *(cl_uchar *)bPtr;
|
||||
// -1.0 is defined as 0x80 and 0x81
|
||||
aPixel = (aPixel == 0x80) ? 0x81 : aPixel;
|
||||
bPixel = (bPixel == 0x80) ? 0x81 : bPixel;
|
||||
if (aPixel != bPixel)
|
||||
{
|
||||
return column;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CL_SNORM_INT16: {
|
||||
cl_ushort aPixel = *(cl_ushort *)aPtr;
|
||||
cl_ushort bPixel = *(cl_ushort *)bPtr;
|
||||
// -1.0 is defined as 0x8000 and 0x8001
|
||||
aPixel = (aPixel == 0x8000) ? 0x8001 : aPixel;
|
||||
bPixel = (bPixel == 0x8000) ? 0x8001 : bPixel;
|
||||
if (aPixel != bPixel)
|
||||
{
|
||||
return column;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (memcmp(aPtr, bPtr, pixel_size) != 0) return column;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user