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

@@ -22,11 +22,9 @@ extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePi
extern cl_filter_mode gFilterModeToUse;
extern cl_addressing_mode gAddressModeToUse;
extern uint64_t gRoundingStartValue;
extern cl_command_queue queue;
extern cl_context context;
int test_read_image_2D( cl_device_id device, image_descriptor *imageInfo, MTdata d )
int test_read_image_2D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
{
int error;
@@ -178,7 +176,7 @@ int test_read_image_2D( cl_device_id device, image_descriptor *imageInfo, MTdata
return 0;
}
int test_read_image_set_2D( cl_device_id device, cl_image_format *format )
int test_read_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
{
size_t maxWidth, maxHeight;
cl_ulong maxAllocSize, memSize;
@@ -214,7 +212,7 @@ int test_read_image_set_2D( cl_device_id device, cl_image_format *format )
if( gDebugTrace )
log_info( " at size %d,%d\n", (int)imageInfo.width, (int)imageInfo.height );
int ret = test_read_image_2D( device, &imageInfo, seed );
int ret = test_read_image_2D( context, queue, &imageInfo, seed );
if( ret )
return -1;
}
@@ -240,7 +238,7 @@ int test_read_image_set_2D( cl_device_id device, cl_image_format *format )
log_info("Testing %d x %d\n", (int)imageInfo.width, (int)imageInfo.height);
if( gDebugTrace )
log_info( " at max size %d,%d\n", (int)maxWidth, (int)maxHeight );
if( test_read_image_2D( device, &imageInfo, seed ) )
if( test_read_image_2D( context, queue, &imageInfo, seed ) )
return -1;
}
}
@@ -276,7 +274,7 @@ int test_read_image_set_2D( 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.height, (int)imageInfo.rowPitch, (int)maxWidth, (int)maxHeight );
int ret = test_read_image_2D( device, &imageInfo, seed );
int ret = test_read_image_2D( context, queue, &imageInfo, seed );
if( ret )
return -1;
}