PDA

View Full Version : clEnqueueWriteBuffer question



clamport
07-15-2009, 12:29 PM
Regarding the aforementioned clEnqueueWriteBuffer, I have noticed that it can take a pointer to a host memory region with the most current bits. This eludes to the fact that the memory object is updated with current pointer information when clEnqueueWriteBuffer is called. Does this mean that as long as a cl_mem object is declared that I can forgo assigning a memory object until this call is made?
What I mean by this is, can I have an empty cl_mem object, yet declare the pointer to memory upon the clEnqueueWriteBuffer, or to replace the contents of that object upon the call?
Thanks,
~Chris

onegin
07-16-2009, 09:13 AM
You can create a buffer using clCreateBuffer and not specify a host pointer from which you would like to copy data. Later on, you may issue the EnqueueWriteBuffer to write the actual databits to the buffer. You could accomplish that with single command: clCreateBuffer and use "CL_MEM_COPY_HOST_PTR" flag during creation. Does that help at all?

clamport
07-16-2009, 09:25 AM
Actually, that exactly answered my question.
Thanks!