2 Replies Latest reply on Jul 11, 2011 9:32 AM by P.M

    OpenCL equivalent to cudaBindTexture2D

    P.M

      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!

        • OpenCL equivalent to cudaBindTexture2D
          rick.weber

          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.

            • OpenCL equivalent to cudaBindTexture2D
              P.M

               

              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?