From c945ea125aed599940de31610812cb38a1d3c3ba Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 25 Sep 2020 19:22:12 +0000 Subject: [PATCH] ocl: fix PlatformInfo usage --- modules/core/src/directx.cpp | 8 ++++---- modules/core/src/ocl.cpp | 2 +- modules/core/src/opengl.cpp | 2 +- modules/core/src/va_intel.cpp | 8 +------- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/modules/core/src/directx.cpp b/modules/core/src/directx.cpp index c651449d59..c9bd1a4fa1 100644 --- a/modules/core/src/directx.cpp +++ b/modules/core/src/directx.cpp @@ -459,7 +459,7 @@ Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device) } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try @@ -579,7 +579,7 @@ Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device) } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try @@ -701,7 +701,7 @@ Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDev } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try @@ -824,7 +824,7 @@ Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9 } cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 8a99240c83..0a82424ba1 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -3102,7 +3102,7 @@ void initializeContextFromHandle(Context& ctx, void* _platform, void* _context, cl_context context = (cl_context)_context; cl_device_id deviceID = (cl_device_id)_device; - std::string platformName = PlatformInfo(platformID).name(); + std::string platformName = PlatformInfo(&platformID).name(); auto clExecCtx = OpenCLExecutionContext::create(platformName, platformID, context, deviceID); CV_Assert(!clExecCtx.empty()); diff --git a/modules/core/src/opengl.cpp b/modules/core/src/opengl.cpp index a95191ef0c..5ff3c717b6 100644 --- a/modules/core/src/opengl.cpp +++ b/modules/core/src/opengl.cpp @@ -1690,7 +1690,7 @@ Context& initializeContextFromGL() CV_Error(cv::Error::OpenCLInitError, "OpenCL: Can't create context for OpenGL interop"); cl_platform_id platform = platforms[found]; - std::string platformName = PlatformInfo(platform).name(); + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx = OpenCLExecutionContext::create(platformName, platform, context, device); clReleaseDevice(device); diff --git a/modules/core/src/va_intel.cpp b/modules/core/src/va_intel.cpp index 1fd574ba01..c640a08658 100644 --- a/modules/core/src/va_intel.cpp +++ b/modules/core/src/va_intel.cpp @@ -141,13 +141,7 @@ Context& initializeContextFromVA(VADisplay display, bool tryInterop) contextInitialized = true; cl_platform_id platform = platforms[found]; - char platformName[1024] = {0}; - size_t sz = 0; - if (clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platformName) - 16, platformName, &sz) != CL_SUCCESS - || sz >= sizeof(platformName)) - { - CV_Error(cv::Error::OpenCLInitError, "OpenCL: Failed to get platform name"); - } + std::string platformName = PlatformInfo(&platform).name(); OpenCLExecutionContext clExecCtx; try