summaryrefslogtreecommitdiff
path: root/src/cl_api.c
diff options
context:
space:
mode:
authorLuo Xionghu <xionghu.luo@intel.com>2015-09-22 14:44:52 +0800
committerYang Rong <rong.r.yang@intel.com>2015-09-22 16:15:14 +0800
commit9aa056ea6be3c86f6ef915617dd97d3cfef2d845 (patch)
treee0321b01dcd268f369519ac0b0b5edef21e1976b /src/cl_api.c
parent729b16fdb387437f97115e938745ab1135151553 (diff)
downloadbeignet-9aa056ea6be3c86f6ef915617dd97d3cfef2d845.tar.gz
enable create image 2d from buffer in clCreateImage.
this patch allows create 2d image with a cl buffer with zero copy. v2: should use reference to manage the release the buffer and image. After being created, the buffer reference count is 2, and image reference count is 1. if image is released first, decrease the image reference count and buffer reference count both, release the bo when the buffer is released at last; if buffer is released first, decrease the buffer reference count only, release the buffer when the image is released. add CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT in cl_device_info. v3: move is_image_from_buffer to _cl_mem_image; return CL_INVALID_IMAGE_SIZE if image size is larger than the buffer. v4: pitchalignment set to 2. Signed-off-by: Luo Xionghu <xionghu.luo@intel.com> Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Diffstat (limited to 'src/cl_api.c')
-rw-r--r--src/cl_api.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cl_api.c b/src/cl_api.c
index 4376a5ea..998aa516 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -549,8 +549,9 @@ clCreateImage(cl_context context,
goto error;
}
/* buffer refers to a valid buffer memory object if image_type is
- CL_MEM_OBJECT_IMAGE1D_BUFFER. Otherwise it must be NULL. */
+ CL_MEM_OBJECT_IMAGE1D_BUFFER or CL_MEM_OBJECT_IMAGE2D. Otherwise it must be NULL. */
if (image_desc->image_type != CL_MEM_OBJECT_IMAGE1D_BUFFER &&
+ image_desc->image_type != CL_MEM_OBJECT_IMAGE2D &&
image_desc->buffer) {
err = CL_INVALID_IMAGE_DESCRIPTOR;
goto error;