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:
Radek Szymanski
2019-04-25 02:15:12 +01:00
committed by Kévin Petit
parent 5f261cb57e
commit f42a688ac2
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_3D( cl_device_id device, image_descriptor *imageInfo, MTdata d )
int test_read_image_3D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
{
int error;
@@ -156,7 +154,7 @@ int test_read_image_3D( cl_device_id device, image_descriptor *imageInfo, MTdata
return 0;
}
int test_read_image_set_3D( cl_device_id device, cl_image_format *format )
int test_read_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
{
size_t maxWidth, maxHeight, maxDepth;
cl_ulong maxAllocSize, memSize;
@@ -195,7 +193,7 @@ int test_read_image_set_3D( 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.depth );
int ret = test_read_image_3D( device, &imageInfo, seed );
int ret = test_read_image_3D( context, queue, &imageInfo, seed );
if( ret )
return -1;
}
@@ -223,7 +221,7 @@ int test_read_image_set_3D( 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, imageInfo.depth), seed);
log_info("Testing %d x %d x %d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.depth);
if( test_read_image_3D( device, &imageInfo, seed ) )
if( test_read_image_3D( context, queue, &imageInfo, seed ) )
return -1;
}
}
@@ -266,7 +264,7 @@ int test_read_image_set_3D( 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.depth, (int)imageInfo.rowPitch, (int)imageInfo.slicePitch, (int)maxWidth, (int)maxHeight, (int)maxDepth );
int ret = test_read_image_3D( device, &imageInfo, seed );
int ret = test_read_image_3D( context, queue, &imageInfo, seed );
if( ret )
return -1;
}