mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
ocl: avoid unnecessary loading/initializing OpenCL subsystem
If there are no OpenCL/UMat methods calls from application. OpenCL subsystem is initialized: - haveOpenCL() is called from application - useOpenCL() is called from application - access to OpenCL allocator: UMat is created (empty UMat is ignored) or UMat <-> Mat conversions are called Don't call OpenCL functions if OPENCV_OPENCL_RUNTIME=disabled (independent from OpenCL linkage type)
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#include <opencv2/core/utils/trace.private.hpp>
|
||||
#include <opencv2/core/utils/configuration.private.hpp>
|
||||
|
||||
#include <opencv2/core/opencl/ocl_defs.hpp>
|
||||
|
||||
#include <cstdarg> // va_start
|
||||
|
||||
#include <sstream>
|
||||
@@ -596,7 +598,7 @@ void Region::destroy()
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
case REGION_FLAG_IMPL_OPENCL:
|
||||
if (param_synchronizeOpenCL && cv::ocl::useOpenCL())
|
||||
if (param_synchronizeOpenCL && cv::ocl::isOpenCLActivated())
|
||||
cv::ocl::finish();
|
||||
myCodePath = Impl::CODE_PATH_OPENCL;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user