cl22: Reuse test harness code in clCopyImage (#199)

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:
Radek Szymanski
2019-04-25 02:44:57 +01:00
committed by Kévin Petit
parent f42a688ac2
commit cd0af9ca25
11 changed files with 133 additions and 228 deletions

View File

@@ -21,14 +21,12 @@
extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestRounding, gTestMipmaps;
extern cl_filter_mode gFilterModeToUse;
extern cl_addressing_mode gAddressModeToUse;
extern cl_command_queue queue;
extern cl_context context;
// Defined in test_copy_generic.cpp
extern int test_copy_image_generic( cl_device_id device, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
int test_copy_image_2D_array( cl_device_id device, image_descriptor *imageInfo, MTdata d )
int test_copy_image_2D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
{
size_t srcPos[] = { 0, 0, 0, 0}, dstPos[] = {0, 0, 0, 0};
size_t region[] = { imageInfo->width, imageInfo->height, imageInfo->arraySize };
@@ -56,10 +54,10 @@ int test_copy_image_2D_array( cl_device_id device, image_descriptor *imageInfo,
srcPos[ 3 ] = src_lod;
dstPos[ 3 ] = dst_lod;
}
return test_copy_image_generic( device, imageInfo, imageInfo, srcPos, dstPos, region, d );
return test_copy_image_generic( context, queue, imageInfo, imageInfo, srcPos, dstPos, region, d );
}
int test_copy_image_set_2D_array( cl_device_id device, cl_image_format *format )
int test_copy_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
{
size_t maxWidth, maxHeight, maxArraySize;
cl_ulong maxAllocSize, memSize;
@@ -110,7 +108,7 @@ int test_copy_image_set_2D_array( cl_device_id device, cl_image_format *format )
{
if( gDebugTrace )
log_info( " at size %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.arraySize );
int ret = test_copy_image_2D_array( device, &imageInfo, seed );
int ret = test_copy_image_2D_array( context, queue, &imageInfo, seed );
if( ret )
return -1;
}
@@ -149,7 +147,7 @@ int test_copy_image_set_2D_array( cl_device_id device, cl_image_format *format )
log_info( "Testing %d x %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
if( gDebugTrace )
log_info( " at max size %d,%d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
if( test_copy_image_2D_array( device, &imageInfo, seed ) )
if( test_copy_image_2D_array( context, queue, &imageInfo, seed ) )
return -1;
}
}
@@ -195,7 +193,7 @@ int test_copy_image_set_2D_array( cl_device_id device, cl_image_format *format )
if( gDebugTrace )
log_info( " at size %d,%d,%d (pitch %d,%d) out of %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.arraySize, (int)imageInfo.rowPitch, (int)imageInfo.slicePitch, (int)maxWidth, (int)maxHeight, (int)maxArraySize );
int ret = test_copy_image_2D_array( device, &imageInfo,seed );
int ret = test_copy_image_2D_array( context, queue, &imageInfo,seed );
if( ret )
return -1;
}