cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

P_M
Journeyman III

OpenCL equivalent to cudaBindTexture2D

Hi all, I'm currently tring to port one of my simplest Cuda kernels to OpenCL.

In this piece of code, I allocate a big (fullW, fullH) image on GPU.
Then I memcpy a portion of image that could be smaller (w, h).
I bind this (w,h) portion on a clamped 2D texture and fetch this texture from the kernel.

Is it possible to bind a 2D portion of a bigger image with OpenCL ?
Thanks a lot for your help!

0 Likes
2 Replies
rick_weber
Adept II

It's not possible to bind a texture to an arbitrary buffer in OpenCL, unless there's some magic way to do it in OpenGL and then share that with OpenCL. Can you not just pass or compute the image offsets to the smaller texture?

If not, you'll just have to copy the smaller image to another texture.

0 Likes

Originally posted by: rick.weberCan you not just pass or compute the image offsets to the smaller texture?


I don't understand what you mean. I chose to memcpy my (w,h) data in the (fullW, fullH) image at origin(0,0). So there is no offset.

I would like the texture to be clamped for indexes x>w and y>h. But since my original image2D was create with a (fullW, fullH) size it does not work.

That's why I want to rebind it. So it is not possible?

0 Likes