mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-22 15:19:02 +00:00
Enable -Werror for GCC/Clang builds (#786)
* Enable -Werror for GCC/Clang builds Fixes many of the errors this produces, and disables a handful that didn't have solutions that were obvious (to me). * Check for `-W*` flags empirically * Remove cl_APPLE_fp64_basic_ops support * Undo NAN conversion fix * Add comments to warning override flags * Remove unneeded STRINGIFY definition * Fix tautological compare issue in basic * Use ABS_ERROR macro in image tests * Use fabs for ABS_ERROR macro * Move ABS_ERROR definition to common header
This commit is contained in:
@@ -85,8 +85,6 @@ static const char *lodOffsetSource =
|
||||
static const char *offsetSource =
|
||||
" int offset = tidY*get_image_width(input) + tidX;\n";
|
||||
|
||||
#define ABS_ERROR( result, expected ) ( fabsf( (float)expected - (float)result ) )
|
||||
|
||||
extern void read_image_pixel_float( void *imageData, image_descriptor *imageInfo,
|
||||
int x, int y, int z, float *outData );
|
||||
template <class T> int determine_validation_error( void *imagePtr, image_descriptor *imageInfo, image_sampler_data *imageSampler,
|
||||
@@ -453,7 +451,7 @@ int validate_image_2D_depth_results(void *imageValues, void *resultValues, doubl
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.0f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, &containsDenormals );
|
||||
|
||||
float err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
float err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
// Clamp to the minimum absolute error for the format
|
||||
if (err1 > 0 && err1 < formatAbsoluteError) { err1 = 0.0f; }
|
||||
float maxErr1 = MAX( maxErr * maxPixel.p[0], FLT_MIN );
|
||||
@@ -472,7 +470,7 @@ int validate_image_2D_depth_results(void *imageValues, void *resultValues, doubl
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, NULL );
|
||||
|
||||
err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +503,7 @@ int validate_image_2D_depth_results(void *imageValues, void *resultValues, doubl
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, &containsDenormals );
|
||||
|
||||
float err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
float err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
float maxErr1 = MAX( maxErr * maxPixel.p[0], FLT_MIN );
|
||||
|
||||
|
||||
@@ -520,7 +518,7 @@ int validate_image_2D_depth_results(void *imageValues, void *resultValues, doubl
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, NULL );
|
||||
|
||||
err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
}
|
||||
}
|
||||
if( ! (err1 <= maxErr1) )
|
||||
@@ -611,10 +609,10 @@ int validate_image_2D_results(void *imageValues, void *resultValues, double form
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.0f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, &containsDenormals );
|
||||
|
||||
float err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
float err2 = fabsf( resultPtr[1] - expected[1] );
|
||||
float err3 = fabsf( resultPtr[2] - expected[2] );
|
||||
float err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
float err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
float err2 = ABS_ERROR(resultPtr[1], expected[1]);
|
||||
float err3 = ABS_ERROR(resultPtr[2], expected[2]);
|
||||
float err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
// Clamp to the minimum absolute error for the format
|
||||
if (err1 > 0 && err1 < formatAbsoluteError) { err1 = 0.0f; }
|
||||
if (err2 > 0 && err2 < formatAbsoluteError) { err2 = 0.0f; }
|
||||
@@ -648,10 +646,10 @@ int validate_image_2D_results(void *imageValues, void *resultValues, double form
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, NULL );
|
||||
|
||||
err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
err2 = fabsf( resultPtr[1] - expected[1] );
|
||||
err3 = fabsf( resultPtr[2] - expected[2] );
|
||||
err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
err2 = ABS_ERROR(resultPtr[1], expected[1]);
|
||||
err3 = ABS_ERROR(resultPtr[2], expected[2]);
|
||||
err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,10 +687,10 @@ int validate_image_2D_results(void *imageValues, void *resultValues, double form
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, &containsDenormals );
|
||||
|
||||
float err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
float err2 = fabsf( resultPtr[1] - expected[1] );
|
||||
float err3 = fabsf( resultPtr[2] - expected[2] );
|
||||
float err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
float err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
float err2 = ABS_ERROR(resultPtr[1], expected[1]);
|
||||
float err3 = ABS_ERROR(resultPtr[2], expected[2]);
|
||||
float err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
float maxErr1 = MAX( maxErr * maxPixel.p[0], FLT_MIN );
|
||||
float maxErr2 = MAX( maxErr * maxPixel.p[1], FLT_MIN );
|
||||
float maxErr3 = MAX( maxErr * maxPixel.p[2], FLT_MIN );
|
||||
@@ -719,10 +717,10 @@ int validate_image_2D_results(void *imageValues, void *resultValues, double form
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, NULL );
|
||||
|
||||
err1 = fabsf( resultPtr[0] - expected[0] );
|
||||
err2 = fabsf( resultPtr[1] - expected[1] );
|
||||
err3 = fabsf( resultPtr[2] - expected[2] );
|
||||
err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
err1 = ABS_ERROR(resultPtr[0], expected[0]);
|
||||
err2 = ABS_ERROR(resultPtr[1], expected[1]);
|
||||
err3 = ABS_ERROR(resultPtr[2], expected[2]);
|
||||
err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
}
|
||||
}
|
||||
if( ! (err1 <= maxErr1) || ! (err2 <= maxErr2) ||
|
||||
@@ -1008,10 +1006,13 @@ int validate_image_2D_sRGB_results(void *imageValues, void *resultValues, double
|
||||
maxPixel = sample_image_pixel_float_offset( imageValues, imageInfo,
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.0f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, &containsDenormals );
|
||||
float err1 = fabsf( sRGBmap( resultPtr[0] ) - sRGBmap( expected[0] ) );
|
||||
float err2 = fabsf( sRGBmap( resultPtr[1] ) - sRGBmap( expected[1] ) );
|
||||
float err3 = fabsf( sRGBmap( resultPtr[2] ) - sRGBmap( expected[2] ) );
|
||||
float err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
float err1 = ABS_ERROR(sRGBmap(resultPtr[0]),
|
||||
sRGBmap(expected[0]));
|
||||
float err2 = ABS_ERROR(sRGBmap(resultPtr[1]),
|
||||
sRGBmap(expected[1]));
|
||||
float err3 = ABS_ERROR(sRGBmap(resultPtr[2]),
|
||||
sRGBmap(expected[2]));
|
||||
float err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
float maxErr = 0.5;
|
||||
|
||||
// Check if the result matches.
|
||||
@@ -1034,10 +1035,13 @@ int validate_image_2D_sRGB_results(void *imageValues, void *resultValues, double
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, NULL );
|
||||
|
||||
err1 = fabsf( sRGBmap( resultPtr[0] ) - sRGBmap( expected[0] ) );
|
||||
err2 = fabsf( sRGBmap( resultPtr[1] ) - sRGBmap( expected[1] ) );
|
||||
err3 = fabsf( sRGBmap( resultPtr[2] ) - sRGBmap( expected[2] ) );
|
||||
err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
err1 = ABS_ERROR(sRGBmap(resultPtr[0]),
|
||||
sRGBmap(expected[0]));
|
||||
err2 = ABS_ERROR(sRGBmap(resultPtr[1]),
|
||||
sRGBmap(expected[1]));
|
||||
err3 = ABS_ERROR(sRGBmap(resultPtr[2]),
|
||||
sRGBmap(expected[2]));
|
||||
err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1075,10 +1079,13 @@ int validate_image_2D_sRGB_results(void *imageValues, void *resultValues, double
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, &containsDenormals );
|
||||
|
||||
float err1 = fabsf( sRGBmap( resultPtr[0] ) - sRGBmap( expected[0] ) );
|
||||
float err2 = fabsf( sRGBmap( resultPtr[1] ) - sRGBmap( expected[1] ) );
|
||||
float err3 = fabsf( sRGBmap( resultPtr[2] ) - sRGBmap( expected[2] ) );
|
||||
float err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
float err1 = ABS_ERROR(sRGBmap(resultPtr[0]),
|
||||
sRGBmap(expected[0]));
|
||||
float err2 = ABS_ERROR(sRGBmap(resultPtr[1]),
|
||||
sRGBmap(expected[1]));
|
||||
float err3 = ABS_ERROR(sRGBmap(resultPtr[2]),
|
||||
sRGBmap(expected[2]));
|
||||
float err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
float maxErr = 0.6;
|
||||
|
||||
if( ! (err1 <= maxErr) || ! (err2 <= maxErr) ||
|
||||
@@ -1099,10 +1106,13 @@ int validate_image_2D_sRGB_results(void *imageValues, void *resultValues, double
|
||||
xOffsetValues[ j ], yOffsetValues[ j ], 0.f, norm_offset_x, norm_offset_y, 0.0f,
|
||||
imageSampler, expected, 0, NULL );
|
||||
|
||||
err1 = fabsf( sRGBmap( resultPtr[0] ) - sRGBmap( expected[0] ) );
|
||||
err2 = fabsf( sRGBmap( resultPtr[1] ) - sRGBmap( expected[1] ) );
|
||||
err3 = fabsf( sRGBmap( resultPtr[2] ) - sRGBmap( expected[2] ) );
|
||||
err4 = fabsf( resultPtr[3] - expected[3] );
|
||||
err1 = ABS_ERROR(sRGBmap(resultPtr[0]),
|
||||
sRGBmap(expected[0]));
|
||||
err2 = ABS_ERROR(sRGBmap(resultPtr[1]),
|
||||
sRGBmap(expected[1]));
|
||||
err3 = ABS_ERROR(sRGBmap(resultPtr[2]),
|
||||
sRGBmap(expected[2]));
|
||||
err4 = ABS_ERROR(resultPtr[3], expected[3]);
|
||||
}
|
||||
}
|
||||
if( ! (err1 <= maxErr) || ! (err2 <= maxErr) ||
|
||||
|
||||
Reference in New Issue
Block a user