OpenCL-图像的保存区域

OpenCL-图像的保存区域,opencl,Opencl,我正在使用OpenCL C 1.2,为了在主机上读回图像,我使用以下代码: // Read the output buffer back to the Host char *buffer = malloc((width * height)*sizeof(char*)*4); //new char [width * height * 4]; size_t origin[3] = { 0, 0, 0 }; size_t region[3] = { width, height, 1}; errNum

我正在使用OpenCL C 1.2,为了在主机上读回图像,我使用以下代码:

// Read the output buffer back to the Host
char *buffer = malloc((width * height)*sizeof(char*)*4); //new char 
[width * height * 4];
size_t origin[3] = { 0, 0, 0 };
size_t region[3] = { width, height, 1};
errNum = clEnqueueReadImage(commandQueue, imageObjects[1], CL_TRUE,
                            origin, region, 0, 0, buffer,
                            0, NULL, NULL);
如何仅读取图像的特定区域


谢谢大家!

您可以设置描述要读取的子图像的
原点
区域
。只有图像的子区域将被处理到主机内存中