The documentation (clEnqueueReadBuffer) says that clEnqueueReadBuffers can return CL_INVALID_VALUE “if the region being read specified by (offset, cb) is out of bounds or if ptr is a NULL value.”
So did you check those? It seems like it is related to your readoffsetGPU, readsizeGPU variables, or your ptrout offset calculation. Try putting that calculation into a local variable first and print out the value. Is it what you were expecting? Note that the type of your pointer will matter; when you increment or add something to a pointer the steps are based on the type it points to.
[QUOTE=Dithermaster;43851]The documentation (clEnqueueReadBuffer) says that clEnqueueReadBuffers can return CL_INVALID_VALUE “if the region being read specified by (offset, cb) is out of bounds or if ptr is a NULL value.”
So did you check those? It seems like it is related to your readoffsetGPU, readsizeGPU variables, or your ptrout offset calculation. Try putting that calculation into a local variable first and print out the value. Is it what you were expecting? Note that the type of your pointer will matter; when you increment or add something to a pointer the steps are based on the type it points to.[/QUOTE]
At some risk of sounding like a broken record, you can easily get this information from an Intercept Layer for OpenCL Applications call log:
It will also log the size of the buffer when it is allocated, which you will need to know to determine if offset + size is out of bounds.