mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-22 15:19:02 +00:00
cl22: Reuse test harness code in clGetInfo (#205)
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
5233855ca8
commit
5f261cb57e
@@ -20,17 +20,15 @@ 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 int test_get_image_info_1D( cl_device_id device, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_2D( cl_device_id device, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_3D( cl_device_id device, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_1D_array( cl_device_id device, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_2D_array( cl_device_id device, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_1D( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_2D( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_3D( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags );
|
||||
extern int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags );
|
||||
|
||||
static const char *str_1d_image = "1D";
|
||||
static const char *str_2d_image = "2D";
|
||||
@@ -112,7 +110,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 image_type, cl_image_format * &outFormatList,
|
||||
int get_format_list( cl_context context, cl_mem_object_type image_type, 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 image_type, cl_imag
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_image_type( cl_device_id device, cl_mem_object_type image_type, cl_mem_flags flags )
|
||||
int test_image_type( cl_device_id device, cl_context context, cl_mem_object_type image_type, cl_mem_flags flags )
|
||||
{
|
||||
log_info( "Running %s %s-only tests...\n", convert_image_type_to_string(image_type), flags == CL_MEM_READ_ONLY ? "read" : "write" );
|
||||
|
||||
@@ -140,7 +138,7 @@ int test_image_type( cl_device_id device, cl_mem_object_type image_type, cl_mem_
|
||||
bool *filterFlags;
|
||||
unsigned int numFormats;
|
||||
|
||||
if ( get_format_list( device, image_type, formatList, numFormats, flags ) )
|
||||
if ( get_format_list( context, image_type, formatList, numFormats, flags ) )
|
||||
return -1;
|
||||
|
||||
BufferOwningPtr<cl_image_format> formatListBuf(formatList);
|
||||
@@ -184,19 +182,19 @@ int test_image_type( cl_device_id device, cl_mem_object_type image_type, cl_mem_
|
||||
|
||||
switch (image_type) {
|
||||
case CL_MEM_OBJECT_IMAGE1D:
|
||||
test_return = test_get_image_info_1D( device, &formatList[ i ], flags );
|
||||
test_return = test_get_image_info_1D( device, context, &formatList[ i ], flags );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE2D:
|
||||
test_return = test_get_image_info_2D( device, &formatList[ i ], flags );
|
||||
test_return = test_get_image_info_2D( device, context,&formatList[ i ], flags );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE3D:
|
||||
test_return = test_get_image_info_3D( device, &formatList[ i ], flags );
|
||||
test_return = test_get_image_info_3D( device, context, &formatList[ i ], flags );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
test_return = test_get_image_info_1D_array( device, &formatList[ i ], flags );
|
||||
test_return = test_get_image_info_1D_array( device, context, &formatList[ i ], flags );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||
test_return = test_get_image_info_2D_array( device, &formatList[ i ], flags );
|
||||
test_return = test_get_image_info_2D_array( device, context, &formatList[ i ], flags );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -213,12 +211,12 @@ int test_image_type( cl_device_id device, cl_mem_object_type image_type, cl_mem_
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test_image_set( cl_device_id device, cl_mem_object_type image_type )
|
||||
int test_image_set( cl_device_id device, cl_context context, cl_mem_object_type image_type )
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret += test_image_type( device, image_type, CL_MEM_READ_ONLY );
|
||||
ret += test_image_type( device, image_type, CL_MEM_WRITE_ONLY );
|
||||
ret += test_image_type( device, context, image_type, CL_MEM_READ_ONLY );
|
||||
ret += test_image_type( device, context, image_type, CL_MEM_WRITE_ONLY );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user