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_1D_array( cl_device_id device, image_descriptor *imageInfo, MTdata d )
int test_read_image_1D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
{
int error;
@@ -175,7 +173,7 @@ int test_read_image_1D_array( cl_device_id device, image_descriptor *imageInfo,
return 0;
}
int test_read_image_set_1D_array( cl_device_id device, cl_image_format *format )
int test_read_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
{
size_t maxWidth, maxArraySize;
cl_ulong maxAllocSize, memSize;
@@ -212,7 +210,7 @@ int test_read_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_read_image_1D_array( device, &imageInfo, seed );
int ret = test_read_image_1D_array( context, queue, &imageInfo, seed );
if( ret )
return -1;
}
@@ -239,7 +237,7 @@ int test_read_image_set_1D_array( cl_device_id device, cl_image_format *format )
log_info("Testing %d x %d\n", (int)imageInfo.width, (int)imageInfo.arraySize);
if( gDebugTrace )
log_info( " at max size %d,%d\n", (int)maxWidth, (int)maxArraySize );
if( test_read_image_1D_array( device, &imageInfo, seed ) )
if( test_read_image_1D_array( context, queue, &imageInfo, seed ) )
return -1;
}
}
@@ -277,7 +275,7 @@ int test_read_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_read_image_1D_array( device, &imageInfo, seed );
int ret = test_read_image_1D_array( context, queue, &imageInfo, seed );
if( ret )
return -1;
}