summaryrefslogtreecommitdiff
path: root/src/cl_mem.c
diff options
context:
space:
mode:
authorLuo Xionghu <xionghu.luo@intel.com>2015-10-29 15:02:14 +0800
committerYang Rong <rong.r.yang@intel.com>2015-11-04 10:36:52 +0800
commit3c501328a0d58abfeef32da89063480b5ef8bf36 (patch)
treec33f157db98132b151ccc086665d7d5a426244ca /src/cl_mem.c
parent9ecf64caf823eb92b2721bc5026dc0b4e769a464 (diff)
set the pitch of image from buffer to the buffer's pitch.
if image from buffer, the image's pitch should be same with buffer bo's row pitch. v2: correct style. image from buffer need update both aligned_pitch and aligned_h, while image from user ptr only set aligned_pitch, so just keep them independently. Signed-off-by: Luo Xionghu <xionghu.luo@intel.com> Reviewed-by: Guo Yejun <yejun.guo@intel.com>
Diffstat (limited to 'src/cl_mem.c')
-rw-r--r--src/cl_mem.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cl_mem.c b/src/cl_mem.c
index ca3e76f3..be64abe4 100644
--- a/src/cl_mem.c
+++ b/src/cl_mem.c
@@ -852,8 +852,13 @@ _cl_mem_new_image(cl_context ctx,
if (aligned_pitch < pitch && enableUserptr)
aligned_pitch = pitch;
//no need align the height if 2d image from buffer.
- if (image_type == CL_MEM_OBJECT_IMAGE2D && buffer != NULL)
+ //the pitch should be same with buffer's pitch as they share same bo.
+ if (image_type == CL_MEM_OBJECT_IMAGE2D && buffer != NULL) {
+ if(aligned_pitch < pitch) {
+ aligned_pitch = pitch;
+ }
aligned_h = h;
+ }
else
aligned_h = ALIGN(h, cl_buffer_get_tiling_align(ctx, CL_NO_TILE, 1));
} else if (tiling == CL_TILE_X) {