PDA

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



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

chai
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.