0

I have written a small code to create an image object in opencl as below:

img_fmt.image_channel_order = CL_R;
img_fmt.image_channel_data_type = CL_UNSIGNED_INT8;      
memobj_in_luma = clCreateImage2D(p->context, CL_MEM_READ_ONLY, &img_fmt, p->width, p->height, 0, NULL, &ret);

After creating this object I want to change the image format to CL_RGBA. Is there any way to do this?

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
Manish Kumar
  • 1,419
  • 3
  • 17
  • 36
  • this doesn't have anything to do with CUDA. Removing CUDA tag. – Robert Crovella Aug 20 '15 at 15:27
  • Thanks for the straight answer. Is there any reference where I can see this? Actually I am receiving a directx surface with image format CL_R and I want to change this to CL_RGBA to access four pixels in one memory access. This help in performance improvement. – Manish Kumar Aug 20 '15 at 15:42
  • I tried this. When I create image with this RGBA, I cannot copy the contents of the original surface. Actually clEnqueueCopyImage gets failed. – Manish Kumar Aug 20 '15 at 15:47
  • Here is the link to that question http://stackoverflow.com/questions/32111760/changing-image-format-of-a-directx-acquired-surface-in-opencl – Manish Kumar Aug 20 '15 at 15:51
  • Yoiu can create an image from a buffer, where you tell it what the format is. Perhaps you could create two images from the same buffer with two different formats? – Dithermaster Aug 26 '15 at 15:28

1 Answers1

0

As per the discussion in comments above: We can't change the image format of already created image.We need to create another image for different format required. Also, I posted my question in intel forums and got the same answer.

Manish Kumar
  • 1,419
  • 3
  • 17
  • 36