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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user