mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 14:09:03 +00:00
cl20: Reuse test harness code in clFillImage (#200)
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
1a59260373
commit
a12de660ee
@@ -22,15 +22,13 @@ extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnabl
|
||||
extern cl_filter_mode gFilterModeToUse;
|
||||
extern cl_addressing_mode gAddressModeToUse;
|
||||
extern uint64_t gRoundingStartValue;
|
||||
extern cl_command_queue queue;
|
||||
extern cl_context context;
|
||||
|
||||
// Defined in test_fill_2D_3D.cpp
|
||||
extern int test_fill_image_generic( cl_device_id device, image_descriptor *imageInfo,
|
||||
extern int test_fill_image_generic( cl_context context, cl_command_queue queue, image_descriptor *imageInfo,
|
||||
const size_t origin[], const size_t region[], ExplicitType outputType, MTdata d );
|
||||
|
||||
|
||||
int test_fill_image_size_1D_array( cl_device_id device, image_descriptor *imageInfo, ExplicitType outputType, MTdata d )
|
||||
int test_fill_image_size_1D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, ExplicitType outputType, MTdata d )
|
||||
{
|
||||
size_t origin[ 3 ], region[ 3 ];
|
||||
int ret = 0, retCode;
|
||||
@@ -41,7 +39,7 @@ int test_fill_image_size_1D_array( cl_device_id device, image_descriptor *imageI
|
||||
region[ 1 ] = imageInfo->arraySize;
|
||||
region[ 2 ] = 1;
|
||||
|
||||
retCode = test_fill_image_generic( device, imageInfo, origin, region, outputType, d );
|
||||
retCode = test_fill_image_generic( context, queue, imageInfo, origin, region, outputType, d );
|
||||
if ( retCode < 0 )
|
||||
return retCode;
|
||||
else
|
||||
@@ -59,7 +57,7 @@ int test_fill_image_size_1D_array( cl_device_id device, image_descriptor *imageI
|
||||
origin[ 1 ] = ( imageInfo->arraySize > region[ 1 ] ) ? (size_t)random_in_range( 0, (int)( imageInfo->arraySize - region[ 1 ] - 1 ), d ) : 0;
|
||||
|
||||
// Go for it!
|
||||
retCode = test_fill_image_generic( device, imageInfo, origin, region, outputType, d );
|
||||
retCode = test_fill_image_generic( context, queue, imageInfo, origin, region, outputType, d );
|
||||
if ( retCode < 0 )
|
||||
return retCode;
|
||||
else
|
||||
@@ -70,7 +68,7 @@ int test_fill_image_size_1D_array( cl_device_id device, image_descriptor *imageI
|
||||
}
|
||||
|
||||
|
||||
int test_fill_image_set_1D_array( cl_device_id device, cl_image_format *format, ExplicitType outputType )
|
||||
int test_fill_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
||||
{
|
||||
size_t maxWidth, maxArraySize;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
@@ -116,7 +114,7 @@ int test_fill_image_set_1D_array( cl_device_id device, cl_image_format *format,
|
||||
if ( gDebugTrace )
|
||||
log_info( " at size %d,%d\n", (int)imageInfo.width, (int)imageInfo.arraySize );
|
||||
|
||||
int ret = test_fill_image_size_1D_array( device, &imageInfo, outputType, seed );
|
||||
int ret = test_fill_image_size_1D_array( context, queue, &imageInfo, outputType, seed );
|
||||
if ( ret )
|
||||
return -1;
|
||||
}
|
||||
@@ -149,7 +147,7 @@ int test_fill_image_set_1D_array( cl_device_id device, cl_image_format *format,
|
||||
log_info( "Testing %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 2 ] );
|
||||
if ( gDebugTrace )
|
||||
log_info( " at max size %d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 2 ] );
|
||||
if ( test_fill_image_size_1D_array( device, &imageInfo, outputType, seed ) )
|
||||
if ( test_fill_image_size_1D_array( context, queue, &imageInfo, outputType, seed ) )
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -183,7 +181,7 @@ int test_fill_image_set_1D_array( cl_device_id device, cl_image_format *format,
|
||||
|
||||
if ( gDebugTrace )
|
||||
log_info( " at size %d,%d (row pitch %d) out of %d,%d\n", (int)imageInfo.width, (int)imageInfo.arraySize, (int)imageInfo.rowPitch, (int)maxWidth, (int)maxArraySize );
|
||||
int ret = test_fill_image_size_1D_array( device, &imageInfo, outputType, seed );
|
||||
int ret = test_fill_image_size_1D_array( context, queue, &imageInfo, outputType, seed );
|
||||
if ( ret )
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user