I tried to work with 1d image in my kernel, but I’m not sure that I know, how the pixels are stored in memory. I created a buffer as follow:
cl_image_desc desc;
desc.image_type = CL_MEM_OBJECT_IMAGE1D;
desc.image_width = img.width();
desc.image_height = img.height();
desc.image_array_size = 0;
desc.image_depth = 0;
desc.image_row_pitch = 0;
desc.image_slice_pitch = 0;
desc.num_mip_levels = 0;
desc.num_samples = 0;
desc.buffer = nullptr;
cl_mem inputImage = clCreateImage(context,CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, &format, &desc, img.bits(), &error);
I supposed that rows of an image are next to each other, so I thought that pixel with coordinates [x,y] is at [y*image_width + x] position in 1d image. So how to read_imagef() pixel of image1d_t in kernel?