gpt4 book ai didi

c++ - OpenCL:无效值

转载 作者:行者123 更新时间:2023-11-28 02:17:10 24 4
gpt4 key购买 nike

我在 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)

有人想解决我的问题吗?

最佳答案

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

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
};

关于c++ - OpenCL:无效值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33721547/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com