clCreateContextFromType выбросить исключение - PullRequest
0 голосов
/ 04 декабря 2018

Я использую C ++.Я использую OpenCL 1.2, Visual Studio 13.0 (Windows 7).Я изучаю OpenCL по этой книге "Руководство по программированию OpenCL".Я пытаюсь взаимодействовать OpenCl / OpenGL.n в этом коде:

cl_platform_id firstPlatformId;
errNum = clGetPlatformIDs(1, &firstPlatformId, &numPlatforms);
cl_context_properties contextProperties[] =
{
    CL_CONTEXT_PLATFORM,
    (cl_context_properties)firstPlatformId,
    CL_GL_CONTEXT_KHR,
    (cl_context_properties)wglGetCurrentContext(),
    CL_WGL_HDC_KHR,
    (cl_context_properties)wglGetCurrentDC(),
    0
};

cl_uint uiDevCount;
cl_device_id* cdDevices;
// Get the number of GPU devices available to the platform
errNum = clGetDeviceIDs(firstPlatformId, CL_DEVICE_TYPE_GPU, 0, NULL, &uiDevCount);

// Create the device list
cdDevices = new cl_device_id[uiDevCount];
errNum = clGetDeviceIDs(firstPlatformId, CL_DEVICE_TYPE_GPU, uiDevCount, cdDevices, NULL);

auto clDev = &cdDevices[0];
context = clCreateContext(contextProperties, 1, clDev, NULL, NULL, &errNum);
//// alternate:
/*context = clCreateContextFromType(contextProperties, CL_DEVICE_TYPE_GPU,
    NULL, NULL, &errNum);*/

, когда я достигаю clCreateContext или clCreateContextFromType, он генерирует необработанное исключение.Есть идеи почему?

...