Hi forum,
I am creating a pinned memory as follows , but i am getting the error code -36 . Any hint will be very helpful to get around this issue:
width = ((getDimension(0) <= 1) ? 1 : getDimension(0)) * getElementSize();
height = 1;
depth = 1;
//calculate the buffer size
bufferSize =
((getDimension(0) <= 1) ? 1 : getDimension(0)) * getElementSize();
//create mem object for the pinned host memory
cl_mem pinnedDeviceMem = clCreateBuffer( cxt->_m_clContext,
CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,
bufferSize,
NULL,
&errNum);
if( errNum != CL_SUCCESS )
{
osg::notify(osg::FATAL) << __FUNCTION__ << getName() << "[osgOpenCL::Buffer::alloc()] \"" << getName() <<"\": something went wrong while creating the pinned device linear memory for 1D." << std::endl;
return false;
}
//mapp the pinned buffer we have allocated
void *mappedMem = clEnqueueMapBuffer(cxt->_m_clCommandQueue,
*(memory._m_clPinnedDevPtr),
CL_TRUE,
CL_MAP_WRITE,
0,
bufferSize,
0,
NULL,
NULL,
&errNum);
if( errNum != CL_SUCCESS )
{
osg::notify(osg::FATAL) << __FUNCTION__ << getName() << "[osgOpenCL::Buffer::alloc()] \"" << getName() <<"\": something went wrong while mapping the device linear memory for 1D :" << errNum << std::endl;
return false;
}
What might have went wrong up there? I am sure it is havving trouble to map the memory, but do not know why?
Thanks
Sajjad