OpenCL - Pass image2d_t twice to get both read and write from kernel?
问题 In my OpenCL kernel I would like to both read and write to an image2d_t object. According to OpenCL standard I can only specify either __read_only or __write_only. However, I figured if I send the same cl_mem as two separate kernel arguments (one with __read_only and one with __write_only) I can do both. Probably when I do a write followed by a read, I might get the old value(?) but in my case I would like the old value first, update it and write it back to the image. A simple example would