1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

core(OpenCL): thread-local OpenCL execution context

This commit is contained in:
Alexander Alekhin
2020-08-11 18:13:52 +00:00
parent 0428dce27d
commit 2129c72bc0
12 changed files with 1719 additions and 252 deletions
+8 -3
View File
@@ -1689,9 +1689,14 @@ Context& initializeContextFromGL()
if (found < 0)
CV_Error(cv::Error::OpenCLInitError, "OpenCL: Can't create context for OpenGL interop");
Context& ctx = Context::getDefault(false);
initializeContextFromHandle(ctx, platforms[found], context, device);
return ctx;
cl_platform_id platform = platforms[found];
std::string platformName = PlatformInfo(platform).name();
OpenCLExecutionContext clExecCtx = OpenCLExecutionContext::create(platformName, platform, context, deviceID);
clReleaseDevice(device);
clReleaseContext(context);
clExecCtx.bind();
return const_cast<Context&>(clExecCtx.getContext());
#endif
}