qt+ cuda+ opengl,与qopenglcontext共享cuda上下文

发布于 2025-02-06 02:59:10 字数 1094 浏览 1 评论 0原文

我有一个QT程序,它使用Qopenglcontext进行渲染。
现在,我想使用cuda来处理图像,而无需提取主机。

如果我使用(qt += core gui OpenGL),而无需使用Qopenglcontext,我将使用cudagraphicsglregisterimage和map opengl cuda,一切正常。

但是,当我使用 qputenv(“ qt_opengl”) ,“ Angle”); (要设置Qopenglcontext) - 甚至调用cudaglgetDevices(& gldevicecount,gldevicecount,gldevicecect,gdevicecount,gldevicecount,cudagldevicelistall);给予垃圾 - 给垃圾 - 给垃圾 - 给垃圾 - cuda上下文与qopenglcontext不同。

如何设置CUDA上下文与Qopenglcontext相同?
我读过关于cuda contact (cucontext* pctx,unsigned int标志,cudevice dev
但在我看来,没有这样的选择。
也许还有另一个解决方案,如果我必须使用qopenglcontext

I have a Qt program, which using QOpenGLContext for rendering.
Now I want to use CUDA to process image without extracting image to host.

If I use (QT += core gui opengl), without using QOpenGLContext, I will use cudaGraphicsGLRegisterImage and map OpenGL to CUDA and everything works fine.

But, when I use qputenv("QT_OPENGL", "angle"); (to setup QOpenGLContext) - even calling cudaGLGetDevices(&glDeviceCount, glDevices, glDeviceCount, cudaGLDeviceListAll); gives rubbish - meaning the CUDA context not the same as QOpenGLContext.

How can I setup CUDA context to be the same as QOpenGLContext?
I have read about CUDA context, e.g cuCtxCreate ( CUcontext* pctx, unsigned int flags, CUdevice dev
but it seems to me, that there no such option.
Maybe there are another solution, if I have to use QOpenGLContext?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文