Merge pull request #18429 from alalek:ocl_fix_platforminfo

This commit is contained in:
Alexander Alekhin 2020-09-25 20:28:19 +00:00
commit e7f2af5fdb
4 changed files with 7 additions and 13 deletions

View File

@ -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

View File

@ -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());

View File

@ -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);

View File

@ -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