25 #include <Base/Common/BIASpragma.hh>
26 #include <OpenCLFramework/clfMemory.hh>
27 #include <OpenCLFramework/clfException.hh>
49 THROW_CL_EXCEPTION(cl::Error(-100,
"This is not a gl shared buffer"));
57 }
catch (cl::Error &error) {
58 THROW_CL_EXCEPTION(error);
64 buffer_.getInfo(CL_MEM_FLAGS, &data);
65 return data & CL_MEM_READ_ONLY;
69 buffer_.getInfo(CL_MEM_FLAGS, &data);
70 return data & CL_MEM_WRITE_ONLY;
75 if (readonly && writeonly) {
76 BIASWARN(
"trying to create buffer read-only and write-only. fail");
77 }
else if (readonly) {
78 cl_mem_flags |= CL_MEM_READ_ONLY;
79 }
else if (writeonly) {
80 cl_mem_flags |= CL_MEM_WRITE_ONLY;
82 cl_mem_flags |= CL_MEM_READ_WRITE;
84 if (hostptr != NULL) {
86 cl_mem_flags |= CL_MEM_COPY_HOST_PTR;
88 cl_mem_flags |= CL_MEM_USE_HOST_PTR;
clfMemory(cl::Context *context, cl::CommandQueue *queue)
int DetermineMemFlags_(bool readonly, bool writeonly, const void *hostptr=NULL, bool copy=false)
cl::CommandQueue * queue_