mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Refactor clCopyImage and clFillImage tests (#2283)
This change mainly extends `clFillImage` and `clCopyImage` test function to include memory flags to be used during creating the image instead of hard-coding these values. The memory flags are also different parameters for source and destination images in `clCopyImage` tests. --------- Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
This commit is contained in:
@@ -126,6 +126,7 @@ typedef struct
|
|||||||
const cl_image_format *format;
|
const cl_image_format *format;
|
||||||
cl_mem buffer;
|
cl_mem buffer;
|
||||||
cl_mem_object_type type;
|
cl_mem_object_type type;
|
||||||
|
cl_mem_flags mem_flags;
|
||||||
cl_uint num_mip_levels;
|
cl_uint num_mip_levels;
|
||||||
} image_descriptor;
|
} image_descriptor;
|
||||||
|
|
||||||
|
|||||||
@@ -18,32 +18,41 @@
|
|||||||
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
||||||
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
||||||
|
|
||||||
int test_copy_image_size_1D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
|
int test_copy_image_size_1D(cl_context context, cl_command_queue queue,
|
||||||
|
image_descriptor *srcImageInfo,
|
||||||
|
image_descriptor *dstImageInfo, MTdata d)
|
||||||
{
|
{
|
||||||
size_t sourcePos[ 3 ], destPos[ 3 ], regionSize[ 3 ];
|
size_t sourcePos[ 3 ], destPos[ 3 ], regionSize[ 3 ];
|
||||||
int ret = 0, retCode;
|
int ret = 0, retCode;
|
||||||
size_t src_lod = 0, src_width_lod = imageInfo->width, src_row_pitch_lod;
|
size_t src_lod = 0, src_width_lod = srcImageInfo->width, src_row_pitch_lod;
|
||||||
size_t dst_lod = 0, dst_width_lod = imageInfo->width, dst_row_pitch_lod;
|
size_t dst_lod = 0, dst_width_lod = srcImageInfo->width, dst_row_pitch_lod;
|
||||||
size_t width_lod = imageInfo->width;
|
size_t width_lod = srcImageInfo->width;
|
||||||
size_t max_mip_level = 0;
|
size_t max_mip_level = 0;
|
||||||
|
|
||||||
if( gTestMipmaps )
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
max_mip_level = imageInfo->num_mip_levels;
|
max_mip_level = srcImageInfo->num_mip_levels;
|
||||||
// Work at a random mip level
|
// Work at a random mip level
|
||||||
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
src_lod =
|
||||||
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
(size_t)random_in_range(0, max_mip_level ? max_mip_level - 1 : 0, d);
|
||||||
src_width_lod = ( imageInfo->width >> src_lod )? ( imageInfo->width >> src_lod ) : 1;
|
dst_lod =
|
||||||
dst_width_lod = ( imageInfo->width >> dst_lod )? ( imageInfo->width >> dst_lod ) : 1;
|
(size_t)random_in_range(0, max_mip_level ? max_mip_level - 1 : 0, d);
|
||||||
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
src_width_lod = (srcImageInfo->width >> src_lod)
|
||||||
src_row_pitch_lod = src_width_lod * get_pixel_size( imageInfo->format );
|
? (srcImageInfo->width >> src_lod)
|
||||||
dst_row_pitch_lod = dst_width_lod * get_pixel_size( imageInfo->format );
|
: 1;
|
||||||
}
|
dst_width_lod = (dstImageInfo->width >> dst_lod)
|
||||||
|
? (dstImageInfo->width >> dst_lod)
|
||||||
|
: 1;
|
||||||
|
width_lod =
|
||||||
|
(src_width_lod > dst_width_lod) ? dst_width_lod : src_width_lod;
|
||||||
|
src_row_pitch_lod = src_width_lod * get_pixel_size(srcImageInfo->format);
|
||||||
|
dst_row_pitch_lod = dst_width_lod * get_pixel_size(dstImageInfo->format);
|
||||||
|
}
|
||||||
|
|
||||||
// First, try just a full covering region
|
// First, try just a full covering region
|
||||||
sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = 0;
|
sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = 0;
|
||||||
destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = 0;
|
destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = 0;
|
||||||
regionSize[ 0 ] = imageInfo->width;
|
regionSize[0] = dstImageInfo->width;
|
||||||
regionSize[ 1 ] = 1;
|
regionSize[ 1 ] = 1;
|
||||||
regionSize[ 2 ] = 1;
|
regionSize[ 2 ] = 1;
|
||||||
|
|
||||||
@@ -54,7 +63,9 @@ int test_copy_image_size_1D( cl_context context, cl_command_queue queue, image_d
|
|||||||
regionSize[ 0 ] = width_lod;
|
regionSize[ 0 ] = width_lod;
|
||||||
}
|
}
|
||||||
|
|
||||||
retCode = test_copy_image_generic( context, queue, imageInfo, imageInfo, sourcePos, destPos, regionSize, d );
|
retCode =
|
||||||
|
test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
sourcePos, destPos, regionSize, d);
|
||||||
if( retCode < 0 )
|
if( retCode < 0 )
|
||||||
return retCode;
|
return retCode;
|
||||||
else
|
else
|
||||||
@@ -68,8 +79,12 @@ int test_copy_image_size_1D( cl_context context, cl_command_queue queue, image_d
|
|||||||
// Work at a random mip level
|
// Work at a random mip level
|
||||||
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
src_width_lod = ( imageInfo->width >> src_lod )? ( imageInfo->width >> src_lod ) : 1;
|
src_width_lod = (srcImageInfo->width >> src_lod)
|
||||||
dst_width_lod = ( imageInfo->width >> dst_lod )? ( imageInfo->width >> dst_lod ) : 1;
|
? (srcImageInfo->width >> src_lod)
|
||||||
|
: 1;
|
||||||
|
dst_width_lod = (dstImageInfo->width >> dst_lod)
|
||||||
|
? (dstImageInfo->width >> dst_lod)
|
||||||
|
: 1;
|
||||||
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
||||||
sourcePos[ 1 ] = src_lod;
|
sourcePos[ 1 ] = src_lod;
|
||||||
destPos[ 1 ] = dst_lod;
|
destPos[ 1 ] = dst_lod;
|
||||||
@@ -83,7 +98,9 @@ int test_copy_image_size_1D( cl_context context, cl_command_queue queue, image_d
|
|||||||
|
|
||||||
|
|
||||||
// Go for it!
|
// Go for it!
|
||||||
retCode = test_copy_image_generic( context, queue, imageInfo, imageInfo, sourcePos, destPos, regionSize, d );
|
retCode =
|
||||||
|
test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
sourcePos, destPos, regionSize, d);
|
||||||
if( retCode < 0 )
|
if( retCode < 0 )
|
||||||
return retCode;
|
return retCode;
|
||||||
else
|
else
|
||||||
@@ -93,18 +110,25 @@ int test_copy_image_size_1D( cl_context context, cl_command_queue queue, image_d
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_copy_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
|
int test_copy_image_set_1D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
|
cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format)
|
||||||
{
|
{
|
||||||
|
assert(dst_type == src_type); // This test expects to copy 1D -> 1D images
|
||||||
size_t maxWidth;
|
size_t maxWidth;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor imageInfo = { 0 };
|
image_descriptor srcImageInfo = { 0 };
|
||||||
|
image_descriptor dstImageInfo = { 0 };
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
size_t pixelSize;
|
size_t pixelSize;
|
||||||
|
|
||||||
imageInfo.format = format;
|
srcImageInfo.format = format;
|
||||||
imageInfo.height = imageInfo.depth = imageInfo.arraySize = imageInfo.slicePitch = 0;
|
srcImageInfo.height = srcImageInfo.depth = srcImageInfo.arraySize =
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
srcImageInfo.slicePitch = 0;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
srcImageInfo.type = src_type;
|
||||||
|
srcImageInfo.mem_flags = src_flags;
|
||||||
|
pixelSize = get_pixel_size(srcImageInfo.format);
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( maxAllocSize ), &maxAllocSize, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( maxAllocSize ), &maxAllocSize, NULL );
|
||||||
@@ -118,28 +142,33 @@ int test_copy_image_set_1D( cl_device_id device, cl_context context, cl_command_
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++ )
|
for (srcImageInfo.width = 1; srcImageInfo.width < 13;
|
||||||
|
srcImageInfo.width++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, 0, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2, (int)compute_max_mip_levels(srcImageInfo.width, 0, 0), seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
if( gDebugTrace )
|
if (gDebugTrace) log_info(" at size %d\n", (int)srcImageInfo.width);
|
||||||
log_info( " at size %d\n", (int)imageInfo.width );
|
|
||||||
|
|
||||||
int ret = test_copy_image_size_1D( context, queue, &imageInfo, seed );
|
dstImageInfo = srcImageInfo;
|
||||||
if( ret )
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
return -1;
|
int ret = test_copy_image_size_1D(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed);
|
||||||
|
if (ret) return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( gTestMaxImages )
|
else if( gTestMaxImages )
|
||||||
@@ -148,29 +177,37 @@ int test_copy_image_set_1D( cl_device_id device, cl_context context, cl_command_
|
|||||||
size_t numbeOfSizes;
|
size_t numbeOfSizes;
|
||||||
size_t sizes[100][3];
|
size_t sizes[100][3];
|
||||||
|
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, 1, maxAllocSize, memSize, CL_MEM_OBJECT_IMAGE1D, imageInfo.format);
|
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, 1,
|
||||||
|
maxAllocSize, memSize, src_type, srcImageInfo.format);
|
||||||
|
|
||||||
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
imageInfo.width = sizes[ idx ][ 0 ];
|
srcImageInfo.width = sizes[idx][0];
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, 0, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2, (int)compute_max_mip_levels(srcImageInfo.width, 0, 0), seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
log_info( "Testing %d\n", (int)sizes[ idx ][ 0 ] );
|
log_info( "Testing %d\n", (int)sizes[ idx ][ 0 ] );
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at max size %d\n", (int)sizes[ idx ][ 0 ] );
|
log_info( " at max size %d\n", (int)sizes[ idx ][ 0 ] );
|
||||||
if( test_copy_image_size_1D( context, queue, &imageInfo, seed ) )
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
if (test_copy_image_size_1D(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,41 +221,52 @@ int test_copy_image_set_1D( cl_device_id device, cl_context context, cl_command_
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
imageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
srcImageInfo.width =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, 0, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
imageInfo.rowPitch = imageInfo.width * get_pixel_size( imageInfo.format );
|
2,
|
||||||
size = compute_mipmapped_image_size( imageInfo );
|
(int)compute_max_mip_levels(srcImageInfo.width, 0, 0),
|
||||||
size = size*4;
|
seed);
|
||||||
}
|
srcImageInfo.rowPitch = srcImageInfo.width
|
||||||
|
* get_pixel_size(srcImageInfo.format);
|
||||||
|
size = compute_mipmapped_image_size(srcImageInfo);
|
||||||
|
size = size * 4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
size = (size_t)imageInfo.rowPitch * 4;
|
size = (size_t)srcImageInfo.rowPitch * 4;
|
||||||
}
|
}
|
||||||
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
{
|
{
|
||||||
log_info( " at size %d (row pitch %d) out of %d\n", (int)imageInfo.width, (int)imageInfo.rowPitch, (int)maxWidth );
|
log_info(" at size %d (row pitch %d) out of %d\n",
|
||||||
if ( gTestMipmaps )
|
(int)srcImageInfo.width, (int)srcImageInfo.rowPitch,
|
||||||
log_info(" and %u mip levels\n", imageInfo.num_mip_levels);
|
(int)maxWidth);
|
||||||
|
if (gTestMipmaps)
|
||||||
|
log_info(" and %zu mip levels\n",
|
||||||
|
(size_t)srcImageInfo.num_mip_levels);
|
||||||
}
|
}
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
int ret = test_copy_image_size_1D( context, queue, &imageInfo, seed );
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
if( ret )
|
int ret = test_copy_image_size_1D(context, queue, &srcImageInfo,
|
||||||
return -1;
|
&dstImageInfo, seed);
|
||||||
|
if (ret) return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,33 +18,41 @@
|
|||||||
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
||||||
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
||||||
|
|
||||||
int test_copy_image_size_1D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
|
int test_copy_image_size_1D_array(cl_context context, cl_command_queue queue,
|
||||||
|
image_descriptor *srcImageInfo,
|
||||||
|
image_descriptor *dstImageInfo, MTdata d)
|
||||||
{
|
{
|
||||||
size_t sourcePos[ 3 ], destPos[ 3 ], regionSize[ 3 ];
|
size_t sourcePos[ 3 ], destPos[ 3 ], regionSize[ 3 ];
|
||||||
int ret = 0, retCode;
|
int ret = 0, retCode;
|
||||||
size_t src_lod = 0, src_width_lod = imageInfo->width, src_row_pitch_lod;
|
size_t src_lod = 0, src_width_lod = srcImageInfo->width, src_row_pitch_lod;
|
||||||
size_t dst_lod = 0, dst_width_lod = imageInfo->width, dst_row_pitch_lod;
|
size_t dst_lod = 0, dst_width_lod = dstImageInfo->width, dst_row_pitch_lod;
|
||||||
size_t width_lod = imageInfo->width;
|
size_t width_lod = srcImageInfo->width;
|
||||||
size_t max_mip_level = 0;
|
size_t max_mip_level = 0;
|
||||||
|
|
||||||
if( gTestMipmaps )
|
if( gTestMipmaps )
|
||||||
{
|
{
|
||||||
max_mip_level = imageInfo->num_mip_levels;
|
max_mip_level = srcImageInfo->num_mip_levels;
|
||||||
// Work at a random mip level
|
// Work at a random mip level
|
||||||
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
src_width_lod = ( imageInfo->width >> src_lod )? ( imageInfo->width >> src_lod ) : 1;
|
src_width_lod = (srcImageInfo->width >> src_lod)
|
||||||
dst_width_lod = ( imageInfo->width >> dst_lod )? ( imageInfo->width >> dst_lod ) : 1;
|
? (srcImageInfo->width >> src_lod)
|
||||||
|
: 1;
|
||||||
|
dst_width_lod = (dstImageInfo->width >> dst_lod)
|
||||||
|
? (dstImageInfo->width >> dst_lod)
|
||||||
|
: 1;
|
||||||
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
||||||
src_row_pitch_lod = src_width_lod * get_pixel_size( imageInfo->format );
|
src_row_pitch_lod =
|
||||||
dst_row_pitch_lod = dst_width_lod * get_pixel_size( imageInfo->format );
|
src_width_lod * get_pixel_size(srcImageInfo->format);
|
||||||
|
dst_row_pitch_lod =
|
||||||
|
dst_width_lod * get_pixel_size(dstImageInfo->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, try just a full covering region
|
// First, try just a full covering region
|
||||||
sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = 0;
|
sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = 0;
|
||||||
destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = 0;
|
destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = 0;
|
||||||
regionSize[ 0 ] = imageInfo->width;
|
regionSize[0] = srcImageInfo->width;
|
||||||
regionSize[ 1 ] = imageInfo->arraySize;
|
regionSize[1] = srcImageInfo->arraySize;
|
||||||
regionSize[ 2 ] = 1;
|
regionSize[ 2 ] = 1;
|
||||||
|
|
||||||
if(gTestMipmaps)
|
if(gTestMipmaps)
|
||||||
@@ -54,7 +62,9 @@ int test_copy_image_size_1D_array( cl_context context, cl_command_queue queue, i
|
|||||||
regionSize[ 0 ] = width_lod;
|
regionSize[ 0 ] = width_lod;
|
||||||
}
|
}
|
||||||
|
|
||||||
retCode = test_copy_image_generic( context, queue, imageInfo, imageInfo, sourcePos, destPos, regionSize, d );
|
retCode =
|
||||||
|
test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
sourcePos, destPos, regionSize, d);
|
||||||
if( retCode < 0 )
|
if( retCode < 0 )
|
||||||
return retCode;
|
return retCode;
|
||||||
else
|
else
|
||||||
@@ -68,27 +78,41 @@ int test_copy_image_size_1D_array( cl_context context, cl_command_queue queue, i
|
|||||||
// Work at a random mip level
|
// Work at a random mip level
|
||||||
src_lod = (size_t) ( max_mip_level > 1 )? random_in_range( 0, max_mip_level - 1 , d ) : 0;
|
src_lod = (size_t) ( max_mip_level > 1 )? random_in_range( 0, max_mip_level - 1 , d ) : 0;
|
||||||
dst_lod = (size_t) ( max_mip_level > 1 )? random_in_range( 0, max_mip_level - 1 , d ) : 0;
|
dst_lod = (size_t) ( max_mip_level > 1 )? random_in_range( 0, max_mip_level - 1 , d ) : 0;
|
||||||
src_width_lod = ( imageInfo->width >> src_lod )? ( imageInfo->width >> src_lod ) : 1;
|
src_width_lod = (srcImageInfo->width >> src_lod)
|
||||||
dst_width_lod = ( imageInfo->width >> dst_lod )? ( imageInfo->width >> dst_lod ) : 1;
|
? (srcImageInfo->width >> src_lod)
|
||||||
|
: 1;
|
||||||
|
dst_width_lod = (dstImageInfo->width >> dst_lod)
|
||||||
|
? (dstImageInfo->width >> dst_lod)
|
||||||
|
: 1;
|
||||||
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
||||||
sourcePos[ 2 ] = src_lod;
|
sourcePos[ 2 ] = src_lod;
|
||||||
destPos[ 2 ] = dst_lod;
|
destPos[ 2 ] = dst_lod;
|
||||||
}
|
}
|
||||||
// Pick a random size
|
// Pick a random size
|
||||||
regionSize[ 0 ] = ( width_lod > 8 ) ? (size_t)random_in_range( 8, (int)width_lod - 1, d ) : (int)width_lod;
|
regionSize[ 0 ] = ( width_lod > 8 ) ? (size_t)random_in_range( 8, (int)width_lod - 1, d ) : (int)width_lod;
|
||||||
regionSize[ 1 ] = ( imageInfo->arraySize > 8 ) ? (size_t)random_in_range( 8, (int)imageInfo->arraySize - 1, d ) : imageInfo->arraySize;
|
regionSize[1] = (srcImageInfo->arraySize > 8)
|
||||||
|
? (size_t)random_in_range(8, (int)srcImageInfo->arraySize - 1, d)
|
||||||
|
: srcImageInfo->arraySize;
|
||||||
|
|
||||||
// Now pick positions within valid ranges
|
// Now pick positions within valid ranges
|
||||||
sourcePos[ 0 ] = ( width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
|
sourcePos[ 0 ] = ( width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
|
||||||
sourcePos[ 1 ] = ( imageInfo->arraySize > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( imageInfo->arraySize - regionSize[ 1 ] - 1 ), d ) : 0;
|
sourcePos[1] = (srcImageInfo->arraySize > regionSize[1])
|
||||||
|
? (size_t)random_in_range(
|
||||||
|
0, (int)(srcImageInfo->arraySize - regionSize[1] - 1), d)
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
|
||||||
destPos[ 0 ] = ( width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
|
destPos[ 0 ] = ( width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
|
||||||
destPos[ 1 ] = ( imageInfo->arraySize > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( imageInfo->arraySize - regionSize[ 1 ] - 1 ), d ) : 0;
|
destPos[1] = (dstImageInfo->arraySize > regionSize[1])
|
||||||
|
? (size_t)random_in_range(
|
||||||
|
0, (int)(dstImageInfo->arraySize - regionSize[1] - 1), d)
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
|
||||||
// Go for it!
|
// Go for it!
|
||||||
retCode = test_copy_image_generic( context, queue, imageInfo, imageInfo, sourcePos, destPos, regionSize, d );
|
retCode =
|
||||||
|
test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
sourcePos, destPos, regionSize, d);
|
||||||
if( retCode < 0 )
|
if( retCode < 0 )
|
||||||
return retCode;
|
return retCode;
|
||||||
else
|
else
|
||||||
@@ -98,17 +122,27 @@ int test_copy_image_size_1D_array( cl_context context, cl_command_queue queue, i
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_copy_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
|
int test_copy_image_set_1D_array(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
|
cl_mem_object_type src_type,
|
||||||
|
cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type,
|
||||||
|
cl_image_format *format)
|
||||||
{
|
{
|
||||||
|
assert(
|
||||||
|
dst_type
|
||||||
|
== src_type); // This test expects to copy 1D array -> 1D array images
|
||||||
size_t maxWidth, maxArraySize;
|
size_t maxWidth, maxArraySize;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor imageInfo = { 0 };
|
image_descriptor srcImageInfo = { 0 };
|
||||||
|
image_descriptor dstImageInfo = { 0 };
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
size_t pixelSize;
|
size_t pixelSize;
|
||||||
|
|
||||||
imageInfo.format = format;
|
srcImageInfo.format = format;
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_ARRAY;
|
srcImageInfo.type = src_type;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
srcImageInfo.mem_flags = src_flags;
|
||||||
|
pixelSize = get_pixel_size(srcImageInfo.format);
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, sizeof( maxArraySize ), &maxArraySize, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, sizeof( maxArraySize ), &maxArraySize, NULL );
|
||||||
@@ -123,33 +157,41 @@ int test_copy_image_set_1D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++ )
|
for (srcImageInfo.width = 1; srcImageInfo.width < 13;
|
||||||
|
srcImageInfo.width++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, 0, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2, (int)compute_max_mip_levels(srcImageInfo.width, 0, 0), seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch;
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch;
|
||||||
for( imageInfo.arraySize = 2; imageInfo.arraySize < 9; imageInfo.arraySize++ )
|
for (srcImageInfo.arraySize = 2; srcImageInfo.arraySize < 9;
|
||||||
{
|
srcImageInfo.arraySize++)
|
||||||
if( gDebugTrace )
|
{
|
||||||
log_info( " at size %d,%d\n", (int)imageInfo.width, (int)imageInfo.arraySize );
|
if (gDebugTrace)
|
||||||
|
log_info(" at size %d,%d\n", (int)srcImageInfo.width,
|
||||||
|
(int)srcImageInfo.arraySize);
|
||||||
|
|
||||||
int ret = test_copy_image_size_1D_array( context, queue, &imageInfo, seed );
|
dstImageInfo = srcImageInfo;
|
||||||
if( ret )
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
return -1;
|
int ret = test_copy_image_size_1D_array(context, queue, &srcImageInfo,
|
||||||
}
|
&dstImageInfo, seed);
|
||||||
|
if (ret) return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( gTestMaxImages )
|
else if( gTestMaxImages )
|
||||||
@@ -158,33 +200,42 @@ int test_copy_image_set_1D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
size_t numbeOfSizes;
|
size_t numbeOfSizes;
|
||||||
size_t sizes[100][3];
|
size_t sizes[100][3];
|
||||||
|
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, maxArraySize, maxAllocSize, memSize, CL_MEM_OBJECT_IMAGE1D_ARRAY, imageInfo.format);
|
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, maxArraySize,
|
||||||
|
maxAllocSize, memSize, src_type, srcImageInfo.format);
|
||||||
|
|
||||||
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
|
|
||||||
imageInfo.width = sizes[ idx ][ 0 ];
|
srcImageInfo.width = sizes[idx][0];
|
||||||
imageInfo.arraySize = sizes[ idx ][ 2 ];
|
srcImageInfo.arraySize = sizes[idx][2];
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, 0, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2, (int)compute_max_mip_levels(srcImageInfo.width, 0, 0), seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch;
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch;
|
||||||
log_info( "Testing %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 2 ] );
|
log_info("Testing %d x %d\n", (int)sizes[idx][0], (int)sizes[idx][2]);
|
||||||
if( gDebugTrace )
|
if (gDebugTrace)
|
||||||
log_info( " at max size %d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 2 ] );
|
log_info(" at max size %d,%d\n", (int)sizes[idx][0],
|
||||||
if( test_copy_image_size_1D_array( context, queue, &imageInfo, seed ) )
|
(int)sizes[idx][2]);
|
||||||
return -1;
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
if (test_copy_image_size_1D_array(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -197,39 +248,55 @@ int test_copy_image_set_1D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
imageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
srcImageInfo.width =
|
||||||
imageInfo.arraySize = (size_t)random_log_in_range( 16, (int)maxArraySize / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
imageInfo.height = imageInfo.depth = 0;
|
srcImageInfo.arraySize = (size_t)random_log_in_range(
|
||||||
|
16, (int)maxArraySize / 32, seed);
|
||||||
|
srcImageInfo.height = srcImageInfo.depth = 0;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, 0, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
imageInfo.rowPitch = imageInfo.width * get_pixel_size( imageInfo.format );
|
2,
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch;
|
(int)compute_max_mip_levels(srcImageInfo.width, 0, 0),
|
||||||
size = compute_mipmapped_image_size( imageInfo );
|
seed);
|
||||||
size = size*4;
|
srcImageInfo.rowPitch = srcImageInfo.width
|
||||||
}
|
* get_pixel_size(srcImageInfo.format);
|
||||||
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch;
|
||||||
|
size = compute_mipmapped_image_size(srcImageInfo);
|
||||||
|
size = size * 4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch;
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch;
|
||||||
|
|
||||||
size = (size_t)imageInfo.rowPitch * (size_t)imageInfo.arraySize * 4;
|
size = (size_t)srcImageInfo.rowPitch
|
||||||
|
* (size_t)srcImageInfo.arraySize * 4;
|
||||||
}
|
}
|
||||||
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
||||||
|
|
||||||
if( gDebugTrace )
|
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 );
|
log_info(" at size %d,%d (row pitch %d) out of %d,%d\n",
|
||||||
int ret = test_copy_image_size_1D_array( context, queue, &imageInfo, seed );
|
(int)srcImageInfo.width, (int)srcImageInfo.arraySize,
|
||||||
|
(int)srcImageInfo.rowPitch, (int)maxWidth,
|
||||||
|
(int)maxArraySize);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
int ret = test_copy_image_size_1D_array(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,13 +75,18 @@ int test_copy_image_size_1D_buffer(cl_context context, cl_command_queue queue,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_copy_image_set_1D_buffer(cl_device_id device, cl_context context,
|
int test_copy_image_set_1D_buffer(
|
||||||
cl_command_queue queue,
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
cl_image_format *format)
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format)
|
||||||
{
|
{
|
||||||
|
assert(
|
||||||
|
dst_type
|
||||||
|
== src_type); // This test expects to copy 1D buffer -> 1D buffer images
|
||||||
size_t maxWidth;
|
size_t maxWidth;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor imageInfo = { 0 };
|
image_descriptor srcImageInfo = { 0 };
|
||||||
|
image_descriptor dstImageInfo = { 0 };
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
size_t pixelSize;
|
size_t pixelSize;
|
||||||
|
|
||||||
@@ -92,11 +97,12 @@ int test_copy_image_set_1D_buffer(cl_device_id device, cl_context context,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
imageInfo.format = format;
|
srcImageInfo.format = format;
|
||||||
imageInfo.height = imageInfo.depth = imageInfo.arraySize =
|
srcImageInfo.height = srcImageInfo.depth = srcImageInfo.arraySize =
|
||||||
imageInfo.slicePitch = 0;
|
srcImageInfo.slicePitch = 0;
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
srcImageInfo.type = src_type;
|
||||||
pixelSize = get_pixel_size(imageInfo.format);
|
srcImageInfo.mem_flags = src_flags;
|
||||||
|
pixelSize = get_pixel_size(srcImageInfo.format);
|
||||||
|
|
||||||
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE,
|
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE,
|
||||||
sizeof(maxWidth), &maxWidth, NULL);
|
sizeof(maxWidth), &maxWidth, NULL);
|
||||||
@@ -114,168 +120,29 @@ int test_copy_image_set_1D_buffer(cl_device_id device, cl_context context,
|
|||||||
|
|
||||||
if (gTestSmallImages)
|
if (gTestSmallImages)
|
||||||
{
|
{
|
||||||
for (imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++)
|
for (srcImageInfo.width = 1; srcImageInfo.width < 13;
|
||||||
|
srcImageInfo.width++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rowPadding++;
|
rowPadding++;
|
||||||
imageInfo.rowPitch =
|
srcImageInfo.rowPitch =
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDebugTrace) log_info(" at size %d\n", (int)imageInfo.width);
|
|
||||||
|
|
||||||
int ret = test_copy_image_size_1D_buffer(context, queue, &imageInfo,
|
|
||||||
&imageInfo, seed);
|
|
||||||
if (ret) return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (gTestMaxImages)
|
|
||||||
{
|
|
||||||
// Try a specific set of maximum sizes
|
|
||||||
size_t numbeOfSizes;
|
|
||||||
size_t sizes[100][3];
|
|
||||||
|
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, 1,
|
|
||||||
maxAllocSize, memSize, CL_MEM_OBJECT_IMAGE1D_BUFFER,
|
|
||||||
imageInfo.format);
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < numbeOfSizes; idx++)
|
|
||||||
{
|
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
|
||||||
imageInfo.width = sizes[idx][0];
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
|
||||||
|
|
||||||
if (gEnablePitch)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rowPadding++;
|
|
||||||
imageInfo.rowPitch =
|
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
log_info("Testing %d\n", (int)sizes[idx][0]);
|
|
||||||
if (gDebugTrace)
|
|
||||||
log_info(" at max size %d\n", (int)sizes[idx][0]);
|
|
||||||
if (test_copy_image_size_1D_buffer(context, queue, &imageInfo,
|
|
||||||
&imageInfo, seed))
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < NUM_IMAGE_ITERATIONS; i++)
|
|
||||||
{
|
|
||||||
cl_ulong size;
|
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
|
||||||
// Loop until we get a size that a) will fit in the max alloc size
|
|
||||||
// and b) that an allocation of that image, the result array, plus
|
|
||||||
// offset arrays, will fit in the global ram space
|
|
||||||
do
|
|
||||||
{
|
|
||||||
imageInfo.width =
|
|
||||||
(size_t)random_log_in_range(16, (int)(maxWidth / 32), seed);
|
|
||||||
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
|
||||||
|
|
||||||
if (gEnablePitch)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rowPadding++;
|
|
||||||
imageInfo.rowPitch =
|
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
size = (size_t)imageInfo.rowPitch * 4;
|
|
||||||
} while (size > maxAllocSize || (size * 3) > memSize);
|
|
||||||
|
|
||||||
if (gDebugTrace)
|
if (gDebugTrace)
|
||||||
{
|
log_info(" at size %d\n", (int)srcImageInfo.width);
|
||||||
log_info(" at size %d (row pitch %d) out of %d\n",
|
|
||||||
(int)imageInfo.width, (int)imageInfo.rowPitch,
|
|
||||||
(int)maxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ret = test_copy_image_size_1D_buffer(context, queue, &imageInfo,
|
|
||||||
&imageInfo, seed);
|
|
||||||
if (ret) return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int test_copy_image_set_1D_1D_buffer(cl_device_id device, cl_context context,
|
|
||||||
cl_command_queue queue,
|
|
||||||
cl_image_format *format)
|
|
||||||
{
|
|
||||||
size_t maxWidth;
|
|
||||||
cl_ulong maxAllocSize, memSize;
|
|
||||||
image_descriptor imageInfo = { 0 };
|
|
||||||
RandomSeed seed(gRandomSeed);
|
|
||||||
size_t pixelSize;
|
|
||||||
|
|
||||||
if (gTestMipmaps)
|
|
||||||
{
|
|
||||||
// 1D image buffers don't support mipmaps
|
|
||||||
// https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_mipmap_image
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
imageInfo.format = format;
|
|
||||||
imageInfo.height = imageInfo.depth = imageInfo.arraySize =
|
|
||||||
imageInfo.slicePitch = 0;
|
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
|
||||||
pixelSize = get_pixel_size(imageInfo.format);
|
|
||||||
|
|
||||||
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH,
|
|
||||||
sizeof(maxWidth), &maxWidth, NULL);
|
|
||||||
error |= clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
|
|
||||||
sizeof(maxAllocSize), &maxAllocSize, NULL);
|
|
||||||
error |= clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(memSize),
|
|
||||||
&memSize, NULL);
|
|
||||||
test_error(error, "Unable to get max image 1D buffer size from device");
|
|
||||||
|
|
||||||
if (memSize > (cl_ulong)SIZE_MAX)
|
|
||||||
{
|
|
||||||
memSize = (cl_ulong)SIZE_MAX;
|
|
||||||
maxAllocSize = (cl_ulong)SIZE_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gTestSmallImages)
|
|
||||||
{
|
|
||||||
for (imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++)
|
|
||||||
{
|
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
|
||||||
|
|
||||||
if (gEnablePitch)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rowPadding++;
|
|
||||||
imageInfo.rowPitch =
|
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDebugTrace) log_info(" at size %d\n", (int)imageInfo.width);
|
|
||||||
|
|
||||||
image_descriptor srcImageInfo = imageInfo;
|
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
int ret = test_copy_image_size_1D_buffer(
|
int ret = test_copy_image_size_1D_buffer(
|
||||||
context, queue, &srcImageInfo, &imageInfo, seed);
|
context, queue, &srcImageInfo, &dstImageInfo, seed);
|
||||||
if (ret) return -1;
|
if (ret) return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,183 +153,31 @@ int test_copy_image_set_1D_1D_buffer(cl_device_id device, cl_context context,
|
|||||||
size_t sizes[100][3];
|
size_t sizes[100][3];
|
||||||
|
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, 1,
|
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, 1,
|
||||||
maxAllocSize, memSize, CL_MEM_OBJECT_IMAGE1D_BUFFER,
|
maxAllocSize, memSize, src_type, srcImageInfo.format);
|
||||||
imageInfo.format);
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < numbeOfSizes; idx++)
|
for (size_t idx = 0; idx < numbeOfSizes; idx++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
imageInfo.width = sizes[idx][0];
|
srcImageInfo.width = sizes[idx][0];
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rowPadding++;
|
rowPadding++;
|
||||||
imageInfo.rowPitch =
|
srcImageInfo.rowPitch =
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info("Testing %d\n", (int)sizes[idx][0]);
|
log_info("Testing %d\n", (int)sizes[idx][0]);
|
||||||
if (gDebugTrace)
|
if (gDebugTrace)
|
||||||
log_info(" at max size %d\n", (int)sizes[idx][0]);
|
log_info(" at max size %d\n", (int)sizes[idx][0]);
|
||||||
|
|
||||||
image_descriptor srcImageInfo = imageInfo;
|
dstImageInfo = srcImageInfo;
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
|
||||||
if (test_copy_image_size_1D_buffer(context, queue, &srcImageInfo,
|
if (test_copy_image_size_1D_buffer(context, queue, &srcImageInfo,
|
||||||
&imageInfo, seed))
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < NUM_IMAGE_ITERATIONS; i++)
|
|
||||||
{
|
|
||||||
cl_ulong size;
|
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
|
||||||
// Loop until we get a size that a) will fit in the max alloc size
|
|
||||||
// and b) that an allocation of that image, the result array, plus
|
|
||||||
// offset arrays, will fit in the global ram space
|
|
||||||
do
|
|
||||||
{
|
|
||||||
imageInfo.width =
|
|
||||||
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
|
||||||
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
|
||||||
|
|
||||||
if (gEnablePitch)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rowPadding++;
|
|
||||||
imageInfo.rowPitch =
|
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
size = (size_t)imageInfo.rowPitch * 4;
|
|
||||||
} while (size > maxAllocSize || (size * 3) > memSize);
|
|
||||||
|
|
||||||
if (gDebugTrace)
|
|
||||||
{
|
|
||||||
log_info(" at size %d (row pitch %d) out of %d\n",
|
|
||||||
(int)imageInfo.width, (int)imageInfo.rowPitch,
|
|
||||||
(int)maxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
image_descriptor srcImageInfo = imageInfo;
|
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
|
||||||
|
|
||||||
int ret = test_copy_image_size_1D_buffer(
|
|
||||||
context, queue, &srcImageInfo, &imageInfo, seed);
|
|
||||||
if (ret) return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int test_copy_image_set_1D_buffer_1D(cl_device_id device, cl_context context,
|
|
||||||
cl_command_queue queue,
|
|
||||||
cl_image_format *format)
|
|
||||||
{
|
|
||||||
size_t maxWidth;
|
|
||||||
cl_ulong maxAllocSize, memSize;
|
|
||||||
image_descriptor imageInfo = { 0 };
|
|
||||||
RandomSeed seed(gRandomSeed);
|
|
||||||
size_t pixelSize;
|
|
||||||
|
|
||||||
if (gTestMipmaps)
|
|
||||||
{
|
|
||||||
// 1D image buffers don't support mipmaps
|
|
||||||
// https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_mipmap_image
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
imageInfo.format = format;
|
|
||||||
imageInfo.height = imageInfo.depth = imageInfo.arraySize =
|
|
||||||
imageInfo.slicePitch = 0;
|
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
|
||||||
pixelSize = get_pixel_size(imageInfo.format);
|
|
||||||
|
|
||||||
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH,
|
|
||||||
sizeof(maxWidth), &maxWidth, NULL);
|
|
||||||
error |= clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
|
|
||||||
sizeof(maxAllocSize), &maxAllocSize, NULL);
|
|
||||||
error |= clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(memSize),
|
|
||||||
&memSize, NULL);
|
|
||||||
test_error(error, "Unable to get max image 1D buffer size from device");
|
|
||||||
|
|
||||||
if (memSize > (cl_ulong)SIZE_MAX)
|
|
||||||
{
|
|
||||||
memSize = (cl_ulong)SIZE_MAX;
|
|
||||||
maxAllocSize = (cl_ulong)SIZE_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gTestSmallImages)
|
|
||||||
{
|
|
||||||
for (imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++)
|
|
||||||
{
|
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
|
||||||
|
|
||||||
if (gEnablePitch)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rowPadding++;
|
|
||||||
imageInfo.rowPitch =
|
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gDebugTrace) log_info(" at size %d\n", (int)imageInfo.width);
|
|
||||||
|
|
||||||
image_descriptor dstImageInfo = imageInfo;
|
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
|
||||||
|
|
||||||
int ret = test_copy_image_size_1D_buffer(context, queue, &imageInfo,
|
|
||||||
&dstImageInfo, seed);
|
|
||||||
if (ret) return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (gTestMaxImages)
|
|
||||||
{
|
|
||||||
// Try a specific set of maximum sizes
|
|
||||||
size_t numbeOfSizes;
|
|
||||||
size_t sizes[100][3];
|
|
||||||
|
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, 1,
|
|
||||||
maxAllocSize, memSize, CL_MEM_OBJECT_IMAGE1D_BUFFER,
|
|
||||||
imageInfo.format);
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < numbeOfSizes; idx++)
|
|
||||||
{
|
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
|
||||||
imageInfo.width = sizes[idx][0];
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
|
||||||
|
|
||||||
if (gEnablePitch)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
rowPadding++;
|
|
||||||
imageInfo.rowPitch =
|
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
log_info("Testing %d\n", (int)sizes[idx][0]);
|
|
||||||
if (gDebugTrace)
|
|
||||||
log_info(" at max size %d\n", (int)sizes[idx][0]);
|
|
||||||
|
|
||||||
image_descriptor dstImageInfo = imageInfo;
|
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
|
||||||
|
|
||||||
if (test_copy_image_size_1D_buffer(context, queue, &imageInfo,
|
|
||||||
&dstImageInfo, seed))
|
&dstImageInfo, seed))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -478,36 +193,194 @@ int test_copy_image_set_1D_buffer_1D(cl_device_id device, cl_context context,
|
|||||||
// offset arrays, will fit in the global ram space
|
// offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
imageInfo.width =
|
srcImageInfo.width =
|
||||||
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch =
|
||||||
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rowPadding++;
|
rowPadding++;
|
||||||
imageInfo.rowPitch =
|
srcImageInfo.rowPitch =
|
||||||
imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = (size_t)imageInfo.rowPitch * 4;
|
size = (size_t)srcImageInfo.rowPitch * 4;
|
||||||
} while (size > maxAllocSize || (size * 3) > memSize);
|
} while (size > maxAllocSize || (size * 3) > memSize);
|
||||||
|
|
||||||
if (gDebugTrace)
|
if (gDebugTrace)
|
||||||
{
|
{
|
||||||
log_info(" at size %d (row pitch %d) out of %d\n",
|
log_info(" at size %d (row pitch %d) out of %d\n",
|
||||||
(int)imageInfo.width, (int)imageInfo.rowPitch,
|
(int)srcImageInfo.width, (int)srcImageInfo.rowPitch,
|
||||||
(int)maxWidth);
|
(int)maxWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
image_descriptor dstImageInfo = imageInfo;
|
dstImageInfo = srcImageInfo;
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
int ret = test_copy_image_size_1D_buffer(
|
||||||
int ret = test_copy_image_size_1D_buffer(context, queue, &imageInfo,
|
context, queue, &srcImageInfo, &dstImageInfo, seed);
|
||||||
&dstImageInfo, seed);
|
if (ret) return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_copy_image_set_1D_1D_buffer(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format)
|
||||||
|
{
|
||||||
|
size_t maxWidth;
|
||||||
|
cl_ulong maxAllocSize, memSize;
|
||||||
|
image_descriptor srcImageInfo = { 0 };
|
||||||
|
image_descriptor dstImageInfo = { 0 };
|
||||||
|
RandomSeed seed(gRandomSeed);
|
||||||
|
size_t pixelSize;
|
||||||
|
|
||||||
|
if (gTestMipmaps)
|
||||||
|
{
|
||||||
|
// 1D image buffers don't support mipmaps
|
||||||
|
// https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_mipmap_image
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
srcImageInfo.format = format;
|
||||||
|
srcImageInfo.height = srcImageInfo.depth = srcImageInfo.arraySize =
|
||||||
|
srcImageInfo.slicePitch = 0;
|
||||||
|
srcImageInfo.type = src_type;
|
||||||
|
srcImageInfo.mem_flags = src_flags;
|
||||||
|
pixelSize = get_pixel_size(srcImageInfo.format);
|
||||||
|
|
||||||
|
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH,
|
||||||
|
sizeof(maxWidth), &maxWidth, NULL);
|
||||||
|
error |= clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
|
||||||
|
sizeof(maxAllocSize), &maxAllocSize, NULL);
|
||||||
|
error |= clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(memSize),
|
||||||
|
&memSize, NULL);
|
||||||
|
test_error(error, "Unable to get max image 1D buffer size from device");
|
||||||
|
|
||||||
|
if (memSize > (cl_ulong)SIZE_MAX)
|
||||||
|
{
|
||||||
|
memSize = (cl_ulong)SIZE_MAX;
|
||||||
|
maxAllocSize = (cl_ulong)SIZE_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gTestSmallImages)
|
||||||
|
{
|
||||||
|
for (srcImageInfo.width = 1; srcImageInfo.width < 13;
|
||||||
|
srcImageInfo.width++)
|
||||||
|
{
|
||||||
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
|
if (gEnablePitch)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
rowPadding++;
|
||||||
|
srcImageInfo.rowPitch =
|
||||||
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gDebugTrace)
|
||||||
|
log_info(" at size %d\n", (int)srcImageInfo.width);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.type = dst_type;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
|
||||||
|
int ret = test_copy_image_size_1D_buffer(
|
||||||
|
context, queue, &srcImageInfo, &dstImageInfo, seed);
|
||||||
|
if (ret) return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (gTestMaxImages)
|
||||||
|
{
|
||||||
|
// Try a specific set of maximum sizes
|
||||||
|
size_t numbeOfSizes;
|
||||||
|
size_t sizes[100][3];
|
||||||
|
|
||||||
|
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, 1, 1, 1,
|
||||||
|
maxAllocSize, memSize, src_type, srcImageInfo.format);
|
||||||
|
|
||||||
|
for (size_t idx = 0; idx < numbeOfSizes; idx++)
|
||||||
|
{
|
||||||
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
|
srcImageInfo.width = sizes[idx][0];
|
||||||
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
|
if (gEnablePitch)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
rowPadding++;
|
||||||
|
srcImageInfo.rowPitch =
|
||||||
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
log_info("Testing %d\n", (int)sizes[idx][0]);
|
||||||
|
if (gDebugTrace)
|
||||||
|
log_info(" at max size %d\n", (int)sizes[idx][0]);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.type = dst_type;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
|
||||||
|
if (test_copy_image_size_1D_buffer(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed))
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NUM_IMAGE_ITERATIONS; i++)
|
||||||
|
{
|
||||||
|
cl_ulong size;
|
||||||
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
|
// Loop until we get a size that a) will fit in the max alloc size
|
||||||
|
// and b) that an allocation of that image, the result array, plus
|
||||||
|
// offset arrays, will fit in the global ram space
|
||||||
|
do
|
||||||
|
{
|
||||||
|
srcImageInfo.width =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
|
|
||||||
|
srcImageInfo.rowPitch =
|
||||||
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
|
if (gEnablePitch)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
rowPadding++;
|
||||||
|
srcImageInfo.rowPitch =
|
||||||
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
size = (size_t)srcImageInfo.rowPitch * 4;
|
||||||
|
} while (size > maxAllocSize || (size * 3) > memSize);
|
||||||
|
|
||||||
|
if (gDebugTrace)
|
||||||
|
{
|
||||||
|
log_info(" at size %d (row pitch %d) out of %d\n",
|
||||||
|
(int)srcImageInfo.width, (int)srcImageInfo.rowPitch,
|
||||||
|
(int)maxWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.type = dst_type;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
|
||||||
|
int ret = test_copy_image_size_1D_buffer(
|
||||||
|
context, queue, &srcImageInfo, &dstImageInfo, seed);
|
||||||
if (ret) return -1;
|
if (ret) return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,38 +18,50 @@
|
|||||||
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
||||||
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
||||||
|
|
||||||
int test_copy_image_size_2D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
|
int test_copy_image_size_2D(cl_context context, cl_command_queue queue,
|
||||||
|
image_descriptor *srcImageInfo,
|
||||||
|
image_descriptor *dstImageInfo, MTdata d)
|
||||||
{
|
{
|
||||||
size_t sourcePos[ 3 ], destPos[ 3 ], regionSize[ 3 ];
|
size_t sourcePos[ 3 ], destPos[ 3 ], regionSize[ 3 ];
|
||||||
int ret = 0, retCode;
|
int ret = 0, retCode;
|
||||||
size_t src_lod = 0, src_width_lod = imageInfo->width, src_row_pitch_lod;
|
size_t src_lod = 0, src_width_lod = srcImageInfo->width, src_row_pitch_lod;
|
||||||
size_t src_height_lod = imageInfo->height;
|
size_t src_height_lod = srcImageInfo->height;
|
||||||
size_t dst_lod = 0, dst_width_lod = imageInfo->width, dst_row_pitch_lod;
|
size_t dst_lod = 0, dst_width_lod = dstImageInfo->width, dst_row_pitch_lod;
|
||||||
size_t dst_height_lod = imageInfo->height;
|
size_t dst_height_lod = dstImageInfo->height;
|
||||||
size_t width_lod = imageInfo->width, height_lod = imageInfo->height;
|
size_t width_lod = srcImageInfo->width, height_lod = srcImageInfo->height;
|
||||||
size_t max_mip_level = 0;
|
size_t max_mip_level = 0;
|
||||||
|
|
||||||
if( gTestMipmaps )
|
if( gTestMipmaps )
|
||||||
{
|
{
|
||||||
max_mip_level = imageInfo->num_mip_levels;
|
max_mip_level = srcImageInfo->num_mip_levels;
|
||||||
// Work at a random mip level
|
// Work at a random mip level
|
||||||
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
src_width_lod = ( imageInfo->width >> src_lod )? ( imageInfo->width >> src_lod ) : 1;
|
src_width_lod = (srcImageInfo->width >> src_lod)
|
||||||
dst_width_lod = ( imageInfo->width >> dst_lod )? ( imageInfo->width >> dst_lod ) : 1;
|
? (srcImageInfo->width >> src_lod)
|
||||||
src_height_lod = ( imageInfo->height >> src_lod )? ( imageInfo->height >> src_lod ) : 1;
|
: 1;
|
||||||
dst_height_lod = ( imageInfo->height >> dst_lod )? ( imageInfo->height >> dst_lod ) : 1;
|
dst_width_lod = (dstImageInfo->width >> dst_lod)
|
||||||
|
? (dstImageInfo->width >> dst_lod)
|
||||||
|
: 1;
|
||||||
|
src_height_lod = (srcImageInfo->height >> src_lod)
|
||||||
|
? (srcImageInfo->height >> src_lod)
|
||||||
|
: 1;
|
||||||
|
dst_height_lod = (dstImageInfo->height >> dst_lod)
|
||||||
|
? (dstImageInfo->height >> dst_lod)
|
||||||
|
: 1;
|
||||||
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
||||||
height_lod = ( src_height_lod > dst_height_lod ) ? dst_height_lod : src_height_lod;
|
height_lod = ( src_height_lod > dst_height_lod ) ? dst_height_lod : src_height_lod;
|
||||||
src_row_pitch_lod = src_width_lod * get_pixel_size( imageInfo->format );
|
src_row_pitch_lod =
|
||||||
dst_row_pitch_lod = dst_width_lod * get_pixel_size( imageInfo->format );
|
src_width_lod * get_pixel_size(srcImageInfo->format);
|
||||||
|
dst_row_pitch_lod =
|
||||||
|
dst_width_lod * get_pixel_size(srcImageInfo->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, try just a full covering region
|
// First, try just a full covering region
|
||||||
sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = 0;
|
sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = 0;
|
||||||
destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = 0;
|
destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = 0;
|
||||||
regionSize[ 0 ] = imageInfo->width;
|
regionSize[0] = srcImageInfo->width;
|
||||||
regionSize[ 1 ] = imageInfo->height;
|
regionSize[1] = srcImageInfo->height;
|
||||||
regionSize[ 2 ] = 1;
|
regionSize[ 2 ] = 1;
|
||||||
|
|
||||||
if(gTestMipmaps)
|
if(gTestMipmaps)
|
||||||
@@ -60,7 +72,9 @@ int test_copy_image_size_2D( cl_context context, cl_command_queue queue, image_d
|
|||||||
regionSize[ 1 ] = height_lod;
|
regionSize[ 1 ] = height_lod;
|
||||||
}
|
}
|
||||||
|
|
||||||
retCode = test_copy_image_generic( context, queue, imageInfo, imageInfo, sourcePos, destPos, regionSize, d );
|
retCode =
|
||||||
|
test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
sourcePos, destPos, regionSize, d);
|
||||||
if( retCode < 0 )
|
if( retCode < 0 )
|
||||||
return retCode;
|
return retCode;
|
||||||
else
|
else
|
||||||
@@ -74,10 +88,18 @@ int test_copy_image_size_2D( cl_context context, cl_command_queue queue, image_d
|
|||||||
// Work at a random mip level
|
// Work at a random mip level
|
||||||
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
src_width_lod = ( imageInfo->width >> src_lod )? ( imageInfo->width >> src_lod ) : 1;
|
src_width_lod = (srcImageInfo->width >> src_lod)
|
||||||
dst_width_lod = ( imageInfo->width >> dst_lod )? ( imageInfo->width >> dst_lod ) : 1;
|
? (srcImageInfo->width >> src_lod)
|
||||||
src_height_lod = ( imageInfo->height >> src_lod )? ( imageInfo->height >> src_lod ) : 1;
|
: 1;
|
||||||
dst_height_lod = ( imageInfo->height >> dst_lod )? ( imageInfo->height >> dst_lod ) : 1;
|
dst_width_lod = (dstImageInfo->width >> dst_lod)
|
||||||
|
? (dstImageInfo->width >> dst_lod)
|
||||||
|
: 1;
|
||||||
|
src_height_lod = (srcImageInfo->height >> src_lod)
|
||||||
|
? (srcImageInfo->height >> src_lod)
|
||||||
|
: 1;
|
||||||
|
dst_height_lod = (dstImageInfo->height >> dst_lod)
|
||||||
|
? (dstImageInfo->height >> dst_lod)
|
||||||
|
: 1;
|
||||||
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
||||||
height_lod = ( src_height_lod > dst_height_lod ) ? dst_height_lod : src_height_lod;
|
height_lod = ( src_height_lod > dst_height_lod ) ? dst_height_lod : src_height_lod;
|
||||||
sourcePos[ 2 ] = src_lod;
|
sourcePos[ 2 ] = src_lod;
|
||||||
@@ -95,7 +117,9 @@ int test_copy_image_size_2D( cl_context context, cl_command_queue queue, image_d
|
|||||||
destPos[ 1 ] = ( height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
|
destPos[ 1 ] = ( height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
|
||||||
|
|
||||||
// Go for it!
|
// Go for it!
|
||||||
retCode = test_copy_image_generic( context, queue, imageInfo, imageInfo, sourcePos, destPos, regionSize, d );
|
retCode =
|
||||||
|
test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
sourcePos, destPos, regionSize, d);
|
||||||
if( retCode < 0 )
|
if( retCode < 0 )
|
||||||
return retCode;
|
return retCode;
|
||||||
else
|
else
|
||||||
@@ -105,17 +129,23 @@ int test_copy_image_size_2D( cl_context context, cl_command_queue queue, image_d
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_copy_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
|
int test_copy_image_set_2D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
|
cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format)
|
||||||
{
|
{
|
||||||
|
assert(dst_type == src_type); // This test expects to copy 2D -> 2D images
|
||||||
size_t maxWidth, maxHeight;
|
size_t maxWidth, maxHeight;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor imageInfo = { 0 };
|
image_descriptor srcImageInfo = { 0 };
|
||||||
|
image_descriptor dstImageInfo = { 0 };
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
size_t pixelSize;
|
size_t pixelSize;
|
||||||
|
|
||||||
imageInfo.format = format;
|
srcImageInfo.format = format;
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
srcImageInfo.type = src_type;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
srcImageInfo.mem_flags = src_flags;
|
||||||
|
pixelSize = get_pixel_size(srcImageInfo.format);
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||||
@@ -130,32 +160,43 @@ int test_copy_image_set_2D( cl_device_id device, cl_context context, cl_command_
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++ )
|
for (srcImageInfo.width = 1; srcImageInfo.width < 13;
|
||||||
|
srcImageInfo.width++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
|
srcImageInfo.height, 0),
|
||||||
|
seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
for( imageInfo.height = 1; imageInfo.height < 9; imageInfo.height++ )
|
for (srcImageInfo.height = 1; srcImageInfo.height < 9;
|
||||||
{
|
srcImageInfo.height++)
|
||||||
if( gDebugTrace )
|
{
|
||||||
log_info( " at size %d,%d\n", (int)imageInfo.width, (int)imageInfo.height );
|
if (gDebugTrace)
|
||||||
|
log_info(" at size %d,%d\n", (int)srcImageInfo.width,
|
||||||
|
(int)srcImageInfo.height);
|
||||||
|
|
||||||
int ret = test_copy_image_size_2D( context, queue, &imageInfo, seed );
|
dstImageInfo = srcImageInfo;
|
||||||
if( ret )
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
return -1;
|
int ret = test_copy_image_size_2D(context, queue, &srcImageInfo,
|
||||||
}
|
&dstImageInfo, seed);
|
||||||
|
if (ret) return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( gTestMaxImages )
|
else if( gTestMaxImages )
|
||||||
@@ -164,31 +205,42 @@ int test_copy_image_set_2D( cl_device_id device, cl_context context, cl_command_
|
|||||||
size_t numbeOfSizes;
|
size_t numbeOfSizes;
|
||||||
size_t sizes[100][3];
|
size_t sizes[100][3];
|
||||||
|
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, maxHeight, 1, 1, maxAllocSize, memSize, CL_MEM_OBJECT_IMAGE2D, imageInfo.format);
|
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, maxHeight, 1, 1,
|
||||||
|
maxAllocSize, memSize, src_type, srcImageInfo.format);
|
||||||
|
|
||||||
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 48 : 0;
|
size_t rowPadding = gEnablePitch ? 48 : 0;
|
||||||
|
|
||||||
imageInfo.width = sizes[ idx ][ 0 ];
|
srcImageInfo.width = sizes[idx][0];
|
||||||
imageInfo.height = sizes[ idx ][ 1 ];
|
srcImageInfo.height = sizes[idx][1];
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
|
srcImageInfo.height, 0),
|
||||||
|
seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
log_info( "Testing %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ] );
|
log_info( "Testing %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ] );
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at max size %d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ] );
|
log_info( " at max size %d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ] );
|
||||||
if( test_copy_image_size_2D( context, queue, &imageInfo, seed ) )
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
if (test_copy_image_size_2D(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,34 +254,51 @@ int test_copy_image_set_2D( cl_device_id device, cl_context context, cl_command_
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
imageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
srcImageInfo.width =
|
||||||
imageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
|
srcImageInfo.height =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxHeight / 32, seed);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
imageInfo.rowPitch = imageInfo.width * get_pixel_size( imageInfo.format );
|
2,
|
||||||
size = compute_mipmapped_image_size( imageInfo );
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
size = size*4;
|
srcImageInfo.height, 0),
|
||||||
}
|
seed);
|
||||||
|
srcImageInfo.rowPitch = srcImageInfo.width
|
||||||
|
* get_pixel_size(srcImageInfo.format);
|
||||||
|
size = compute_mipmapped_image_size(srcImageInfo);
|
||||||
|
size = size * 4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
size = (size_t)imageInfo.rowPitch * (size_t)imageInfo.height * 4;
|
size =
|
||||||
|
(size_t)srcImageInfo.rowPitch * (size_t)srcImageInfo.height * 4;
|
||||||
}
|
}
|
||||||
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
||||||
|
|
||||||
if( gDebugTrace )
|
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 );
|
log_info(" at size %d,%d (row pitch %d) out of %d,%d\n",
|
||||||
int ret = test_copy_image_size_2D( context, queue, &imageInfo, seed );
|
(int)srcImageInfo.width, (int)srcImageInfo.height,
|
||||||
|
(int)srcImageInfo.rowPitch, (int)maxWidth,
|
||||||
|
(int)maxHeight);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
int ret = test_copy_image_size_2D(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,14 +36,12 @@ static void set_image_dimensions( image_descriptor *imageInfo, size_t width, siz
|
|||||||
} while ((imageInfo->rowPitch % pixelSize) != 0);
|
} while ((imageInfo->rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arraySize == 0)
|
if (imageInfo->type == CL_MEM_OBJECT_IMAGE2D)
|
||||||
{
|
{
|
||||||
imageInfo->type = CL_MEM_OBJECT_IMAGE2D;
|
|
||||||
imageInfo->slicePitch = 0;
|
imageInfo->slicePitch = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageInfo->type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
|
||||||
imageInfo->slicePitch = imageInfo->rowPitch * (imageInfo->height + slicePadding);
|
imageInfo->slicePitch = imageInfo->rowPitch * (imageInfo->height + slicePadding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,15 +203,31 @@ int test_copy_image_size_2D_2D_array( cl_context context, cl_command_queue queue
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_copy_image_set_2D_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse = false )
|
int test_copy_image_set_2D_2D_array(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format)
|
||||||
{
|
{
|
||||||
size_t maxWidth, maxHeight, maxArraySize;
|
size_t maxWidth, maxHeight, maxArraySize;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor srcImageInfo = { 0 };
|
const bool reverse = (src_type == CL_MEM_OBJECT_IMAGE2D_ARRAY);
|
||||||
image_descriptor dstImageInfo = { 0 };
|
image_descriptor imageInfo2D = { 0 };
|
||||||
|
image_descriptor imageInfo2Darray = { 0 };
|
||||||
RandomSeed seed( gRandomSeed );
|
RandomSeed seed( gRandomSeed );
|
||||||
|
|
||||||
srcImageInfo.format = dstImageInfo.format = format;
|
imageInfo2D.format = imageInfo2Darray.format = format;
|
||||||
|
imageInfo2D.type = CL_MEM_OBJECT_IMAGE2D;
|
||||||
|
imageInfo2Darray.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
imageInfo2Darray.mem_flags = src_flags;
|
||||||
|
imageInfo2D.mem_flags = dst_flags;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imageInfo2D.mem_flags = src_flags;
|
||||||
|
imageInfo2Darray.mem_flags = dst_flags;
|
||||||
|
}
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||||
@@ -229,42 +243,77 @@ int test_copy_image_set_2D_2D_array( cl_device_id device, cl_context context, cl
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( dstImageInfo.width = 4; dstImageInfo.width < 17; dstImageInfo.width++ )
|
for (imageInfo2Darray.width = 4; imageInfo2Darray.width < 17;
|
||||||
|
imageInfo2Darray.width++)
|
||||||
{
|
{
|
||||||
for( dstImageInfo.height = 4; dstImageInfo.height < 13; dstImageInfo.height++ )
|
for (imageInfo2Darray.height = 4; imageInfo2Darray.height < 13;
|
||||||
|
imageInfo2Darray.height++)
|
||||||
{
|
{
|
||||||
for( dstImageInfo.arraySize = 4; dstImageInfo.arraySize < 9; dstImageInfo.arraySize++ )
|
for (imageInfo2Darray.arraySize = 4;
|
||||||
|
imageInfo2Darray.arraySize < 9;
|
||||||
|
imageInfo2Darray.arraySize++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 256 : 0;
|
size_t rowPadding = gEnablePitch ? 256 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.arraySize, rowPadding, slicePadding );
|
set_image_dimensions(
|
||||||
set_image_dimensions( &srcImageInfo, dstImageInfo.width, dstImageInfo.height, 0, rowPadding, slicePadding );
|
&imageInfo2Darray, imageInfo2Darray.width,
|
||||||
|
imageInfo2Darray.height, imageInfo2Darray.arraySize,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
set_image_dimensions(&imageInfo2D, imageInfo2Darray.width,
|
||||||
|
imageInfo2Darray.height, 0, rowPadding,
|
||||||
|
slicePadding);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
|
imageInfo2D.num_mip_levels =
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
(cl_uint)random_log_in_range(
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
|
2,
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
(int)compute_max_mip_levels(
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
imageInfo2D.width, imageInfo2D.height, 0),
|
||||||
srcImageInfo.slicePitch = 0;
|
seed);
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
imageInfo2Darray.num_mip_levels =
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
(cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(
|
||||||
|
imageInfo2Darray.width,
|
||||||
|
imageInfo2Darray.height, 0),
|
||||||
|
seed);
|
||||||
|
imageInfo2D.rowPitch = imageInfo2D.width
|
||||||
|
* get_pixel_size(imageInfo2D.format);
|
||||||
|
imageInfo2D.slicePitch = 0;
|
||||||
|
imageInfo2Darray.rowPitch = imageInfo2Darray.width
|
||||||
|
* get_pixel_size(imageInfo2Darray.format);
|
||||||
|
imageInfo2Darray.slicePitch =
|
||||||
|
imageInfo2Darray.rowPitch * imageInfo2Darray.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( " at size %d,%d,%d to %d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
|
log_info(" at size %d,%d,%d to %d,%d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo2D.width,
|
||||||
|
(int)imageInfo2D.height);
|
||||||
else
|
else
|
||||||
log_info( " at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info(" at size %d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2D.width,
|
||||||
|
(int)imageInfo2D.height,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_2D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_2D_2D_array(
|
||||||
|
context, queue, &imageInfo2Darray, &imageInfo2D,
|
||||||
|
seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_2D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_2D_2D_array(
|
||||||
|
context, queue, &imageInfo2D, &imageInfo2Darray,
|
||||||
|
seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -278,8 +327,12 @@ int test_copy_image_set_2D_2D_array( cl_device_id device, cl_context context, cl
|
|||||||
size_t sizes2DArray[100][3], sizes2D[100][3];
|
size_t sizes2DArray[100][3], sizes2D[100][3];
|
||||||
|
|
||||||
// Try to allocate a bit smaller images because we need the 2D ones as well for the copy.
|
// Try to allocate a bit smaller images because we need the 2D ones as well for the copy.
|
||||||
get_max_sizes(&numberOfSizes2DArray, 100, sizes2DArray, maxWidth, maxHeight, 1, maxArraySize, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE2D_ARRAY, dstImageInfo.format);
|
get_max_sizes(&numberOfSizes2DArray, 100, sizes2DArray, maxWidth,
|
||||||
get_max_sizes(&numberOfSizes2D, 100, sizes2D, maxWidth, maxHeight, 1, 1, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE2D, dstImageInfo.format);
|
maxHeight, 1, maxArraySize, maxAllocSize / 2, memSize / 2,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D_ARRAY, imageInfo2Darray.format);
|
||||||
|
get_max_sizes(&numberOfSizes2D, 100, sizes2D, maxWidth, maxHeight, 1, 1,
|
||||||
|
maxAllocSize / 2, memSize / 2, CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
imageInfo2Darray.format);
|
||||||
|
|
||||||
for( size_t i = 0; i < numberOfSizes2D; i++ )
|
for( size_t i = 0; i < numberOfSizes2D; i++ )
|
||||||
{
|
{
|
||||||
@@ -288,56 +341,94 @@ int test_copy_image_set_2D_2D_array( cl_device_id device, cl_context context, cl
|
|||||||
size_t rowPadding = gEnablePitch ? 256 : 0;
|
size_t rowPadding = gEnablePitch ? 256 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
set_image_dimensions( &dstImageInfo, sizes2DArray[ j ][ 0 ], sizes2DArray[ j ][ 1 ], sizes2DArray[ j ][ 2 ], rowPadding, slicePadding );
|
set_image_dimensions(&imageInfo2Darray, sizes2DArray[j][0],
|
||||||
set_image_dimensions( &srcImageInfo, sizes2D[ i ][ 0 ], sizes2D[ i ][ 1 ], 0, rowPadding, slicePadding );
|
sizes2DArray[j][1], sizes2DArray[j][2],
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
set_image_dimensions(&imageInfo2D, sizes2D[i][0], sizes2D[i][1], 0,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
|
||||||
cl_ulong dstSize = get_image_size(&dstImageInfo);
|
cl_ulong dstSize = get_image_size(&imageInfo2Darray);
|
||||||
cl_ulong srcSize = get_image_size(&srcImageInfo);
|
cl_ulong srcSize = get_image_size(&imageInfo2D);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
|
imageInfo2D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
2,
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
|
(int)compute_max_mip_levels(imageInfo2D.width,
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
imageInfo2D.height, 0),
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
seed);
|
||||||
srcImageInfo.slicePitch = 0;
|
imageInfo2Darray.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
2,
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
(int)compute_max_mip_levels(imageInfo2Darray.width,
|
||||||
dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
|
imageInfo2Darray.height, 0),
|
||||||
srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
|
seed);
|
||||||
|
imageInfo2D.rowPitch =
|
||||||
|
imageInfo2D.width * get_pixel_size(imageInfo2D.format);
|
||||||
|
imageInfo2D.slicePitch = 0;
|
||||||
|
imageInfo2Darray.rowPitch = imageInfo2Darray.width
|
||||||
|
* get_pixel_size(imageInfo2Darray.format);
|
||||||
|
imageInfo2Darray.slicePitch =
|
||||||
|
imageInfo2Darray.rowPitch * imageInfo2Darray.height;
|
||||||
|
dstSize = 4 * compute_mipmapped_image_size(imageInfo2Darray);
|
||||||
|
srcSize = 4 * compute_mipmapped_image_size(imageInfo2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) && srcSize < maxAllocSize && srcSize < ( memSize / 3 ) )
|
if( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) && srcSize < maxAllocSize && srcSize < ( memSize / 3 ) )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( "Testing %d x %d x %d to %d x %d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
|
log_info("Testing %d x %d x %d to %d x %d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height);
|
||||||
else
|
else
|
||||||
log_info( "Testing %d x %d to %d x %d x %d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info("Testing %d x %d to %d x %d x %d\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( " at max size %d,%d,%d to %d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
|
log_info(" at max size %d,%d,%d to %d,%d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height);
|
||||||
else
|
else
|
||||||
log_info( " at max size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info(" at max size %d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_2D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_2D_2D_array(
|
||||||
|
context, queue, &imageInfo2Darray, &imageInfo2D, seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_2D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_2D_2D_array(
|
||||||
|
context, queue, &imageInfo2D, &imageInfo2Darray, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info("Not testing max size %d x %d x %d to %d x %d due to memory constraints.\n",
|
log_info("Not testing max size %d x %d x %d to %d x %d due "
|
||||||
(int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height);
|
"to memory constraints.\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height);
|
||||||
else
|
else
|
||||||
log_info("Not testing max size %d x %d to %d x %d x %d due to memory constraints.\n",
|
log_info("Not testing max size %d x %d to %d x %d x %d due "
|
||||||
(int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize);
|
"to memory constraints.\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -354,47 +445,81 @@ int test_copy_image_set_2D_2D_array( cl_device_id device, cl_context context, cl
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
dstImageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
imageInfo2Darray.width =
|
||||||
dstImageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
dstImageInfo.arraySize = (size_t)random_log_in_range( 16, (int)maxArraySize / 32, seed );
|
imageInfo2Darray.height =
|
||||||
srcImageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxHeight / 32, seed);
|
||||||
srcImageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
|
imageInfo2Darray.arraySize = (size_t)random_log_in_range(
|
||||||
|
16, (int)maxArraySize / 32, seed);
|
||||||
|
imageInfo2D.width =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
|
imageInfo2D.height =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxHeight / 32, seed);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
|
imageInfo2D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
2,
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
|
(int)compute_max_mip_levels(imageInfo2D.width,
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
imageInfo2D.height, 0),
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
seed);
|
||||||
srcImageInfo.slicePitch = 0;
|
imageInfo2Darray.num_mip_levels =
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
(cl_uint)random_log_in_range(
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
2,
|
||||||
srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
|
(int)compute_max_mip_levels(imageInfo2Darray.width,
|
||||||
dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
|
imageInfo2Darray.height,
|
||||||
|
0),
|
||||||
|
seed);
|
||||||
|
imageInfo2D.rowPitch =
|
||||||
|
imageInfo2D.width * get_pixel_size(imageInfo2D.format);
|
||||||
|
imageInfo2D.slicePitch = 0;
|
||||||
|
imageInfo2Darray.rowPitch = imageInfo2Darray.width
|
||||||
|
* get_pixel_size(imageInfo2Darray.format);
|
||||||
|
imageInfo2Darray.slicePitch =
|
||||||
|
imageInfo2Darray.rowPitch * imageInfo2Darray.height;
|
||||||
|
srcSize = 4 * compute_mipmapped_image_size(imageInfo2D);
|
||||||
|
dstSize =
|
||||||
|
4 * compute_mipmapped_image_size(imageInfo2Darray);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_image_dimensions( &srcImageInfo, srcImageInfo.width, srcImageInfo.height, 0, rowPadding, slicePadding );
|
set_image_dimensions(&imageInfo2D, imageInfo2D.width,
|
||||||
set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.arraySize, rowPadding, slicePadding );
|
imageInfo2D.height, 0, rowPadding,
|
||||||
|
slicePadding);
|
||||||
|
set_image_dimensions(
|
||||||
|
&imageInfo2Darray, imageInfo2Darray.width,
|
||||||
|
imageInfo2Darray.height, imageInfo2Darray.arraySize,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
|
||||||
srcSize = (cl_ulong)srcImageInfo.rowPitch * (cl_ulong)srcImageInfo.height * 4;
|
srcSize = (cl_ulong)imageInfo2D.rowPitch
|
||||||
dstSize = (cl_ulong)dstImageInfo.slicePitch * (cl_ulong)dstImageInfo.arraySize * 4;
|
* (cl_ulong)imageInfo2D.height * 4;
|
||||||
|
dstSize = (cl_ulong)imageInfo2Darray.slicePitch
|
||||||
|
* (cl_ulong)imageInfo2Darray.arraySize * 4;
|
||||||
}
|
}
|
||||||
} while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
|
} while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( " at size %d,%d,%d to %d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
|
log_info(" at size %d,%d,%d to %d,%d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height);
|
||||||
else
|
else
|
||||||
log_info( " at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info(" at size %d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_2D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_2D_2D_array(
|
||||||
|
context, queue, &imageInfo2Darray, &imageInfo2D, seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_2D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_2D_2D_array(
|
||||||
|
context, queue, &imageInfo2D, &imageInfo2Darray, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,8 @@ static void set_image_dimensions( image_descriptor *imageInfo, size_t width, siz
|
|||||||
} while ((imageInfo->rowPitch % pixelSize) != 0);
|
} while ((imageInfo->rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
imageInfo->slicePitch = imageInfo->rowPitch * (imageInfo->height + slicePadding);
|
imageInfo->slicePitch =
|
||||||
|
imageInfo->rowPitch * (imageInfo->height + slicePadding);
|
||||||
if (depth == 0)
|
|
||||||
imageInfo->type = CL_MEM_OBJECT_IMAGE2D;
|
|
||||||
else
|
|
||||||
imageInfo->type = CL_MEM_OBJECT_IMAGE3D;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -209,15 +205,33 @@ int test_copy_image_size_2D_3D( cl_context context, cl_command_queue queue, imag
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_copy_image_set_2D_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse = false )
|
int test_copy_image_set_2D_3D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
|
cl_mem_object_type src_type,
|
||||||
|
cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type,
|
||||||
|
cl_image_format *format)
|
||||||
{
|
{
|
||||||
size_t maxWidth, maxHeight, max3DWidth, max3DHeight, max3DDepth;
|
size_t maxWidth, maxHeight, max3DWidth, max3DHeight, max3DDepth;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor srcImageInfo = { 0 };
|
const bool reverse = (dst_type == CL_MEM_OBJECT_IMAGE2D);
|
||||||
image_descriptor dstImageInfo = { 0 };
|
image_descriptor imageInfo2D = { 0 };
|
||||||
|
image_descriptor imageInfo3D = { 0 };
|
||||||
RandomSeed seed( gRandomSeed );
|
RandomSeed seed( gRandomSeed );
|
||||||
|
|
||||||
srcImageInfo.format = dstImageInfo.format = format;
|
imageInfo2D.format = imageInfo3D.format = format;
|
||||||
|
imageInfo2D.type = CL_MEM_OBJECT_IMAGE2D;
|
||||||
|
imageInfo3D.type = CL_MEM_OBJECT_IMAGE3D;
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
imageInfo3D.mem_flags = src_flags;
|
||||||
|
imageInfo2D.mem_flags = dst_flags;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imageInfo2D.mem_flags = src_flags;
|
||||||
|
imageInfo3D.mem_flags = dst_flags;
|
||||||
|
}
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||||
@@ -235,38 +249,62 @@ int test_copy_image_set_2D_3D( cl_device_id device, cl_context context, cl_comma
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( dstImageInfo.width = 4; dstImageInfo.width < 17; dstImageInfo.width++ )
|
for (imageInfo3D.width = 4; imageInfo3D.width < 17; imageInfo3D.width++)
|
||||||
{
|
{
|
||||||
for( dstImageInfo.height = 4; dstImageInfo.height < 13; dstImageInfo.height++ )
|
for (imageInfo3D.height = 4; imageInfo3D.height < 13;
|
||||||
|
imageInfo3D.height++)
|
||||||
{
|
{
|
||||||
for( dstImageInfo.depth = 4; dstImageInfo.depth < 9; dstImageInfo.depth++ )
|
for (imageInfo3D.depth = 4; imageInfo3D.depth < 9;
|
||||||
|
imageInfo3D.depth++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 256 : 0;
|
size_t rowPadding = gEnablePitch ? 256 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth, rowPadding, slicePadding );
|
set_image_dimensions(&imageInfo3D, imageInfo3D.width,
|
||||||
set_image_dimensions( &srcImageInfo, dstImageInfo.width, dstImageInfo.height, 0, rowPadding, slicePadding );
|
imageInfo3D.height, imageInfo3D.depth,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
set_image_dimensions(&imageInfo2D, imageInfo3D.width,
|
||||||
|
imageInfo3D.height, 0, rowPadding,
|
||||||
|
slicePadding);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
|
imageInfo2D.num_mip_levels =
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
(cl_uint)random_log_in_range(
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth), seed);
|
2,
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
(int)compute_max_mip_levels(
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
imageInfo2D.width, imageInfo2D.height, 0),
|
||||||
srcImageInfo.slicePitch = 0;
|
seed);
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
imageInfo3D.num_mip_levels =
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
(cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(imageInfo3D.width,
|
||||||
|
imageInfo3D.height,
|
||||||
|
imageInfo3D.depth),
|
||||||
|
seed);
|
||||||
|
imageInfo2D.rowPitch = imageInfo2D.width
|
||||||
|
* get_pixel_size(imageInfo2D.format);
|
||||||
|
imageInfo2D.slicePitch = 0;
|
||||||
|
imageInfo3D.rowPitch = imageInfo3D.width
|
||||||
|
* get_pixel_size(imageInfo3D.format);
|
||||||
|
imageInfo3D.slicePitch =
|
||||||
|
imageInfo3D.rowPitch * imageInfo3D.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
|
log_info(
|
||||||
|
" at size %d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_2D_3D( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_2D_3D(
|
||||||
|
context, queue, &imageInfo3D, &imageInfo2D, seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_2D_3D( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_2D_3D(
|
||||||
|
context, queue, &imageInfo2D, &imageInfo3D, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -280,8 +318,12 @@ int test_copy_image_set_2D_3D( cl_device_id device, cl_context context, cl_comma
|
|||||||
size_t sizes3D[100][3], sizes2D[100][3];
|
size_t sizes3D[100][3], sizes2D[100][3];
|
||||||
|
|
||||||
// Try to allocate a bit smaller images because we need the 2D ones as well for the copy.
|
// Try to allocate a bit smaller images because we need the 2D ones as well for the copy.
|
||||||
get_max_sizes(&numberOfSizes3D, 100, sizes3D, max3DWidth, max3DHeight, max3DDepth, 1, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE3D, dstImageInfo.format);
|
get_max_sizes(&numberOfSizes3D, 100, sizes3D, max3DWidth, max3DHeight,
|
||||||
get_max_sizes(&numberOfSizes2D, 100, sizes2D, maxWidth, maxHeight, 1, 1, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE2D, srcImageInfo.format);
|
max3DDepth, 1, maxAllocSize / 2, memSize / 2,
|
||||||
|
CL_MEM_OBJECT_IMAGE3D, imageInfo3D.format);
|
||||||
|
get_max_sizes(&numberOfSizes2D, 100, sizes2D, maxWidth, maxHeight, 1, 1,
|
||||||
|
maxAllocSize / 2, memSize / 2, CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
imageInfo2D.format);
|
||||||
|
|
||||||
for( size_t i = 0; i < numberOfSizes2D; i++ )
|
for( size_t i = 0; i < numberOfSizes2D; i++ )
|
||||||
for( size_t j = 0; j < numberOfSizes3D; j++ )
|
for( size_t j = 0; j < numberOfSizes3D; j++ )
|
||||||
@@ -289,42 +331,65 @@ int test_copy_image_set_2D_3D( cl_device_id device, cl_context context, cl_comma
|
|||||||
size_t rowPadding = gEnablePitch ? 256 : 0;
|
size_t rowPadding = gEnablePitch ? 256 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
set_image_dimensions( &dstImageInfo, sizes3D[ j ][ 0 ], sizes3D[ j ][ 1 ], sizes3D[ j ][ 2 ], rowPadding, slicePadding );
|
set_image_dimensions(&imageInfo3D, sizes3D[j][0], sizes3D[j][1],
|
||||||
set_image_dimensions( &srcImageInfo, sizes2D[ i ][ 0 ], sizes2D[ i ][ 1 ], 0, rowPadding, slicePadding );
|
sizes3D[j][2], rowPadding, slicePadding);
|
||||||
cl_ulong dstSize = get_image_size(&dstImageInfo);
|
set_image_dimensions(&imageInfo2D, sizes2D[i][0], sizes2D[i][1], 0,
|
||||||
cl_ulong srcSize = get_image_size(&srcImageInfo);
|
rowPadding, slicePadding);
|
||||||
|
cl_ulong dstSize = get_image_size(&imageInfo3D);
|
||||||
|
cl_ulong srcSize = get_image_size(&imageInfo2D);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
|
imageInfo2D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
2,
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth), seed);
|
(int)compute_max_mip_levels(imageInfo2D.width,
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
imageInfo2D.height, 0),
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
seed);
|
||||||
srcImageInfo.slicePitch = 0;
|
imageInfo3D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
2,
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
(int)compute_max_mip_levels(imageInfo3D.width,
|
||||||
dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
|
imageInfo3D.height,
|
||||||
srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
|
imageInfo3D.depth),
|
||||||
|
seed);
|
||||||
|
imageInfo2D.rowPitch =
|
||||||
|
imageInfo2D.width * get_pixel_size(imageInfo2D.format);
|
||||||
|
imageInfo2D.slicePitch = 0;
|
||||||
|
imageInfo3D.rowPitch =
|
||||||
|
imageInfo3D.width * get_pixel_size(imageInfo3D.format);
|
||||||
|
imageInfo3D.slicePitch =
|
||||||
|
imageInfo3D.rowPitch * imageInfo3D.height;
|
||||||
|
dstSize = 4 * compute_mipmapped_image_size(imageInfo3D);
|
||||||
|
srcSize = 4 * compute_mipmapped_image_size(imageInfo2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) && srcSize < maxAllocSize && srcSize < ( memSize / 3 ) )
|
if( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) && srcSize < maxAllocSize && srcSize < ( memSize / 3 ) )
|
||||||
{
|
{
|
||||||
log_info( "Testing %d x %d to %d x %d x %d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
|
log_info("Testing %d x %d to %d x %d x %d\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at max size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
|
log_info(" at max size %d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_2D_3D( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_2D_3D(
|
||||||
|
context, queue, &imageInfo3D, &imageInfo2D, seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_2D_3D( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_2D_3D(
|
||||||
|
context, queue, &imageInfo2D, &imageInfo3D, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_info("Not testing max size %d x %d to %d x %d x %d due to memory constraints.\n",
|
log_info("Not testing max size %d x %d to %d x %d x %d due to "
|
||||||
(int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth);
|
"memory constraints.\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -341,42 +406,68 @@ int test_copy_image_set_2D_3D( cl_device_id device, cl_context context, cl_comma
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
dstImageInfo.width = (size_t)random_log_in_range( 16, (int)max3DWidth / 32, seed );
|
imageInfo3D.width =
|
||||||
dstImageInfo.height = (size_t)random_log_in_range( 16, (int)max3DHeight / 32, seed );
|
(size_t)random_log_in_range(16, (int)max3DWidth / 32, seed);
|
||||||
dstImageInfo.depth = (size_t)random_log_in_range( 16, (int)max3DDepth / 32, seed );
|
imageInfo3D.height = (size_t)random_log_in_range(
|
||||||
srcImageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
16, (int)max3DHeight / 32, seed);
|
||||||
srcImageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
|
imageInfo3D.depth =
|
||||||
|
(size_t)random_log_in_range(16, (int)max3DDepth / 32, seed);
|
||||||
|
imageInfo2D.width =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
|
imageInfo2D.height =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxHeight / 32, seed);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
|
imageInfo2D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
2,
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth), seed);
|
(int)compute_max_mip_levels(imageInfo2D.width,
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
imageInfo2D.height, 0),
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
seed);
|
||||||
srcImageInfo.slicePitch = 0;
|
imageInfo3D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
2,
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
(int)compute_max_mip_levels(imageInfo3D.width,
|
||||||
srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
|
imageInfo3D.height,
|
||||||
dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
|
imageInfo3D.depth),
|
||||||
|
seed);
|
||||||
|
imageInfo2D.rowPitch =
|
||||||
|
imageInfo2D.width * get_pixel_size(imageInfo2D.format);
|
||||||
|
imageInfo2D.slicePitch = 0;
|
||||||
|
imageInfo3D.rowPitch =
|
||||||
|
imageInfo3D.width * get_pixel_size(imageInfo3D.format);
|
||||||
|
imageInfo3D.slicePitch =
|
||||||
|
imageInfo3D.rowPitch * imageInfo3D.height;
|
||||||
|
srcSize = 4 * compute_mipmapped_image_size(imageInfo2D);
|
||||||
|
dstSize = 4 * compute_mipmapped_image_size(imageInfo3D);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_image_dimensions( &srcImageInfo, srcImageInfo.width, srcImageInfo.height, 0, rowPadding, slicePadding );
|
set_image_dimensions(&imageInfo2D, imageInfo2D.width,
|
||||||
set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.depth, rowPadding, slicePadding );
|
imageInfo2D.height, 0, rowPadding,
|
||||||
|
slicePadding);
|
||||||
|
set_image_dimensions(&imageInfo3D, imageInfo3D.width,
|
||||||
|
imageInfo3D.height, imageInfo3D.depth,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
|
||||||
srcSize = (cl_ulong)srcImageInfo.rowPitch * (cl_ulong)srcImageInfo.height * 4;
|
srcSize = (cl_ulong)imageInfo2D.rowPitch
|
||||||
dstSize = (cl_ulong)dstImageInfo.slicePitch * (cl_ulong)dstImageInfo.depth * 4;
|
* (cl_ulong)imageInfo2D.height * 4;
|
||||||
|
dstSize = (cl_ulong)imageInfo3D.slicePitch
|
||||||
|
* (cl_ulong)imageInfo3D.depth * 4;
|
||||||
}
|
}
|
||||||
} while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
|
} while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.depth );
|
log_info(" at size %d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2D.width, (int)imageInfo2D.height,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_2D_3D( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_2D_3D(context, queue, &imageInfo3D,
|
||||||
|
&imageInfo2D, seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_2D_3D( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_2D_3D(context, queue, &imageInfo2D,
|
||||||
|
&imageInfo3D, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,26 +19,39 @@
|
|||||||
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
||||||
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
||||||
|
|
||||||
int test_copy_image_2D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
|
int test_copy_image_2D_array(cl_context context, cl_command_queue queue,
|
||||||
|
image_descriptor *srcImageInfo,
|
||||||
|
image_descriptor *dstImageInfo, MTdata d)
|
||||||
{
|
{
|
||||||
size_t srcPos[] = { 0, 0, 0, 0}, dstPos[] = {0, 0, 0, 0};
|
size_t srcPos[] = { 0, 0, 0, 0}, dstPos[] = {0, 0, 0, 0};
|
||||||
size_t region[] = { imageInfo->width, imageInfo->height, imageInfo->arraySize };
|
size_t region[] = { srcImageInfo->width, srcImageInfo->height,
|
||||||
|
srcImageInfo->arraySize };
|
||||||
|
|
||||||
size_t src_lod = 0, src_width_lod = imageInfo->width, src_height_lod = imageInfo->height;
|
size_t src_lod = 0, src_width_lod = srcImageInfo->width,
|
||||||
size_t dst_lod = 0, dst_width_lod = imageInfo->width, dst_height_lod = imageInfo->height;
|
src_height_lod = srcImageInfo->height;
|
||||||
size_t width_lod = imageInfo->width, height_lod = imageInfo->height;
|
size_t dst_lod = 0, dst_width_lod = dstImageInfo->width,
|
||||||
|
dst_height_lod = dstImageInfo->height;
|
||||||
|
size_t width_lod = srcImageInfo->width, height_lod = srcImageInfo->height;
|
||||||
size_t max_mip_level;
|
size_t max_mip_level;
|
||||||
|
|
||||||
if( gTestMipmaps )
|
if( gTestMipmaps )
|
||||||
{
|
{
|
||||||
max_mip_level = imageInfo->num_mip_levels;
|
max_mip_level = srcImageInfo->num_mip_levels;
|
||||||
// Work at a random mip level
|
// Work at a random mip level
|
||||||
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
src_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
dst_lod = (size_t)random_in_range( 0, max_mip_level ? max_mip_level - 1 : 0, d );
|
||||||
src_width_lod = ( imageInfo->width >> src_lod )? ( imageInfo->width >> src_lod ) : 1;
|
src_width_lod = (srcImageInfo->width >> src_lod)
|
||||||
dst_width_lod = ( imageInfo->width >> dst_lod )? ( imageInfo->width >> dst_lod ) : 1;
|
? (srcImageInfo->width >> src_lod)
|
||||||
src_height_lod = ( imageInfo->height >> src_lod )? ( imageInfo->height >> src_lod ) : 1;
|
: 1;
|
||||||
dst_height_lod = ( imageInfo->height >> dst_lod )? ( imageInfo->height >> dst_lod ) : 1;
|
dst_width_lod = (dstImageInfo->width >> dst_lod)
|
||||||
|
? (dstImageInfo->width >> dst_lod)
|
||||||
|
: 1;
|
||||||
|
src_height_lod = (srcImageInfo->height >> src_lod)
|
||||||
|
? (srcImageInfo->height >> src_lod)
|
||||||
|
: 1;
|
||||||
|
dst_height_lod = (dstImageInfo->height >> dst_lod)
|
||||||
|
? (dstImageInfo->height >> dst_lod)
|
||||||
|
: 1;
|
||||||
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
width_lod = ( src_width_lod > dst_width_lod ) ? dst_width_lod : src_width_lod;
|
||||||
height_lod = ( src_height_lod > dst_height_lod ) ? dst_height_lod : src_height_lod;
|
height_lod = ( src_height_lod > dst_height_lod ) ? dst_height_lod : src_height_lod;
|
||||||
|
|
||||||
@@ -47,20 +60,31 @@ int test_copy_image_2D_array( cl_context context, cl_command_queue queue, image_
|
|||||||
srcPos[ 3 ] = src_lod;
|
srcPos[ 3 ] = src_lod;
|
||||||
dstPos[ 3 ] = dst_lod;
|
dstPos[ 3 ] = dst_lod;
|
||||||
}
|
}
|
||||||
return test_copy_image_generic( context, queue, imageInfo, imageInfo, srcPos, dstPos, region, d );
|
return test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
srcPos, dstPos, region, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_copy_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
|
int test_copy_image_set_2D_array(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
|
cl_mem_object_type src_type,
|
||||||
|
cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type,
|
||||||
|
cl_image_format *format)
|
||||||
{
|
{
|
||||||
|
assert(
|
||||||
|
dst_type
|
||||||
|
== src_type); // This test expects to copy 2D array -> 2D array images
|
||||||
size_t maxWidth, maxHeight, maxArraySize;
|
size_t maxWidth, maxHeight, maxArraySize;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor imageInfo = { 0 };
|
image_descriptor srcImageInfo = { 0 };
|
||||||
|
image_descriptor dstImageInfo = { 0 };
|
||||||
RandomSeed seed( gRandomSeed );
|
RandomSeed seed( gRandomSeed );
|
||||||
size_t pixelSize;
|
size_t pixelSize;
|
||||||
|
|
||||||
imageInfo.format = format;
|
srcImageInfo.format = format;
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
srcImageInfo.type = src_type;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
srcImageInfo.mem_flags = src_flags;
|
||||||
|
pixelSize = get_pixel_size(srcImageInfo.format);
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||||
@@ -76,33 +100,49 @@ int test_copy_image_set_2D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++ )
|
for (srcImageInfo.width = 1; srcImageInfo.width < 13;
|
||||||
|
srcImageInfo.width++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 80 : 0;
|
size_t rowPadding = gEnablePitch ? 80 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
|
srcImageInfo.height, 0),
|
||||||
|
seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
rowPadding++;
|
rowPadding++;
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch =
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for( imageInfo.height = 1; imageInfo.height < 9; imageInfo.height++ )
|
for (srcImageInfo.height = 1; srcImageInfo.height < 9;
|
||||||
|
srcImageInfo.height++)
|
||||||
{
|
{
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch * (imageInfo.height + slicePadding);
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch
|
||||||
|
* (srcImageInfo.height + slicePadding);
|
||||||
|
|
||||||
for( imageInfo.arraySize = 2; imageInfo.arraySize < 9; imageInfo.arraySize++ )
|
for (srcImageInfo.arraySize = 2; srcImageInfo.arraySize < 9;
|
||||||
|
srcImageInfo.arraySize++)
|
||||||
{
|
{
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at size %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.arraySize );
|
log_info(" at size %d,%d,%d\n",
|
||||||
int ret = test_copy_image_2D_array( context, queue, &imageInfo, seed );
|
(int)srcImageInfo.width,
|
||||||
|
(int)srcImageInfo.height,
|
||||||
|
(int)srcImageInfo.arraySize);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
int ret = test_copy_image_2D_array(
|
||||||
|
context, queue, &srcImageInfo, &dstImageInfo, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -114,34 +154,46 @@ int test_copy_image_set_2D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
// Try a specific set of maximum sizes
|
// Try a specific set of maximum sizes
|
||||||
size_t numbeOfSizes;
|
size_t numbeOfSizes;
|
||||||
size_t sizes[100][3];
|
size_t sizes[100][3];
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, maxHeight, 1, maxArraySize, maxAllocSize, memSize, imageInfo.type, imageInfo.format);
|
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, maxHeight, 1,
|
||||||
|
maxArraySize, maxAllocSize, memSize, srcImageInfo.type,
|
||||||
|
srcImageInfo.format);
|
||||||
|
|
||||||
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 80 : 0;
|
size_t rowPadding = gEnablePitch ? 80 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
imageInfo.width = sizes[ idx ][ 0 ];
|
srcImageInfo.width = sizes[idx][0];
|
||||||
imageInfo.height = sizes[ idx ][ 1 ];
|
srcImageInfo.height = sizes[idx][1];
|
||||||
imageInfo.arraySize = sizes[ idx ][ 2 ];
|
srcImageInfo.arraySize = sizes[idx][2];
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
|
srcImageInfo.height, 0),
|
||||||
|
seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
rowPadding++;
|
rowPadding++;
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch =
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch * (imageInfo.height + slicePadding);
|
srcImageInfo.slicePitch =
|
||||||
|
srcImageInfo.rowPitch * (srcImageInfo.height + slicePadding);
|
||||||
log_info( "Testing %d x %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
log_info( "Testing %d x %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at max size %d,%d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
log_info( " at max size %d,%d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
||||||
if( test_copy_image_2D_array( context, queue, &imageInfo, seed ) )
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
if (test_copy_image_2D_array(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,38 +208,61 @@ int test_copy_image_set_2D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
imageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
srcImageInfo.width =
|
||||||
imageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
imageInfo.arraySize = (size_t)random_log_in_range( 16, (int)maxArraySize / 32, seed );
|
srcImageInfo.height =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxHeight / 32, seed);
|
||||||
|
srcImageInfo.arraySize = (size_t)random_log_in_range(
|
||||||
|
16, (int)maxArraySize / 32, seed);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, 0), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
imageInfo.rowPitch = imageInfo.width * get_pixel_size( imageInfo.format );
|
2,
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch * imageInfo.height;
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
size = compute_mipmapped_image_size( imageInfo );
|
srcImageInfo.height, 0),
|
||||||
|
seed);
|
||||||
|
srcImageInfo.rowPitch = srcImageInfo.width
|
||||||
|
* get_pixel_size(srcImageInfo.format);
|
||||||
|
srcImageInfo.slicePitch =
|
||||||
|
srcImageInfo.rowPitch * srcImageInfo.height;
|
||||||
|
size = compute_mipmapped_image_size(srcImageInfo);
|
||||||
size = size*4;
|
size = size*4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch =
|
||||||
if (gEnablePitch)
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
{
|
if (gEnablePitch)
|
||||||
do {
|
{
|
||||||
rowPadding++;
|
do
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
{
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
rowPadding++;
|
||||||
}
|
srcImageInfo.rowPitch =
|
||||||
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch * (imageInfo.height + slicePadding);
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch
|
||||||
|
* (srcImageInfo.height + slicePadding);
|
||||||
|
|
||||||
size = (cl_ulong)imageInfo.slicePitch * (cl_ulong)imageInfo.arraySize * 4 * 4;
|
size = (cl_ulong)srcImageInfo.slicePitch
|
||||||
|
* (cl_ulong)srcImageInfo.arraySize * 4 * 4;
|
||||||
}
|
}
|
||||||
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
||||||
|
|
||||||
if( gDebugTrace )
|
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 );
|
log_info(" at size %d,%d,%d (pitch %d,%d) out of %d,%d,%d\n",
|
||||||
int ret = test_copy_image_2D_array( context, queue, &imageInfo,seed );
|
(int)srcImageInfo.width, (int)srcImageInfo.height,
|
||||||
|
(int)srcImageInfo.arraySize,
|
||||||
|
(int)srcImageInfo.rowPitch,
|
||||||
|
(int)srcImageInfo.slicePitch, (int)maxWidth,
|
||||||
|
(int)maxHeight, (int)maxArraySize);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
int ret = test_copy_image_2D_array(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,34 +19,49 @@
|
|||||||
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
|
||||||
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
|
||||||
|
|
||||||
int test_copy_image_3D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d )
|
int test_copy_image_3D(cl_context context, cl_command_queue queue,
|
||||||
|
image_descriptor *srcImageInfo,
|
||||||
|
image_descriptor *dstImageInfo, MTdata d)
|
||||||
{
|
{
|
||||||
size_t origin[] = { 0, 0, 0, 0};
|
size_t origin[] = { 0, 0, 0, 0};
|
||||||
size_t region[] = { imageInfo->width, imageInfo->height, imageInfo->depth };
|
size_t region[] = { srcImageInfo->width, srcImageInfo->height,
|
||||||
|
srcImageInfo->depth };
|
||||||
|
|
||||||
if( gTestMipmaps )
|
if( gTestMipmaps )
|
||||||
{
|
{
|
||||||
size_t lod = (imageInfo->num_mip_levels > 1 )? (size_t)random_in_range( 0, imageInfo->num_mip_levels - 1, d ) : 0 ;
|
size_t lod = (srcImageInfo->num_mip_levels > 1)
|
||||||
|
? (size_t)random_in_range(0, srcImageInfo->num_mip_levels - 1, d)
|
||||||
|
: 0;
|
||||||
origin[ 3 ] = lod;
|
origin[ 3 ] = lod;
|
||||||
region[ 0 ] = ( imageInfo->width >> lod ) ? ( imageInfo->width >> lod ) : 1;
|
region[0] =
|
||||||
region[ 1 ] = ( imageInfo->height >> lod ) ? ( imageInfo->height >> lod ) : 1;
|
(srcImageInfo->width >> lod) ? (srcImageInfo->width >> lod) : 1;
|
||||||
region[ 2 ] = ( imageInfo->depth >> lod ) ? ( imageInfo->depth >> lod ) : 1;
|
region[1] =
|
||||||
|
(srcImageInfo->height >> lod) ? (srcImageInfo->height >> lod) : 1;
|
||||||
|
region[2] =
|
||||||
|
(srcImageInfo->depth >> lod) ? (srcImageInfo->depth >> lod) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return test_copy_image_generic( context, queue, imageInfo, imageInfo, origin, origin, region, d );
|
return test_copy_image_generic(context, queue, srcImageInfo, dstImageInfo,
|
||||||
|
origin, origin, region, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_copy_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format )
|
int test_copy_image_set_3D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
|
cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format)
|
||||||
{
|
{
|
||||||
|
assert(dst_type == src_type); // This test expects to copy 3D -> 3D images
|
||||||
size_t maxWidth, maxHeight, maxDepth;
|
size_t maxWidth, maxHeight, maxDepth;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor imageInfo = { 0 };
|
image_descriptor srcImageInfo = { 0 };
|
||||||
|
image_descriptor dstImageInfo = { 0 };
|
||||||
RandomSeed seed( gRandomSeed );
|
RandomSeed seed( gRandomSeed );
|
||||||
size_t pixelSize;
|
size_t pixelSize;
|
||||||
|
|
||||||
imageInfo.format = format;
|
srcImageInfo.format = format;
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
srcImageInfo.type = src_type;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
srcImageInfo.mem_flags = src_flags;
|
||||||
|
pixelSize = get_pixel_size(srcImageInfo.format);
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||||
@@ -62,32 +77,48 @@ int test_copy_image_set_3D( cl_device_id device, cl_context context, cl_command_
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++ )
|
for (srcImageInfo.width = 1; srcImageInfo.width < 13;
|
||||||
|
srcImageInfo.width++)
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 80 : 0;
|
size_t rowPadding = gEnablePitch ? 80 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, imageInfo.depth), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
|
srcImageInfo.height,
|
||||||
|
srcImageInfo.depth),
|
||||||
|
seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
rowPadding++;
|
rowPadding++;
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch =
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for( imageInfo.height = 1; imageInfo.height < 9; imageInfo.height++ )
|
for (srcImageInfo.height = 1; srcImageInfo.height < 9;
|
||||||
|
srcImageInfo.height++)
|
||||||
{
|
{
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch * (imageInfo.height + slicePadding);
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch
|
||||||
for( imageInfo.depth = 2; imageInfo.depth < 9; imageInfo.depth++ )
|
* (srcImageInfo.height + slicePadding);
|
||||||
|
for (srcImageInfo.depth = 2; srcImageInfo.depth < 9;
|
||||||
|
srcImageInfo.depth++)
|
||||||
{
|
{
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at size %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.depth );
|
log_info(
|
||||||
int ret = test_copy_image_3D( context, queue, &imageInfo, seed );
|
" at size %d,%d,%d\n", (int)srcImageInfo.width,
|
||||||
|
(int)srcImageInfo.height, (int)srcImageInfo.depth);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
int ret = test_copy_image_3D(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -99,34 +130,47 @@ int test_copy_image_set_3D( cl_device_id device, cl_context context, cl_command_
|
|||||||
// Try a specific set of maximum sizes
|
// Try a specific set of maximum sizes
|
||||||
size_t numbeOfSizes;
|
size_t numbeOfSizes;
|
||||||
size_t sizes[100][3];
|
size_t sizes[100][3];
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, maxHeight, maxDepth, 1, maxAllocSize, memSize, imageInfo.type, imageInfo.format);
|
get_max_sizes(&numbeOfSizes, 100, sizes, maxWidth, maxHeight, maxDepth,
|
||||||
|
1, maxAllocSize, memSize, srcImageInfo.type,
|
||||||
|
srcImageInfo.format);
|
||||||
|
|
||||||
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
||||||
{
|
{
|
||||||
size_t rowPadding = gEnablePitch ? 80 : 0;
|
size_t rowPadding = gEnablePitch ? 80 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
imageInfo.width = sizes[ idx ][ 0 ];
|
srcImageInfo.width = sizes[idx][0];
|
||||||
imageInfo.height = sizes[ idx ][ 1 ];
|
srcImageInfo.height = sizes[idx][1];
|
||||||
imageInfo.depth = sizes[ idx ][ 2 ];
|
srcImageInfo.depth = sizes[idx][2];
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch = srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, imageInfo.depth), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
|
srcImageInfo.height,
|
||||||
|
srcImageInfo.depth),
|
||||||
|
seed);
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
rowPadding++;
|
rowPadding++;
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch =
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch * (imageInfo.height + slicePadding);
|
srcImageInfo.slicePitch =
|
||||||
|
srcImageInfo.rowPitch * (srcImageInfo.height + slicePadding);
|
||||||
log_info( "Testing %d x %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
log_info( "Testing %d x %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
log_info( " at max size %d,%d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
log_info( " at max size %d,%d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] );
|
||||||
if( test_copy_image_3D( context, queue, &imageInfo, seed ) )
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
if (test_copy_image_3D(context, queue, &srcImageInfo, &dstImageInfo,
|
||||||
|
seed))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,39 +186,62 @@ int test_copy_image_set_3D( cl_device_id device, cl_context context, cl_command_
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
imageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
srcImageInfo.width =
|
||||||
imageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
imageInfo.depth = (size_t)random_log_in_range( 16, (int)maxDepth / 32,seed );
|
srcImageInfo.height =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxHeight / 32, seed);
|
||||||
|
srcImageInfo.depth =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxDepth / 32, seed);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
imageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(imageInfo.width, imageInfo.height, imageInfo.depth), seed);
|
srcImageInfo.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
imageInfo.rowPitch = imageInfo.width * get_pixel_size( imageInfo.format );
|
2,
|
||||||
imageInfo.slicePitch = imageInfo.height * imageInfo.rowPitch;
|
(int)compute_max_mip_levels(srcImageInfo.width,
|
||||||
size = compute_mipmapped_image_size( imageInfo );
|
srcImageInfo.height,
|
||||||
|
srcImageInfo.depth),
|
||||||
|
seed);
|
||||||
|
srcImageInfo.rowPitch = srcImageInfo.width
|
||||||
|
* get_pixel_size(srcImageInfo.format);
|
||||||
|
srcImageInfo.slicePitch =
|
||||||
|
srcImageInfo.height * srcImageInfo.rowPitch;
|
||||||
|
size = compute_mipmapped_image_size(srcImageInfo);
|
||||||
size = size*4;
|
size = size*4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
srcImageInfo.rowPitch =
|
||||||
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
|
||||||
if (gEnablePitch)
|
if (gEnablePitch)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
rowPadding++;
|
{
|
||||||
imageInfo.rowPitch = imageInfo.width * pixelSize + rowPadding;
|
rowPadding++;
|
||||||
} while ((imageInfo.rowPitch % pixelSize) != 0);
|
srcImageInfo.rowPitch =
|
||||||
}
|
srcImageInfo.width * pixelSize + rowPadding;
|
||||||
|
} while ((srcImageInfo.rowPitch % pixelSize) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
imageInfo.slicePitch = imageInfo.rowPitch * (imageInfo.height + slicePadding);
|
srcImageInfo.slicePitch = srcImageInfo.rowPitch
|
||||||
|
* (srcImageInfo.height + slicePadding);
|
||||||
|
|
||||||
size = (cl_ulong)imageInfo.slicePitch * (cl_ulong)imageInfo.depth * 4 * 4;
|
size = (cl_ulong)srcImageInfo.slicePitch
|
||||||
|
* (cl_ulong)srcImageInfo.depth * 4 * 4;
|
||||||
}
|
}
|
||||||
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
||||||
|
|
||||||
if( gDebugTrace )
|
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 );
|
log_info(" at size %d,%d,%d (pitch %d,%d) out of %d,%d,%d\n",
|
||||||
int ret = test_copy_image_3D( context, queue, &imageInfo,seed );
|
(int)srcImageInfo.width, (int)srcImageInfo.height,
|
||||||
|
(int)srcImageInfo.depth, (int)srcImageInfo.rowPitch,
|
||||||
|
(int)srcImageInfo.slicePitch, (int)maxWidth,
|
||||||
|
(int)maxHeight, (int)maxDepth);
|
||||||
|
|
||||||
|
dstImageInfo = srcImageInfo;
|
||||||
|
dstImageInfo.mem_flags = dst_flags;
|
||||||
|
int ret = test_copy_image_3D(context, queue, &srcImageInfo,
|
||||||
|
&dstImageInfo, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,12 +37,8 @@ static void set_image_dimensions( image_descriptor *imageInfo, size_t width, siz
|
|||||||
} while ((imageInfo->rowPitch % pixelSize) != 0);
|
} while ((imageInfo->rowPitch % pixelSize) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
imageInfo->slicePitch = imageInfo->rowPitch * (imageInfo->height + slicePadding);
|
imageInfo->slicePitch =
|
||||||
|
imageInfo->rowPitch * (imageInfo->height + slicePadding);
|
||||||
if (arraySize == 0)
|
|
||||||
imageInfo->type = CL_MEM_OBJECT_IMAGE3D;
|
|
||||||
else
|
|
||||||
imageInfo->type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -227,17 +223,33 @@ int test_copy_image_size_3D_2D_array( cl_context context, cl_command_queue queue
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_copy_image_set_3D_2D_array(cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse = false )
|
int test_copy_image_set_3D_2D_array(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format)
|
||||||
{
|
{
|
||||||
size_t maxWidth, maxHeight, max3DWidth, max3DHeight, maxDepth, maxArraySize;
|
size_t maxWidth, maxHeight, max3DWidth, max3DHeight, maxDepth, maxArraySize;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
image_descriptor srcImageInfo = { 0 };
|
const bool reverse = (src_type == CL_MEM_OBJECT_IMAGE2D_ARRAY);
|
||||||
image_descriptor dstImageInfo = { 0 };
|
image_descriptor imageInfo3D = { 0 };
|
||||||
|
image_descriptor imageInfo2Darray = { 0 };
|
||||||
RandomSeed seed( gRandomSeed );
|
RandomSeed seed( gRandomSeed );
|
||||||
size_t rowPadding = gEnablePitch ? 256 : 0;
|
size_t rowPadding = gEnablePitch ? 256 : 0;
|
||||||
size_t slicePadding = gEnablePitch ? 3 : 0;
|
size_t slicePadding = gEnablePitch ? 3 : 0;
|
||||||
|
|
||||||
srcImageInfo.format = dstImageInfo.format = format;
|
imageInfo3D.format = imageInfo2Darray.format = format;
|
||||||
|
imageInfo3D.type = CL_MEM_OBJECT_IMAGE3D;
|
||||||
|
imageInfo2Darray.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
imageInfo2Darray.mem_flags = src_flags;
|
||||||
|
imageInfo3D.mem_flags = dst_flags;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imageInfo3D.mem_flags = src_flags;
|
||||||
|
imageInfo2Darray.mem_flags = dst_flags;
|
||||||
|
}
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||||
@@ -256,39 +268,79 @@ int test_copy_image_set_3D_2D_array(cl_device_id device, cl_context context, cl_
|
|||||||
|
|
||||||
if( gTestSmallImages )
|
if( gTestSmallImages )
|
||||||
{
|
{
|
||||||
for( dstImageInfo.width = 4; dstImageInfo.width < 17; dstImageInfo.width++ )
|
for (imageInfo2Darray.width = 4; imageInfo2Darray.width < 17;
|
||||||
|
imageInfo2Darray.width++)
|
||||||
{
|
{
|
||||||
for( dstImageInfo.height = 4; dstImageInfo.height < 13; dstImageInfo.height++ )
|
for (imageInfo2Darray.height = 4; imageInfo2Darray.height < 13;
|
||||||
|
imageInfo2Darray.height++)
|
||||||
{
|
{
|
||||||
for( dstImageInfo.arraySize = 4; dstImageInfo.arraySize < 9; dstImageInfo.arraySize++ )
|
for (imageInfo2Darray.arraySize = 4;
|
||||||
|
imageInfo2Darray.arraySize < 9;
|
||||||
|
imageInfo2Darray.arraySize++)
|
||||||
{
|
{
|
||||||
set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, 0, dstImageInfo.arraySize, rowPadding, slicePadding );
|
set_image_dimensions(
|
||||||
set_image_dimensions( &srcImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.arraySize, 0, rowPadding, slicePadding );
|
&imageInfo2Darray, imageInfo2Darray.width,
|
||||||
|
imageInfo2Darray.height, 0, imageInfo2Darray.arraySize,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
set_image_dimensions(&imageInfo3D, imageInfo2Darray.width,
|
||||||
|
imageInfo2Darray.height,
|
||||||
|
imageInfo2Darray.arraySize, 0,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
imageInfo2Darray.num_mip_levels =
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
|
(cl_uint)random_log_in_range(
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
2,
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, srcImageInfo.depth), seed);
|
(int)compute_max_mip_levels(
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
imageInfo2Darray.width,
|
||||||
srcImageInfo.slicePitch = srcImageInfo.rowPitch * srcImageInfo.height;
|
imageInfo2Darray.height, 0),
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
seed);
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
imageInfo3D.num_mip_levels =
|
||||||
|
(cl_uint)random_log_in_range(
|
||||||
|
2,
|
||||||
|
(int)compute_max_mip_levels(imageInfo3D.width,
|
||||||
|
imageInfo3D.height,
|
||||||
|
imageInfo3D.depth),
|
||||||
|
seed);
|
||||||
|
imageInfo3D.rowPitch = imageInfo3D.width
|
||||||
|
* get_pixel_size(imageInfo3D.format);
|
||||||
|
imageInfo3D.slicePitch =
|
||||||
|
imageInfo3D.rowPitch * imageInfo3D.height;
|
||||||
|
imageInfo2Darray.rowPitch = imageInfo2Darray.width
|
||||||
|
* get_pixel_size(imageInfo2Darray.format);
|
||||||
|
imageInfo2Darray.slicePitch =
|
||||||
|
imageInfo2Darray.rowPitch * imageInfo2Darray.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( " at size %d,%d,%d to %d,%d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth );
|
log_info(" at size %d,%d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo3D.width,
|
||||||
|
(int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
else
|
else
|
||||||
log_info( " at size %d,%d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info(" at size %d,%d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo3D.width,
|
||||||
|
(int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_3D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_3D_2D_array(
|
||||||
|
context, queue, &imageInfo2Darray, &imageInfo3D,
|
||||||
|
seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_3D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_3D_2D_array(
|
||||||
|
context, queue, &imageInfo3D, &imageInfo2Darray,
|
||||||
|
seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -303,62 +355,115 @@ int test_copy_image_set_3D_2D_array(cl_device_id device, cl_context context, cl_
|
|||||||
size_t sizes2Darray[100][3];
|
size_t sizes2Darray[100][3];
|
||||||
|
|
||||||
// Try to allocate a bit smaller images because we need the 3D ones as well for the copy.
|
// Try to allocate a bit smaller images because we need the 3D ones as well for the copy.
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes2Darray, maxWidth, maxHeight, maxDepth, maxArraySize, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE2D_ARRAY, srcImageInfo.format);
|
get_max_sizes(&numbeOfSizes, 100, sizes2Darray, maxWidth, maxHeight,
|
||||||
get_max_sizes(&numbeOfSizes, 100, sizes3D, max3DWidth, max3DHeight, maxDepth, maxArraySize, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE3D, dstImageInfo.format);
|
maxDepth, maxArraySize, maxAllocSize / 2, memSize / 2,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D_ARRAY, imageInfo3D.format);
|
||||||
|
get_max_sizes(&numbeOfSizes, 100, sizes3D, max3DWidth, max3DHeight,
|
||||||
|
maxDepth, maxArraySize, maxAllocSize / 2, memSize / 2,
|
||||||
|
CL_MEM_OBJECT_IMAGE3D, imageInfo2Darray.format);
|
||||||
|
|
||||||
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
||||||
{
|
{
|
||||||
set_image_dimensions( &srcImageInfo, sizes3D[ idx ][ 0 ], sizes3D[ idx ][ 1 ], sizes3D[ idx ][ 2 ], 0, rowPadding, slicePadding );
|
set_image_dimensions(&imageInfo3D, sizes3D[idx][0], sizes3D[idx][1],
|
||||||
set_image_dimensions( &dstImageInfo, sizes2Darray[ idx ][ 0 ], sizes2Darray[ idx ][ 1 ], 0, sizes2Darray[ idx ][ 2 ], rowPadding, slicePadding );
|
sizes3D[idx][2], 0, rowPadding, slicePadding);
|
||||||
|
set_image_dimensions(&imageInfo2Darray, sizes2Darray[idx][0],
|
||||||
|
sizes2Darray[idx][1], 0, sizes2Darray[idx][2],
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
|
||||||
cl_ulong dstSize = (cl_ulong)dstImageInfo.slicePitch * (cl_ulong)dstImageInfo.arraySize;
|
cl_ulong dstSize = (cl_ulong)imageInfo2Darray.slicePitch
|
||||||
cl_ulong srcSize = (cl_ulong)srcImageInfo.slicePitch * (cl_ulong)srcImageInfo.depth;
|
* (cl_ulong)imageInfo2Darray.arraySize;
|
||||||
|
cl_ulong srcSize =
|
||||||
|
(cl_ulong)imageInfo3D.slicePitch * (cl_ulong)imageInfo3D.depth;
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
imageInfo2Darray.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
|
2,
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
(int)compute_max_mip_levels(imageInfo2Darray.width,
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, srcImageInfo.depth), seed);
|
imageInfo2Darray.height, 0),
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
seed);
|
||||||
srcImageInfo.slicePitch = srcImageInfo.rowPitch * srcImageInfo.height;
|
imageInfo3D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
2,
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
(int)compute_max_mip_levels(imageInfo3D.width,
|
||||||
srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
|
imageInfo3D.height,
|
||||||
dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
|
imageInfo3D.depth),
|
||||||
|
seed);
|
||||||
|
imageInfo3D.rowPitch =
|
||||||
|
imageInfo3D.width * get_pixel_size(imageInfo3D.format);
|
||||||
|
imageInfo3D.slicePitch =
|
||||||
|
imageInfo3D.rowPitch * imageInfo3D.height;
|
||||||
|
imageInfo2Darray.rowPitch = imageInfo2Darray.width
|
||||||
|
* get_pixel_size(imageInfo2Darray.format);
|
||||||
|
imageInfo2Darray.slicePitch =
|
||||||
|
imageInfo2Darray.rowPitch * imageInfo2Darray.height;
|
||||||
|
srcSize = 4 * compute_mipmapped_image_size(imageInfo3D);
|
||||||
|
dstSize = 4 * compute_mipmapped_image_size(imageInfo2Darray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) ) &&
|
if ( ( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) ) &&
|
||||||
( srcSize < maxAllocSize && srcSize < ( memSize / 3 ) ) )
|
( srcSize < maxAllocSize && srcSize < ( memSize / 3 ) ) )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( "Testing %d x %d x %d to %d x %d x %d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth );
|
log_info("Testing %d x %d x %d to %d x %d x %d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
else
|
else
|
||||||
log_info( "Testing %d x %d x %d to %d x %d x %d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info("Testing %d x %d x %d to %d x %d x %d\n",
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( " at max size %d,%d,%d to %d,%d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth );
|
log_info(" at max size %d,%d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo3D.width,
|
||||||
|
(int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
else
|
else
|
||||||
log_info( " at max size %d,%d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info(
|
||||||
|
" at max size %d,%d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth, (int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_3D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_3D_2D_array(
|
||||||
|
context, queue, &imageInfo2Darray, &imageInfo3D, seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_3D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_3D_2D_array(
|
||||||
|
context, queue, &imageInfo3D, &imageInfo2Darray, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info("Not testing max size %d x %d x %d x %d to %d x %d due to memory constraints.\n",
|
log_info("Not testing max size %d x %d x %d x %d to %d x "
|
||||||
(int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth);
|
"%d due to memory constraints.\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
else
|
else
|
||||||
log_info("Not testing max size %d x %d x %d to %d x %d x %d due to memory constraints.\n",
|
log_info("Not testing max size %d x %d x %d to %d x %d x "
|
||||||
(int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize);
|
"%d due to memory constraints.\n",
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -372,48 +477,87 @@ int test_copy_image_set_3D_2D_array(cl_device_id device, cl_context context, cl_
|
|||||||
// image, the result array, plus offset arrays, will fit in the global ram space
|
// image, the result array, plus offset arrays, will fit in the global ram space
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
dstImageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
|
imageInfo2Darray.width =
|
||||||
dstImageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxWidth / 32, seed);
|
||||||
dstImageInfo.arraySize = (size_t)random_log_in_range( 16, (int)maxArraySize / 32, seed );
|
imageInfo2Darray.height =
|
||||||
srcImageInfo.width = (size_t)random_log_in_range( 16, (int)max3DWidth / 32, seed );
|
(size_t)random_log_in_range(16, (int)maxHeight / 32, seed);
|
||||||
srcImageInfo.height = (size_t)random_log_in_range( 16, (int)max3DHeight / 32, seed );
|
imageInfo2Darray.arraySize = (size_t)random_log_in_range(
|
||||||
srcImageInfo.depth = (size_t)random_log_in_range( 16, (int)maxDepth / 32, seed );
|
16, (int)maxArraySize / 32, seed);
|
||||||
|
imageInfo3D.width =
|
||||||
|
(size_t)random_log_in_range(16, (int)max3DWidth / 32, seed);
|
||||||
|
imageInfo3D.height = (size_t)random_log_in_range(
|
||||||
|
16, (int)max3DHeight / 32, seed);
|
||||||
|
imageInfo3D.depth =
|
||||||
|
(size_t)random_log_in_range(16, (int)maxDepth / 128, seed);
|
||||||
|
|
||||||
if (gTestMipmaps)
|
if (gTestMipmaps)
|
||||||
{
|
{
|
||||||
dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
imageInfo2Darray.num_mip_levels =
|
||||||
dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
|
(cl_uint)random_log_in_range(
|
||||||
srcImageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
2,
|
||||||
srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, srcImageInfo.depth), seed);
|
(int)compute_max_mip_levels(imageInfo2Darray.width,
|
||||||
srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
|
imageInfo2Darray.height,
|
||||||
srcImageInfo.slicePitch = srcImageInfo.rowPitch * srcImageInfo.height;
|
0),
|
||||||
dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
|
seed);
|
||||||
dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
|
imageInfo3D.num_mip_levels = (cl_uint)random_log_in_range(
|
||||||
srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
|
2,
|
||||||
dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
|
(int)compute_max_mip_levels(imageInfo3D.width,
|
||||||
|
imageInfo3D.height,
|
||||||
|
imageInfo3D.depth),
|
||||||
|
seed);
|
||||||
|
imageInfo3D.rowPitch =
|
||||||
|
imageInfo3D.width * get_pixel_size(imageInfo3D.format);
|
||||||
|
imageInfo3D.slicePitch =
|
||||||
|
imageInfo3D.rowPitch * imageInfo3D.height;
|
||||||
|
imageInfo2Darray.rowPitch = imageInfo2Darray.width
|
||||||
|
* get_pixel_size(imageInfo2Darray.format);
|
||||||
|
imageInfo2Darray.slicePitch =
|
||||||
|
imageInfo2Darray.rowPitch * imageInfo2Darray.height;
|
||||||
|
srcSize = 4 * compute_mipmapped_image_size(imageInfo3D);
|
||||||
|
dstSize =
|
||||||
|
4 * compute_mipmapped_image_size(imageInfo2Darray);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_image_dimensions( &srcImageInfo, srcImageInfo.width, srcImageInfo.height, srcImageInfo.depth, 0, rowPadding, slicePadding );
|
set_image_dimensions(&imageInfo3D, imageInfo3D.width,
|
||||||
set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, 0, dstImageInfo.arraySize, rowPadding, slicePadding );
|
imageInfo3D.height, imageInfo3D.depth,
|
||||||
|
0, rowPadding, slicePadding);
|
||||||
|
set_image_dimensions(
|
||||||
|
&imageInfo2Darray, imageInfo2Darray.width,
|
||||||
|
imageInfo2Darray.height, 0, imageInfo2Darray.arraySize,
|
||||||
|
rowPadding, slicePadding);
|
||||||
|
|
||||||
srcSize = (cl_ulong)srcImageInfo.slicePitch * (cl_ulong)srcImageInfo.depth * 4;
|
srcSize = (cl_ulong)imageInfo3D.slicePitch
|
||||||
dstSize = (cl_ulong)dstImageInfo.slicePitch * (cl_ulong)dstImageInfo.arraySize * 4;
|
* (cl_ulong)imageInfo3D.depth * 4;
|
||||||
|
dstSize = (cl_ulong)imageInfo2Darray.slicePitch
|
||||||
|
* (cl_ulong)imageInfo2Darray.arraySize * 4;
|
||||||
}
|
}
|
||||||
} while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
|
} while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
|
||||||
|
|
||||||
if( gDebugTrace )
|
if( gDebugTrace )
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (reverse)
|
||||||
log_info( " at size %d,%d,%d to %d,%d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth );
|
log_info(" at size %d,%d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize,
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth);
|
||||||
else
|
else
|
||||||
log_info( " at size %d,%d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)srcImageInfo.depth, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
|
log_info(" at size %d,%d,%d to %d,%d,%d\n",
|
||||||
|
(int)imageInfo3D.width, (int)imageInfo3D.height,
|
||||||
|
(int)imageInfo3D.depth,
|
||||||
|
(int)imageInfo2Darray.width,
|
||||||
|
(int)imageInfo2Darray.height,
|
||||||
|
(int)imageInfo2Darray.arraySize);
|
||||||
}
|
}
|
||||||
int ret;
|
int ret;
|
||||||
if( reverse )
|
if( reverse )
|
||||||
ret = test_copy_image_size_3D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
|
ret = test_copy_image_size_3D_2D_array(
|
||||||
|
context, queue, &imageInfo2Darray, &imageInfo3D, seed);
|
||||||
else
|
else
|
||||||
ret = test_copy_image_size_3D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
|
ret = test_copy_image_size_3D_2D_array(
|
||||||
|
context, queue, &imageInfo3D, &imageInfo2Darray, seed);
|
||||||
if( ret )
|
if( ret )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,32 +15,77 @@
|
|||||||
//
|
//
|
||||||
#include "../testBase.h"
|
#include "../testBase.h"
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
extern int test_copy_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
extern int
|
||||||
extern int test_copy_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
test_copy_image_set_1D(cl_device_id device, cl_context context,
|
||||||
extern int test_copy_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
extern int test_copy_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
extern int test_copy_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format );
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
extern int test_copy_image_set_2D_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse );
|
extern int
|
||||||
extern int test_copy_image_set_2D_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse );
|
test_copy_image_set_2D(cl_device_id device, cl_context context,
|
||||||
extern int test_copy_image_set_3D_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse );
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
extern int test_copy_image_set_1D_buffer(cl_device_id device,
|
cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
cl_context context,
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
cl_command_queue queue,
|
extern int
|
||||||
cl_image_format *format);
|
test_copy_image_set_3D(cl_device_id device, cl_context context,
|
||||||
extern int test_copy_image_set_1D_1D_buffer(cl_device_id device,
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
cl_context context,
|
cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
cl_command_queue queue,
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
cl_image_format *format);
|
extern int test_copy_image_set_1D_array(
|
||||||
extern int test_copy_image_set_1D_buffer_1D(cl_device_id device,
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
cl_context context,
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
cl_command_queue queue,
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
cl_image_format *format);
|
extern int test_copy_image_set_2D_array(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
|
extern int
|
||||||
|
test_copy_image_set_2D_3D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_mem_flags src_flags,
|
||||||
|
cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
|
extern int test_copy_image_set_2D_2D_array(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
|
extern int test_copy_image_set_3D_2D_array(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
|
extern int test_copy_image_set_1D_buffer(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
|
extern int test_copy_image_set_1D_1D_buffer(
|
||||||
|
cl_device_id device, cl_context context, cl_command_queue queue,
|
||||||
|
cl_mem_flags src_flags, cl_mem_object_type src_type, cl_mem_flags dst_flags,
|
||||||
|
cl_mem_object_type dst_type, cl_image_format *format);
|
||||||
|
|
||||||
int test_image_type( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod, cl_mem_flags flags )
|
using test_function_t = int (*)(cl_device_id, cl_context, cl_command_queue,
|
||||||
|
cl_mem_flags, cl_mem_object_type, cl_mem_flags,
|
||||||
|
cl_mem_object_type, cl_image_format *);
|
||||||
|
|
||||||
|
struct TestConfigs
|
||||||
{
|
{
|
||||||
const char *name = nullptr;
|
const char *name;
|
||||||
cl_mem_object_type imageType = 0;
|
cl_mem_object_type src_type;
|
||||||
|
cl_mem_flags src_flags;
|
||||||
|
cl_mem_object_type dst_type;
|
||||||
|
cl_mem_flags dst_flags;
|
||||||
|
|
||||||
|
TestConfigs(const char *name_, cl_mem_object_type src_type_,
|
||||||
|
cl_mem_flags src_flags_, cl_mem_object_type dst_type_,
|
||||||
|
cl_mem_flags dst_flags_)
|
||||||
|
: name(name_), src_type(src_type_), src_flags(src_flags_),
|
||||||
|
dst_type(dst_type_), dst_flags(dst_flags_)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
int test_image_type(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, MethodsToTest testMethod)
|
||||||
|
{
|
||||||
|
test_function_t test_fn = nullptr;
|
||||||
|
|
||||||
if ( gTestMipmaps )
|
if ( gTestMipmaps )
|
||||||
{
|
{
|
||||||
@@ -49,138 +94,217 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q
|
|||||||
log_info( "-----------------------------------------------------\n" );
|
log_info( "-----------------------------------------------------\n" );
|
||||||
log_info( "This device does not support cl_khr_mipmap_image.\nSkipping mipmapped image test. \n" );
|
log_info( "This device does not support cl_khr_mipmap_image.\nSkipping mipmapped image test. \n" );
|
||||||
log_info( "-----------------------------------------------------\n\n" );
|
log_info( "-----------------------------------------------------\n\n" );
|
||||||
return 0;
|
return TEST_SKIPPED_ITSELF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<TestConfigs> test_configs;
|
||||||
switch (testMethod)
|
switch (testMethod)
|
||||||
{
|
{
|
||||||
case k1D:
|
case k1D:
|
||||||
name = "1D -> 1D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE1D;
|
"1D -> 1D", CL_MEM_OBJECT_IMAGE1D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE1D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_1D;
|
||||||
break;
|
break;
|
||||||
case k2D:
|
case k2D:
|
||||||
name = "2D -> 2D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE2D;
|
"2D -> 2D", CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_2D;
|
||||||
break;
|
break;
|
||||||
case k3D:
|
case k3D:
|
||||||
name = "3D -> 3D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE3D;
|
"3D -> 3D", CL_MEM_OBJECT_IMAGE3D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE3D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_3D;
|
||||||
break;
|
break;
|
||||||
case k1DArray:
|
case k1DArray:
|
||||||
name = "1D array -> 1D array";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE1D_ARRAY;
|
"1D array -> 1D array", CL_MEM_OBJECT_IMAGE1D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE1D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_1D_array;
|
||||||
break;
|
break;
|
||||||
case k2DArray:
|
case k2DArray:
|
||||||
name = "2D array -> 2D array";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
"2D array -> 2D array", CL_MEM_OBJECT_IMAGE2D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_2D_array;
|
||||||
break;
|
break;
|
||||||
case k2DTo3D:
|
case k2DTo3D:
|
||||||
name = "2D -> 3D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE3D;
|
"2D -> 3D", CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE3D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_2D_3D;
|
||||||
break;
|
break;
|
||||||
case k3DTo2D:
|
case k3DTo2D:
|
||||||
name = "3D -> 2D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE3D;
|
"3D -> 2D", CL_MEM_OBJECT_IMAGE3D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_2D_3D;
|
||||||
break;
|
break;
|
||||||
case k2DArrayTo2D:
|
case k2DArrayTo2D:
|
||||||
name = "2D array -> 2D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
"2D array -> 2D", CL_MEM_OBJECT_IMAGE2D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_2D_2D_array;
|
||||||
break;
|
break;
|
||||||
case k2DTo2DArray:
|
case k2DTo2DArray:
|
||||||
name = "2D -> 2D array";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
"2D -> 2D array", CL_MEM_OBJECT_IMAGE2D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_2D_2D_array;
|
||||||
break;
|
break;
|
||||||
case k2DArrayTo3D:
|
case k2DArrayTo3D:
|
||||||
name = "2D array -> 3D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE3D;
|
"2D array -> 3D", CL_MEM_OBJECT_IMAGE2D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE3D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_3D_2D_array;
|
||||||
break;
|
break;
|
||||||
case k3DTo2DArray:
|
case k3DTo2DArray:
|
||||||
name = "3D -> 2D array";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE3D;
|
"3D -> 2D array", CL_MEM_OBJECT_IMAGE3D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE2D_ARRAY,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_3D_2D_array;
|
||||||
break;
|
break;
|
||||||
case k1DBuffer:
|
case k1DBuffer:
|
||||||
name = "1D buffer -> 1D buffer";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
"1D buffer -> 1D buffer", CL_MEM_OBJECT_IMAGE1D_BUFFER,
|
||||||
|
CL_MEM_READ_ONLY, CL_MEM_OBJECT_IMAGE1D_BUFFER,
|
||||||
|
CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_1D_buffer;
|
||||||
break;
|
break;
|
||||||
case k1DTo1DBuffer:
|
case k1DTo1DBuffer:
|
||||||
name = "1D -> 1D buffer";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
"1D -> 1D buffer", CL_MEM_OBJECT_IMAGE1D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY,
|
||||||
|
CL_MEM_OBJECT_IMAGE1D_BUFFER, CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_1D_1D_buffer;
|
||||||
break;
|
break;
|
||||||
case k1DBufferTo1D:
|
case k1DBufferTo1D:
|
||||||
name = "1D buffer -> 1D";
|
test_configs.emplace_back(
|
||||||
imageType = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
"1D buffer -> 1D", CL_MEM_OBJECT_IMAGE1D_BUFFER,
|
||||||
|
CL_MEM_READ_ONLY, CL_MEM_OBJECT_IMAGE1D,
|
||||||
|
gEnablePitch ? CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY
|
||||||
|
: CL_MEM_READ_ONLY);
|
||||||
|
test_fn = test_copy_image_set_1D_1D_buffer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gTestMipmaps)
|
|
||||||
log_info( "Running mipmapped %s tests...\n", name );
|
|
||||||
else
|
|
||||||
log_info( "Running %s tests...\n", name );
|
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
for (const auto &test_config : test_configs)
|
||||||
// Grab the list of supported image formats for integer reads
|
|
||||||
std::vector<cl_image_format> formatList;
|
|
||||||
if (get_format_list(context, imageType, formatList, flags)) return -1;
|
|
||||||
|
|
||||||
std::vector<bool> filterFlags(formatList.size(), false);
|
|
||||||
filter_formats(formatList, filterFlags, nullptr);
|
|
||||||
|
|
||||||
// Run the format list
|
|
||||||
for (unsigned int i = 0; i < formatList.size(); i++)
|
|
||||||
{
|
{
|
||||||
int test_return = 0;
|
if (gTestMipmaps)
|
||||||
if( filterFlags[i] )
|
log_info("Running mipmapped %s tests...\n", test_config.name);
|
||||||
|
else
|
||||||
|
log_info("Running %s tests...\n", test_config.name);
|
||||||
|
|
||||||
|
// Grab the list of supported image formats for integer reads
|
||||||
|
std::vector<cl_image_format> formatList;
|
||||||
{
|
{
|
||||||
continue;
|
std::vector<cl_image_format> srcFormatList;
|
||||||
|
std::vector<cl_image_format> dstFormatList;
|
||||||
|
if (get_format_list(context, test_config.src_type, srcFormatList,
|
||||||
|
test_config.src_flags))
|
||||||
|
return TEST_FAIL;
|
||||||
|
if (get_format_list(context, test_config.dst_type, dstFormatList,
|
||||||
|
test_config.dst_flags))
|
||||||
|
return TEST_FAIL;
|
||||||
|
|
||||||
|
for (auto src_format : srcFormatList)
|
||||||
|
{
|
||||||
|
const bool src_format_in_dst =
|
||||||
|
std::find_if(dstFormatList.begin(), dstFormatList.end(),
|
||||||
|
[src_format](cl_image_format fmt) {
|
||||||
|
return src_format.image_channel_data_type
|
||||||
|
== fmt.image_channel_data_type
|
||||||
|
&& src_format.image_channel_order
|
||||||
|
== fmt.image_channel_order;
|
||||||
|
})
|
||||||
|
!= dstFormatList.end();
|
||||||
|
if (src_format_in_dst)
|
||||||
|
{
|
||||||
|
formatList.push_back(src_format);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print_header( &formatList[ i ], false );
|
std::vector<bool> filterFlags(formatList.size(), false);
|
||||||
|
filter_formats(formatList, filterFlags, nullptr);
|
||||||
|
|
||||||
gTestCount++;
|
// Run the format list
|
||||||
|
for (unsigned int i = 0; i < formatList.size(); i++)
|
||||||
|
{
|
||||||
|
int test_return = 0;
|
||||||
|
if (filterFlags[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( testMethod == k1D )
|
print_header(&formatList[i], false);
|
||||||
test_return = test_copy_image_set_1D( device, context, queue, &formatList[ i ] );
|
|
||||||
else if( testMethod == k2D )
|
|
||||||
test_return = test_copy_image_set_2D( device, context, queue, &formatList[ i ] );
|
|
||||||
else if( testMethod == k3D )
|
|
||||||
test_return = test_copy_image_set_3D( device, context, queue,&formatList[ i ] );
|
|
||||||
else if( testMethod == k1DArray )
|
|
||||||
test_return = test_copy_image_set_1D_array( device, context, queue, &formatList[ i ] );
|
|
||||||
else if( testMethod == k2DArray )
|
|
||||||
test_return = test_copy_image_set_2D_array( device, context, queue, &formatList[ i ] );
|
|
||||||
else if( testMethod == k2DTo3D )
|
|
||||||
test_return = test_copy_image_set_2D_3D( device, context, queue, &formatList[ i ], false );
|
|
||||||
else if( testMethod == k3DTo2D )
|
|
||||||
test_return = test_copy_image_set_2D_3D( device, context, queue, &formatList[ i ], true );
|
|
||||||
else if( testMethod == k2DArrayTo2D)
|
|
||||||
test_return = test_copy_image_set_2D_2D_array( device, context, queue, &formatList[ i ], true);
|
|
||||||
else if( testMethod == k2DTo2DArray)
|
|
||||||
test_return = test_copy_image_set_2D_2D_array( device, context, queue, &formatList[ i ], false);
|
|
||||||
else if( testMethod == k2DArrayTo3D)
|
|
||||||
test_return = test_copy_image_set_3D_2D_array( device, context, queue, &formatList[ i ], true);
|
|
||||||
else if( testMethod == k3DTo2DArray)
|
|
||||||
test_return = test_copy_image_set_3D_2D_array( device, context, queue, &formatList[ i ], false);
|
|
||||||
else if (testMethod == k1DBuffer)
|
|
||||||
test_return = test_copy_image_set_1D_buffer(device, context, queue,
|
|
||||||
&formatList[i]);
|
|
||||||
else if (testMethod == k1DBufferTo1D)
|
|
||||||
test_return = test_copy_image_set_1D_buffer_1D(
|
|
||||||
device, context, queue, &formatList[i]);
|
|
||||||
else if (testMethod == k1DTo1DBuffer)
|
|
||||||
test_return = test_copy_image_set_1D_1D_buffer(
|
|
||||||
device, context, queue, &formatList[i]);
|
|
||||||
|
|
||||||
|
gTestCount++;
|
||||||
|
|
||||||
if (test_return) {
|
test_return = test_fn(device, context, queue, test_config.src_flags,
|
||||||
gFailCount++;
|
test_config.src_type, test_config.dst_flags,
|
||||||
log_error( "FAILED: " );
|
test_config.dst_type, &formatList[i]);
|
||||||
print_header( &formatList[ i ], true );
|
|
||||||
log_info( "\n" );
|
if (test_return)
|
||||||
|
{
|
||||||
|
gFailCount++;
|
||||||
|
log_error("FAILED: ");
|
||||||
|
print_header(&formatList[i], true);
|
||||||
|
log_info("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
ret += test_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += test_return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -188,11 +312,7 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q
|
|||||||
|
|
||||||
int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod )
|
int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
return test_image_type(device, context, queue, testMethod);
|
||||||
|
|
||||||
ret += test_image_type( device, context, queue, testMethod, CL_MEM_READ_ONLY );
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ int test_fill_image_size_1D( cl_context context, cl_command_queue queue, image_d
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_fill_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
int test_fill_image_set_1D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags, ExplicitType outputType)
|
||||||
{
|
{
|
||||||
size_t maxWidth;
|
size_t maxWidth;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
@@ -71,6 +73,7 @@ int test_fill_image_set_1D( cl_device_id device, cl_context context, cl_command_
|
|||||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
imageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
||||||
imageInfo.format = format;
|
imageInfo.format = format;
|
||||||
|
imageInfo.mem_flags = mem_flags;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
pixelSize = get_pixel_size( imageInfo.format );
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ int test_fill_image_size_1D_array( cl_context context, cl_command_queue queue, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_fill_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
int test_fill_image_set_1D_array(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue,
|
||||||
|
cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags,
|
||||||
|
ExplicitType outputType)
|
||||||
{
|
{
|
||||||
size_t maxWidth, maxArraySize;
|
size_t maxWidth, maxArraySize;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
@@ -73,6 +77,7 @@ int test_fill_image_set_1D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_ARRAY;
|
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_ARRAY;
|
||||||
imageInfo.format = format;
|
imageInfo.format = format;
|
||||||
|
imageInfo.mem_flags = mem_flags;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
pixelSize = get_pixel_size( imageInfo.format );
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ int test_fill_image_size_1D_buffer(cl_context context, cl_command_queue queue,
|
|||||||
int test_fill_image_set_1D_buffer(cl_device_id device, cl_context context,
|
int test_fill_image_set_1D_buffer(cl_device_id device, cl_context context,
|
||||||
cl_command_queue queue,
|
cl_command_queue queue,
|
||||||
cl_image_format *format,
|
cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags,
|
||||||
ExplicitType outputType)
|
ExplicitType outputType)
|
||||||
{
|
{
|
||||||
size_t maxWidth;
|
size_t maxWidth;
|
||||||
@@ -84,6 +85,7 @@ int test_fill_image_set_1D_buffer(cl_device_id device, cl_context context,
|
|||||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
||||||
imageInfo.format = format;
|
imageInfo.format = format;
|
||||||
|
imageInfo.mem_flags = mem_flags;
|
||||||
pixelSize = get_pixel_size(imageInfo.format);
|
pixelSize = get_pixel_size(imageInfo.format);
|
||||||
|
|
||||||
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE,
|
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE,
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ int test_fill_image_size_2D( cl_context context, cl_command_queue queue, image_d
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_fill_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
int test_fill_image_set_2D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags, ExplicitType outputType)
|
||||||
{
|
{
|
||||||
size_t maxWidth, maxHeight;
|
size_t maxWidth, maxHeight;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
@@ -73,6 +75,7 @@ int test_fill_image_set_2D( cl_device_id device, cl_context context, cl_command_
|
|||||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
imageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
||||||
imageInfo.format = format;
|
imageInfo.format = format;
|
||||||
|
imageInfo.mem_flags = mem_flags;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
pixelSize = get_pixel_size( imageInfo.format );
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
|
|||||||
@@ -62,7 +62,11 @@ static int test_fill_image_2D_array( cl_context context, cl_command_queue queue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_fill_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, 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,
|
||||||
|
cl_mem_flags mem_flags,
|
||||||
|
ExplicitType outputType)
|
||||||
{
|
{
|
||||||
size_t maxWidth, maxHeight, maxArraySize;
|
size_t maxWidth, maxHeight, maxArraySize;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
@@ -76,6 +80,7 @@ int test_fill_image_set_2D_array( cl_device_id device, cl_context context, cl_co
|
|||||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
imageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
||||||
imageInfo.format = format;
|
imageInfo.format = format;
|
||||||
|
imageInfo.mem_flags = mem_flags;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
pixelSize = get_pixel_size( imageInfo.format );
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
|
|||||||
@@ -62,7 +62,9 @@ int test_fill_image_3D( cl_context context, cl_command_queue queue, image_descri
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_fill_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
int test_fill_image_set_3D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags, ExplicitType outputType)
|
||||||
{
|
{
|
||||||
size_t maxWidth, maxHeight, maxDepth;
|
size_t maxWidth, maxHeight, maxDepth;
|
||||||
cl_ulong maxAllocSize, memSize;
|
cl_ulong maxAllocSize, memSize;
|
||||||
@@ -76,6 +78,7 @@ int test_fill_image_set_3D( cl_device_id device, cl_context context, cl_command_
|
|||||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||||
imageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
imageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
||||||
imageInfo.format = format;
|
imageInfo.format = format;
|
||||||
|
imageInfo.mem_flags = mem_flags;
|
||||||
pixelSize = get_pixel_size( imageInfo.format );
|
pixelSize = get_pixel_size( imageInfo.format );
|
||||||
|
|
||||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||||
|
|||||||
@@ -18,19 +18,38 @@
|
|||||||
|
|
||||||
extern int gTypesToTest;
|
extern int gTypesToTest;
|
||||||
|
|
||||||
extern int test_fill_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
extern int test_fill_image_set_1D(cl_device_id device, cl_context context,
|
||||||
extern int test_fill_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
cl_command_queue queue,
|
||||||
extern int test_fill_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
cl_image_format *format,
|
||||||
extern int test_fill_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
cl_mem_flags mem_flags,
|
||||||
extern int test_fill_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
ExplicitType outputType);
|
||||||
extern int test_fill_image_set_1D_buffer(cl_device_id device,
|
extern int test_fill_image_set_2D(cl_device_id device, cl_context context,
|
||||||
cl_context context,
|
cl_command_queue queue,
|
||||||
cl_command_queue queue,
|
cl_image_format *format,
|
||||||
cl_image_format *format,
|
cl_mem_flags mem_flags,
|
||||||
ExplicitType outputType);
|
ExplicitType outputType);
|
||||||
|
extern int test_fill_image_set_3D(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue,
|
||||||
|
cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags,
|
||||||
|
ExplicitType outputType);
|
||||||
|
extern int test_fill_image_set_1D_array(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue,
|
||||||
|
cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags,
|
||||||
|
ExplicitType outputType);
|
||||||
|
extern int test_fill_image_set_2D_array(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue,
|
||||||
|
cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags,
|
||||||
|
ExplicitType outputType);
|
||||||
|
extern int
|
||||||
|
test_fill_image_set_1D_buffer(cl_device_id device, cl_context context,
|
||||||
|
cl_command_queue queue, cl_image_format *format,
|
||||||
|
cl_mem_flags mem_flags, ExplicitType outputType);
|
||||||
typedef int (*test_func)(cl_device_id device, cl_context context,
|
typedef int (*test_func)(cl_device_id device, cl_context context,
|
||||||
cl_command_queue queue, cl_image_format *format,
|
cl_command_queue queue, cl_image_format *format,
|
||||||
ExplicitType outputType);
|
cl_mem_flags mem_flags, ExplicitType outputType);
|
||||||
|
|
||||||
int test_image_type( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod, cl_mem_flags flags )
|
int test_image_type( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod, cl_mem_flags flags )
|
||||||
{
|
{
|
||||||
@@ -105,7 +124,7 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q
|
|||||||
gTestCount++;
|
gTestCount++;
|
||||||
|
|
||||||
int test_return =
|
int test_return =
|
||||||
test_fn(device, context, queue, &formatList[i],
|
test_fn(device, context, queue, &formatList[i], flags,
|
||||||
test.explicitType);
|
test.explicitType);
|
||||||
if (test_return)
|
if (test_return)
|
||||||
{
|
{
|
||||||
@@ -128,8 +147,12 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q
|
|||||||
int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod )
|
int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||||
ret += test_image_type( device, context, queue, testMethod, CL_MEM_READ_ONLY );
|
if (gEnablePitch && testMethod != k1DBuffer)
|
||||||
|
{
|
||||||
|
flags |= CL_MEM_USE_HOST_PTR;
|
||||||
|
}
|
||||||
|
ret += test_image_type(device, context, queue, testMethod, flags);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,6 @@ clMemWrapper create_image(cl_context context, cl_command_queue queue,
|
|||||||
{
|
{
|
||||||
cl_mem img;
|
cl_mem img;
|
||||||
cl_image_desc imageDesc;
|
cl_image_desc imageDesc;
|
||||||
cl_mem_flags mem_flags = CL_MEM_READ_ONLY;
|
|
||||||
void *host_ptr = nullptr;
|
void *host_ptr = nullptr;
|
||||||
bool is_host_ptr_aligned = false;
|
bool is_host_ptr_aligned = false;
|
||||||
|
|
||||||
@@ -310,21 +309,17 @@ clMemWrapper create_image(cl_context context, cl_command_queue queue,
|
|||||||
imageInfo->depth * imageInfo->slicePitch);
|
imageInfo->depth * imageInfo->slicePitch);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)
|
|
||||||
{
|
|
||||||
mem_flags = CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)
|
if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)
|
||||||
{
|
{
|
||||||
img = clCreateImage(context, mem_flags, imageInfo->format, &imageDesc,
|
img = clCreateImage(context, imageInfo->mem_flags, imageInfo->format,
|
||||||
host_ptr, error);
|
&imageDesc, host_ptr, error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
img = clCreateImage(context, mem_flags, imageInfo->format, &imageDesc,
|
img = clCreateImage(context, imageInfo->mem_flags, imageInfo->format,
|
||||||
nullptr, error);
|
&imageDesc, nullptr, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_pitch)
|
if (enable_pitch)
|
||||||
|
|||||||
Reference in New Issue
Block a user