From b1ac35e14a8ddfcc184db83c52a9bd928e0310ef Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 1 Jul 2014 20:02:02 +0400 Subject: [PATCH] ocl: fix mac and superres test --- modules/ocl/include/opencv2/ocl/cl_runtime/cl_runtime.hpp | 11 +++++++++++ modules/superres/test/test_superres.cpp | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/modules/ocl/include/opencv2/ocl/cl_runtime/cl_runtime.hpp b/modules/ocl/include/opencv2/ocl/cl_runtime/cl_runtime.hpp index 86e7ebc..5472e06 100644 --- a/modules/ocl/include/opencv2/ocl/cl_runtime/cl_runtime.hpp +++ b/modules/ocl/include/opencv2/ocl/cl_runtime/cl_runtime.hpp @@ -6,6 +6,17 @@ #if defined(HAVE_OPENCL_STATIC) #if defined __APPLE__ +// APPLE ignores CL_USE_DEPRECATED_OPENCL_1_1_APIS so use this hack: +#include +#ifdef CL_EXT_PREFIX__VERSION_1_1_DEPRECATED +#undef CL_EXT_PREFIX__VERSION_1_1_DEPRECATED +#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED +#endif +#ifdef CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED +#undef CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED +#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED +#endif + #include #else #include diff --git a/modules/superres/test/test_superres.cpp b/modules/superres/test/test_superres.cpp index 5cb078f..14d8eaf 100644 --- a/modules/superres/test/test_superres.cpp +++ b/modules/superres/test/test_superres.cpp @@ -278,6 +278,16 @@ TEST_F(SuperResolution, BTVL1_GPU) #if defined(HAVE_OPENCV_OCL) && defined(HAVE_OPENCL) TEST_F(SuperResolution, BTVL1_OCL) { + try + { + const cv::ocl::DeviceInfo& dev = cv::ocl::Context::getContext()->getDeviceInfo(); + std::cout << "Device name:" << dev.deviceName << std::endl; + } + catch (...) + { + std::cout << "Device name: N/A" << std::endl; + return; // skip test + } RunTest(cv::superres::createSuperResolution_BTVL1_OCL()); } #endif -- 2.7.4