cl21: Reuse test harness code in clReadWriteImage (#207)

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:16:24 +01:00
committed by Kévin Petit
parent 7185e9bb06
commit b1db97e403
7 changed files with 61 additions and 172 deletions

View File

@@ -21,10 +21,8 @@
extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps;
extern cl_filter_mode gFilterModeToUse;
extern cl_addressing_mode gAddressModeToUse;
extern cl_command_queue queue;
extern cl_context context;
int test_read_image_2D_array( cl_device_id device, image_descriptor *imageInfo, MTdata d )
int test_read_image_2D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
{
int error;
@@ -151,7 +149,7 @@ int test_read_image_2D_array( cl_device_id device, image_descriptor *imageInfo,
return 0;
}
int test_read_image_set_2D_array( cl_device_id device, cl_image_format *format )
int test_read_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;
@@ -190,7 +188,7 @@ int test_read_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_read_image_2D_array( device, &imageInfo, seed );
int ret = test_read_image_2D_array( context, queue, &imageInfo, seed );
if( ret )
return -1;
}
@@ -218,7 +216,7 @@ int test_read_image_set_2D_array( cl_device_id device, cl_image_format *format )
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, 0), seed);
log_info("Testing %d x %d x %d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.arraySize);
if( test_read_image_2D_array( device, &imageInfo, seed ) )
if( test_read_image_2D_array( context, queue, &imageInfo, seed ) )
return -1;
}
}
@@ -262,7 +260,7 @@ int test_read_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_read_image_2D_array( device, &imageInfo, seed );
int ret = test_read_image_2D_array( context, queue, &imageInfo, seed );
if( ret )
return -1;
}