【问题标题】:clCreateFromGLTexture() returns CL_INVALID_CONTEXT on certain platforms onlyclCreateFromGLTexture() 仅在某些平台上返回 CL_INVALID_CONTEXT
【发布时间】:2018-03-19 10:16:14
【问题描述】:

在 OpenGL 和 OpenCL 之间积极创建共享上下文后,使用以下内容:

cl_context_properties cps[] = {
    CL_GL_CONTEXT_KHR,
    (cl_context_properties)glXGetCurrentContext(),
    CL_GLX_DISPLAY_KHR,
    (cl_context_properties)glXGetCurrentDisplay(),
    CL_CONTEXT_PLATFORM,
    (cl_context_properties)platform_id,
    0
};

// Create an OpenCL context
m_contextCL = clCreateContext( cps, 1, &device_id, NULL, NULL, &err);

我尝试创建共享纹理:

cl_mem mem = clCreateFromGLTexture(
            m_contextCL ,
            CL_MEM_READ_ONLY ,
            GL_TEXTURE_2D ,
            0 ,
            qt_fbo->texture() ,
            &err
            );

现在调用仅在带有 NVIDIA Quadro K620 的 xubuntu 16.04 上成功,使用专有驱动程序版本 387.26 和随 CUDA 实现包交付的 OpenCL。

但是,当在 Manjaro OS 和 Beignet OpenCL 实施上使用 Intel HD Graphics 520 的东芝笔记本电脑上试用它时。 clCreateFromGLTexture(...) 因返回 CL_INVALID_CONTEXT 而失败, 此外,我尝试了另一个平台,Ubuntu 16.04 和 Intel Iris IGP(集成图形处理器)同时使用 Intel SDK 和 Beignet OpenCL。它在共享纹理创建的同一点失败。

我创建了最小的工作示例来比较两种 GPU 技术(OpenGL 和 OpenCL)及其与 Qt 的互操作性:
https://github.com/pietrzakmat/opengl-opencl-qt-interop.
所有步骤均来自两个教程:
1.https://www.codeproject.com/Articles/685281/OpenGL-OpenCL-Interoperability-A-Case-Study-Using
2.https://software.intel.com/en-us/articles/opencl-and-opengl-interoperability-tutorial

任何人都可以指出我做错了什么以及为什么在具有集成显卡或 IGP Intel cpu 的平台上创建共享纹理失败?这是驱动程序或 OpenCL 实现的问题吗?我设法构建并运行了 Beignet 或 intel_ocl_examples 中包含的示例,所以我认为安装是正确的。

【问题讨论】:

    标签: qt opengl interop opencl


    【解决方案1】:

    1) 是否支持 cl_khr_gl_sharing 扩展?您是否尝试在 Windows 平台/macOS 上为 Intel GPU 使用此代码? 2) 你有没有尝试使用没有附加到 FBO 的纹理?

    无论如何,我认为这是 Linux 平台上 OpenCL 实现的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-27
      • 1970-01-01
      • 2017-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多