View Full Version : accessing elements of cl::Buffer?

01-31-2011, 07:12 AM
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.

01-31-2011, 11:24 AM
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.