mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 22:19:02 +00:00
cl20: Reuse test harness code in clFillImage (#200)
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:
committed by
Kévin Petit
parent
1a59260373
commit
a12de660ee
@@ -21,15 +21,13 @@
|
||||
extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestRounding;
|
||||
extern cl_filter_mode gFilterModeToUse;
|
||||
extern cl_addressing_mode gAddressModeToUse;
|
||||
extern cl_command_queue queue;
|
||||
extern cl_context context;
|
||||
|
||||
// Defined in test_fill_2D_3D.cpp
|
||||
extern int test_fill_image_generic( cl_device_id device, image_descriptor *imageInfo,
|
||||
extern int test_fill_image_generic( cl_context context, cl_command_queue queue, image_descriptor *imageInfo,
|
||||
const size_t origin[], const size_t region[], ExplicitType outputType, MTdata d );
|
||||
|
||||
|
||||
static int test_fill_image_2D_array( cl_device_id device, image_descriptor *imageInfo, ExplicitType outputType, MTdata d )
|
||||
static int test_fill_image_2D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, ExplicitType outputType, MTdata d )
|
||||
{
|
||||
size_t origin[ 3 ], region[ 3 ];
|
||||
int ret = 0, retCode;
|
||||
@@ -40,7 +38,7 @@ static int test_fill_image_2D_array( cl_device_id device, image_descriptor *imag
|
||||
region[ 1 ] = imageInfo->height;
|
||||
region[ 2 ] = imageInfo->arraySize;
|
||||
|
||||
retCode = test_fill_image_generic( device, imageInfo, origin, region, outputType, d );
|
||||
retCode = test_fill_image_generic( context, queue, imageInfo, origin, region, outputType, d );
|
||||
if ( retCode < 0 )
|
||||
return retCode;
|
||||
else
|
||||
@@ -60,7 +58,7 @@ static int test_fill_image_2D_array( cl_device_id device, image_descriptor *imag
|
||||
origin[ 2 ] = ( imageInfo->arraySize > region[ 2 ] ) ? (size_t)random_in_range( 0, (int)( imageInfo->arraySize - region[ 2 ] - 1 ), d ) : 0;
|
||||
|
||||
// Go for it!
|
||||
retCode = test_fill_image_generic( device, imageInfo, origin, region, outputType, d );
|
||||
retCode = test_fill_image_generic( context, queue, imageInfo, origin, region, outputType, d );
|
||||
if ( retCode < 0 )
|
||||
return retCode;
|
||||
else
|
||||
@@ -71,7 +69,7 @@ static int test_fill_image_2D_array( cl_device_id device, image_descriptor *imag
|
||||
}
|
||||
|
||||
|
||||
int test_fill_image_set_2D_array( cl_device_id device, cl_image_format *format, ExplicitType outputType )
|
||||
int test_fill_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
||||
{
|
||||
size_t maxWidth, maxHeight, maxArraySize;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
@@ -120,7 +118,7 @@ int test_fill_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_fill_image_2D_array( device, &imageInfo, outputType, seed );
|
||||
int ret = test_fill_image_2D_array( context, queue, &imageInfo, outputType, seed );
|
||||
if ( ret )
|
||||
return -1;
|
||||
}
|
||||
@@ -173,7 +171,7 @@ int test_fill_image_set_2D_array( cl_device_id device, cl_image_format *format,
|
||||
|
||||
log_info( "Testing %d x %d x %d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.arraySize);
|
||||
|
||||
if ( test_fill_image_2D_array( device, &imageInfo, outputType, seed ) )
|
||||
if ( test_fill_image_2D_array( context, queue, &imageInfo, outputType, seed ) )
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -208,7 +206,7 @@ int test_fill_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_fill_image_2D_array( device, &imageInfo, outputType, seed );
|
||||
int ret = test_fill_image_2D_array( context, queue, &imageInfo, outputType, seed );
|
||||
if ( ret )
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user