OpenCL:无效值

时间:2015-11-15 15:44:25

标签: c++ properties opencl

我在windows中填充cl_context_propeties时遇到了问题:

这是我的代码:

cl_context_properties props[] = {
    CL_GL_CONTEXT_KHR,
    (cl_context_properties)wglGetCurrentContext,
    CL_WGL_HDC_KHR,
    (cl_context_properties)wglGetCurrentDC,
    CL_CONTEXT_PLATFORM,
    (cl_context_properties)platform,
};
*context = clCreateContextFromType(props, CL_DEVICE_TYPE_GPU, NULL, NULL, &err);

在这些行之后是我的错误代码-30(在CL_INVALID_VALUE的错误代码中为-30)

有人有想法解决我的问题吗?

1 个答案:

答案 0 :(得分:2)

您需要调用函数并以零结束。试试这个:

cl_context_properties props[] = {
  CL_GL_CONTEXT_KHR, (cl_context_properties) wglGetCurrentContext (),
  CL_WGL_HDC_KHR, (cl_context_properties) wglGetCurrentDC (),
  CL_CONTEXT_PLATFORM, (cl_context_properties) platform,
  0 
};