mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-23 23:49:02 +00:00
Test IMAGE1D_BUFFER in more scenario (#1806)
* cl_copy_images * cl_get_info * cl_fill_image * cl_read_write_image * kernel_image_methods * IMAGE1D_BUFFER cannot be created with (USE_|ALLOC_|COPY_)_HOST_PTR * do not allow mipmap with 1D buffer * adjust M to be within maximum_sizes and max_pixels * remove unused variables * make sure M will never be 0 * fix region[0] after refactoring removing mipmap * fix formatting * format with clang-format-11 * fix image1d_buffer creation with gEnablePitch * add missing case in switch * use align_malloc when CL version is at least 2.0 * use CL_DEVICE_NUMERIC_VERSION and align_free * fix free of pitch buffer * fix formatting * fix formatting * fix data->is_aligned
This commit is contained in:
@@ -19,6 +19,7 @@ int test_get_image_info_single( cl_context context, image_descriptor *imageInfo,
|
||||
{
|
||||
int error;
|
||||
clMemWrapper image;
|
||||
clMemWrapper buffer;
|
||||
cl_image_desc imageDesc;
|
||||
void *host_ptr = NULL;
|
||||
|
||||
@@ -69,6 +70,24 @@ int test_get_image_info_single( cl_context context, image_descriptor *imageInfo,
|
||||
if ( gDebugTrace )
|
||||
log_info( " - Creating 2D image array %d by %d by %d with flags=0x%lx row_pitch=%d slice_pitch=%d host_ptr=%p...\n", (int)imageInfo->width, (int)imageInfo->height, (int)imageInfo->arraySize, (unsigned long)flags, (int)row_pitch, (int)slice_pitch, host_ptr );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
|
||||
if (gDebugTrace)
|
||||
log_info(" - Creating 1D buffer image %d with flags=0x%lx "
|
||||
"row_pitch=%d slice_pitch=%d host_ptr=%p...\n",
|
||||
(int)imageInfo->width, (unsigned long)flags,
|
||||
(int)row_pitch, (int)slice_pitch, host_ptr);
|
||||
int err;
|
||||
buffer = clCreateBuffer(context, flags, imageInfo->rowPitch,
|
||||
host_ptr, &err);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
log_error("ERROR: Unable to create buffer for 1D image buffer "
|
||||
"of size %d (%s)",
|
||||
(int)imageInfo->rowPitch, IGetErrorString(err));
|
||||
return -1;
|
||||
}
|
||||
imageDesc.buffer = imageInfo->buffer = buffer;
|
||||
break;
|
||||
}
|
||||
|
||||
image = clCreateImage(context, flags, imageInfo->format, &imageDesc, host_ptr, &error);
|
||||
@@ -92,6 +111,11 @@ int test_get_image_info_single( cl_context context, image_descriptor *imageInfo,
|
||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||
log_error( "ERROR: Unable to create 2D image array of size %d x %d x %d (%s)", (int)imageInfo->width, (int)imageInfo->height, (int)imageInfo->arraySize, IGetErrorString( error ) );
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
|
||||
log_error(
|
||||
"ERROR: Unable to create 1D image buffer of size %d (%s)",
|
||||
(int)imageInfo->width, IGetErrorString(error));
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -148,6 +172,7 @@ int test_get_image_info_single( cl_context context, image_descriptor *imageInfo,
|
||||
switch (imageInfo->type)
|
||||
{
|
||||
case CL_MEM_OBJECT_IMAGE1D:
|
||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
required_height = 0;
|
||||
break;
|
||||
@@ -175,8 +200,7 @@ int test_get_image_info_single( cl_context context, image_descriptor *imageInfo,
|
||||
case CL_MEM_OBJECT_IMAGE2D:
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||
required_depth = 0;
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER: required_depth = 0; break;
|
||||
case CL_MEM_OBJECT_IMAGE3D:
|
||||
required_depth = imageInfo->depth;
|
||||
break;
|
||||
@@ -198,8 +222,7 @@ int test_get_image_info_single( cl_context context, image_descriptor *imageInfo,
|
||||
case CL_MEM_OBJECT_IMAGE1D:
|
||||
case CL_MEM_OBJECT_IMAGE2D:
|
||||
case CL_MEM_OBJECT_IMAGE3D:
|
||||
required_array_size = 0;
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER: required_array_size = 0; break;
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||
required_array_size = imageInfo->arraySize;
|
||||
|
||||
Reference in New Issue
Block a user