use clflush replaces clfinish

This commit is contained in:
yao
2013-04-02 14:41:02 +08:00
parent 2a1cf23fab
commit f3254b28f2
4 changed files with 18 additions and 6 deletions

View File

@@ -144,7 +144,7 @@ namespace cv
format.image_channel_data_type = CL_FLOAT;
break;
default:
throw std::exception();
CV_Error(-1, "Image forma is not supported");
break;
}
switch(channels)
@@ -159,7 +159,7 @@ namespace cv
format.image_channel_order = CL_RGBA;
break;
default:
throw std::exception();
CV_Error(-1, "Image forma is not supported");
break;
}
#if CL_VERSION_1_2
@@ -197,7 +197,8 @@ namespace cv
const size_t regin[3] = {mat.cols * mat.elemSize(), mat.rows, 1};
clEnqueueCopyBufferRect((cl_command_queue)mat.clCxt->oclCommandQueue(), (cl_mem)mat.data, devData, origin, origin,
regin, mat.step, 0, mat.cols * mat.elemSize(), 0, 0, NULL, NULL);
}
clFlush((cl_command_queue)mat.clCxt->oclCommandQueue());
}
else
{
devData = (cl_mem)mat.data;
@@ -206,7 +207,7 @@ namespace cv
clEnqueueCopyBufferToImage((cl_command_queue)mat.clCxt->oclCommandQueue(), devData, texture, 0, origin, region, 0, NULL, 0);
if ((mat.cols * mat.elemSize() != mat.step))
{
clFinish((cl_command_queue)mat.clCxt->oclCommandQueue());
clFlush((cl_command_queue)mat.clCxt->oclCommandQueue());
clReleaseMemObject(devData);
}
@@ -231,7 +232,8 @@ namespace cv
try
{
cv::ocl::openCLGetKernelFromSource(clCxt, &_kernel_string, "test_func");
//_support = true;
finish();
_support = true;
}
catch (const cv::Exception& e)
{