mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
CL12: Use slice pitch instead of row pitch for 1D arrays. (#315)
* Use slice pitch instead of row pitch for 1D arrays. Fixes fill_image 1Darray * Use slice pitch instead of row pitch for 1D arrays. Fixes copy_image 1Darray
This commit is contained in:
@@ -195,12 +195,26 @@ cl_mem create_image( cl_context context, BufferOwningPtr<char>& data, image_desc
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Else copy one scan line at a time.
|
// Else copy one scan line at a time.
|
||||||
|
size_t dstPitch2D = 0;
|
||||||
|
switch (imageInfo->type)
|
||||||
|
{
|
||||||
|
case CL_MEM_OBJECT_IMAGE3D:
|
||||||
|
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||||
|
case CL_MEM_OBJECT_IMAGE2D:
|
||||||
|
dstPitch2D = mappedRow;
|
||||||
|
break;
|
||||||
|
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||||
|
case CL_MEM_OBJECT_IMAGE1D:
|
||||||
|
dstPitch2D = mappedSlice;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for ( size_t z = 0; z < depth; z++ )
|
for ( size_t z = 0; z < depth; z++ )
|
||||||
{
|
{
|
||||||
for ( size_t y = 0; y < height; y++ )
|
for ( size_t y = 0; y < height; y++ )
|
||||||
{
|
{
|
||||||
memcpy( dst, src, scanlineSize );
|
memcpy( dst, src, scanlineSize );
|
||||||
dst += mappedRow;
|
dst += dstPitch2D;
|
||||||
src += scanlineSize;
|
src += scanlineSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,6 +492,9 @@ int test_copy_image_generic( cl_device_id device, image_descriptor *srcImageInfo
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sourcePtr += dstImageInfo->rowPitch;
|
sourcePtr += dstImageInfo->rowPitch;
|
||||||
|
if((dstImageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY || dstImageInfo->type == CL_MEM_OBJECT_IMAGE1D))
|
||||||
|
destPtr += mappedSlice;
|
||||||
|
else
|
||||||
destPtr += mappedRow;
|
destPtr += mappedRow;
|
||||||
}
|
}
|
||||||
sourcePtr += dstImageInfo->slicePitch - dstImageInfo->rowPitch * dstImageInfo->height;
|
sourcePtr += dstImageInfo->slicePitch - dstImageInfo->rowPitch * dstImageInfo->height;
|
||||||
|
|||||||
@@ -190,12 +190,26 @@ cl_mem create_image( cl_context context, BufferOwningPtr<char>& data, image_desc
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Else copy one scan line at a time.
|
// Else copy one scan line at a time.
|
||||||
|
size_t dstPitch2D = 0;
|
||||||
|
switch (imageInfo->type)
|
||||||
|
{
|
||||||
|
case CL_MEM_OBJECT_IMAGE3D:
|
||||||
|
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||||
|
case CL_MEM_OBJECT_IMAGE2D:
|
||||||
|
dstPitch2D = mappedRow;
|
||||||
|
break;
|
||||||
|
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||||
|
case CL_MEM_OBJECT_IMAGE1D:
|
||||||
|
dstPitch2D = mappedSlice;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for ( size_t z = 0; z < depth; z++ )
|
for ( size_t z = 0; z < depth; z++ )
|
||||||
{
|
{
|
||||||
for ( size_t y = 0; y < height; y++ )
|
for ( size_t y = 0; y < height; y++ )
|
||||||
{
|
{
|
||||||
memcpy( dst, src, scanlineSize );
|
memcpy( dst, src, scanlineSize );
|
||||||
dst += mappedRow;
|
dst += dstPitch2D;
|
||||||
src += scanlineSize;
|
src += scanlineSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,6 +517,9 @@ int test_fill_image_generic( cl_device_id device, image_descriptor *imageInfo,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sourcePtr += imageInfo->rowPitch;
|
sourcePtr += imageInfo->rowPitch;
|
||||||
|
if((imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY || imageInfo->type == CL_MEM_OBJECT_IMAGE1D))
|
||||||
|
destPtr += mappedSlice;
|
||||||
|
else
|
||||||
destPtr += mappedRow;
|
destPtr += mappedRow;
|
||||||
}
|
}
|
||||||
sourcePtr += imageInfo->slicePitch - ( imageInfo->rowPitch * (imageInfo->height > 0 ? imageInfo->height : 1) );
|
sourcePtr += imageInfo->slicePitch - ( imageInfo->rowPitch * (imageInfo->height > 0 ? imageInfo->height : 1) );
|
||||||
|
|||||||
Reference in New Issue
Block a user