mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-21 14:59:02 +00:00
cl22: Reuse test harness code in clReadWriteImage (#208)
Some of the setup functionality is already there in the test harness, so use that and remove the duplicated code from within the suite. Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This commit is contained in:
committed by
Kévin Petit
parent
5f261cb57e
commit
f42a688ac2
@@ -20,18 +20,16 @@ extern cl_addressing_mode gAddressModeToUse;
|
||||
extern int gTypesToTest;
|
||||
extern int gNormalizedModeToUse;
|
||||
extern cl_channel_type gChannelTypeToUse;
|
||||
extern cl_command_queue queue;
|
||||
extern cl_context context;
|
||||
|
||||
|
||||
extern bool gDebugTrace;
|
||||
extern bool gTestMipmaps;
|
||||
|
||||
extern int test_read_image_set_1D( cl_device_id device, cl_image_format *format );
|
||||
extern int test_read_image_set_2D( cl_device_id device, cl_image_format *format );
|
||||
extern int test_read_image_set_3D( cl_device_id device, cl_image_format *format );
|
||||
extern int test_read_image_set_1D_array( cl_device_id device, cl_image_format *format );
|
||||
extern int test_read_image_set_2D_array( cl_device_id device, cl_image_format *format );
|
||||
extern int test_read_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
||||
extern int test_read_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
||||
extern int test_read_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
||||
extern int test_read_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
||||
extern int test_read_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
||||
|
||||
static const char *str_1d_image = "1D";
|
||||
static const char *str_2d_image = "2D";
|
||||
@@ -113,7 +111,7 @@ int filter_formats( cl_image_format *formatList, bool *filterFlags, unsigned int
|
||||
return numSupported;
|
||||
}
|
||||
|
||||
int get_format_list( cl_device_id device, cl_mem_object_type imageType, cl_image_format * &outFormatList, unsigned int &outFormatCount, cl_mem_flags flags )
|
||||
int get_format_list( cl_context context, cl_mem_object_type imageType, cl_image_format * &outFormatList, unsigned int &outFormatCount, cl_mem_flags flags )
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -129,7 +127,7 @@ int get_format_list( cl_device_id device, cl_mem_object_type imageType, cl_image
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_image_type( cl_device_id device, cl_mem_object_type imageType, cl_mem_flags flags )
|
||||
int test_image_type( cl_device_id device, cl_context context, cl_command_queue queue, cl_mem_object_type imageType, cl_mem_flags flags )
|
||||
{
|
||||
log_info( "Running %s %s %s-only tests...\n", gTestMipmaps?"mipmapped":"",convert_image_type_to_string(imageType), flags == CL_MEM_READ_ONLY ? "read" : "write" );
|
||||
|
||||
@@ -151,7 +149,7 @@ int test_image_type( cl_device_id device, cl_mem_object_type imageType, cl_mem_f
|
||||
}
|
||||
}
|
||||
|
||||
if( get_format_list( device, imageType, formatList, numFormats, flags ) )
|
||||
if( get_format_list( context, imageType, formatList, numFormats, flags ) )
|
||||
return -1;
|
||||
|
||||
filterFlags = new bool[ numFormats ];
|
||||
@@ -180,19 +178,19 @@ int test_image_type( cl_device_id device, cl_mem_object_type imageType, cl_mem_f
|
||||
|
||||
switch (imageType) {
|
||||
case CL_MEM_OBJECT_IMAGE1D:
|
||||
test_return = test_read_image_set_1D( device, &formatList[ i ] );
|
||||
test_return = test_read_image_set_1D( device, context, queue, &formatList[ i ] );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE2D:
|
||||
test_return = test_read_image_set_2D( device, &formatList[ i ] );
|
||||
test_return = test_read_image_set_2D( device, context, queue, &formatList[ i ] );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE3D:
|
||||
test_return = test_read_image_set_3D( device, &formatList[ i ] );
|
||||
test_return = test_read_image_set_3D( device,context, queue, &formatList[ i ] );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
test_return = test_read_image_set_1D_array( device, &formatList[ i ] );
|
||||
test_return = test_read_image_set_1D_array( device, context, queue, &formatList[ i ] );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||
test_return = test_read_image_set_2D_array( device, &formatList[ i ] );
|
||||
test_return = test_read_image_set_2D_array( device, context, queue, &formatList[ i ] );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -212,12 +210,12 @@ int test_image_type( cl_device_id device, cl_mem_object_type imageType, cl_mem_f
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test_image_set( cl_device_id device, cl_mem_object_type imageType )
|
||||
int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, cl_mem_object_type imageType )
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret += test_image_type( device, imageType, CL_MEM_READ_ONLY );
|
||||
ret += test_image_type( device, imageType, CL_MEM_WRITE_ONLY );
|
||||
ret += test_image_type( device, context, queue, imageType, CL_MEM_READ_ONLY );
|
||||
ret += test_image_type( device, context, queue, imageType, CL_MEM_WRITE_ONLY );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user