Results 1 to 2 of 2

Thread: accessing elements of cl::Buffer?

  1. #1

    accessing elements of cl::Buffer?

    is it possible somehow to access elements of cl::Buffer, like

    cl::Buffer buf;


    cout << buf[4];

    operator[] is not defined for cl::Buffer - but is there any other way?

    thank you.

  2. #2

    Re: accessing elements of cl::Buffer?

    You'd have to read the buffer into program memory first--i.e. a cl_float array--using clEnqueueReadBuffer(...) . Look at any openCL sample that uses this function for an example, but direct buffer reading is disabled for architectural reasons; the OCL backend is supposed to take care of the buffer memory management, not the application.

Similar Threads

  1. Summing up all elements of a buffer
    By jam383 in forum OpenCL
    Replies: 5
    Last Post: 05-01-2012, 08:08 PM
  2. Replies: 9
    Last Post: 12-05-2011, 10:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean