We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
cl_image_format imageFormat;
imageFormat.image_channel_data_type = CL_UNSIGNED_INT16;
imageFormat.image_channel_order = CL_RGBA; // considering image with only single channel
// Allocate SVM memory
size_t imageSize = width * height * sizeof(cl_uchar);
cl_uchar *imgSvmPtr = (cl_uchar *) clSVMAlloc(context, CL_MEM_READ_WRITE, imageSize, 0);
// Create a buffer object using the SVM memory
cl_mem svmImgBuffer = clCreateBuffer(context, CL_MEM_USE_HOST_PTR, imageSize, imgSvmPtr, NULL);
// Set the SVM buffer to image description parameter and set the other parameters accordingly
cl_image_desc imageDesc;
memset(&imageDesc, '\0', sizeof(cl_image_desc));
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_width = width / 4;
imageDesc.image_height = height;
imageDesc.mem_object= svmImgBuffer;
// Create 2D image, which will be used as input as well as output image
cl_mem image2D = clCreateImage(context, CL_MEM_READ_WRITE, &imageFormat, &imageDesc, NULL, &status);
status = -65, I want to know why ? thanks
anyway, thanks. first, this should be size_t imageSize = width * height * sizeof(cl_ushort), I write wrong. I try setting image_depth and image_array_size,but it don't work. my driver is follows:
name : ARM Platform11-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] vendor : ARM11-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] version : OpenCL 2.1 v1.r21p0-01rel0.15967fb8d94527311cf969f52c0720a211-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] opencl device info : 11-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] name : Mali-G57 r0p011-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] vendor : ARM11-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] type : GPU11-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] profile : FULL_PROFILE11-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] version : OpenCL 2.1 v1.r21p0-01rel0.15967fb8d94527311cf969f52c0720a211-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] driver version : 2.111-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] max workgroup size : 51211-06 09:33:32.813 7993 7993 D mialgo_basic: [mialgo_basic] local mem size : 32768
I wonder this driver don't suppose u16 rgba svm to create image object