使用 OpenGL 程序时会使用 GPU 的强大功能吗?

发布于 2024-12-09 20:05:41 字数 211 浏览 0 评论 0原文

我有一个相当旧的 ATI HD 3400 显卡,它不支持 OpenCL,所以我想知道我是否可以真正使用 ATI Catalyst 驱动程序提供的 OpenGL 库?

如果我的算法在 glutDisplayFunc (displayFunc) 中运行,即在 displayFun () 中运行,它实际上会消耗 CPU 功率还是 GPU 功率?

I've got a pretty old ATI HD 3400 video card , which have no support of OpenCL , so i'm wondering if i can actually play around with OpenGL libraries provided by ATI catalyst driver ?

If my algorithm is running in glutDisplayFunc ( displayFunc ) , that is in displayFun () , is it actually costing CPU power or GPU power ?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尾戒 2024-12-16 20:05:41

GLUT 只是一个管理特定于平台的窗口和 GL 上下文创建的库。您传递给 glutDisplayFunc 的函数只是由 GLUT 在适当的时间和您所运行的平台的上下文中调用;它不在 GPU 上执行。

不可能将您以正常方式编译的代码作为在 GPU 上运行的较大程序的一部分。

然而,在显示函数内部运行的各个图形操作当然会在 GPU 上执行渲染; CPU仍在计算要执行的图形操作,但并不实际渲染结果。每个 gl 函数都是普通的 CPU 函数,但它的作用是通过系统总线向显卡发送命令,然后由显卡进行实际渲染。

此外,这些操作是异步的; gl 函数不会等待 GPU 完成操作才让程序继续运行。这很有用,因为您的 CPU 和 GPU 可以同时工作 - GPU 绘制图形,而 CPU 则确定要绘制什么图形。另一方面,如果您确实需要另一个方向的通信(例如 glReadPixels),那么 CPU 必须等待 GPU 赶上。这也是glFlushglFinish之间的区别。

GLUT is just a library which manages platform-specific window and GL context creation. The function you pass to glutDisplayFunc is just called by GLUT at the appropriate time and context for the platform you're running on; it is not executed on the GPU.

It is not possible to have code that you've compiled in the normal fashion as part of a larger program run on the GPU.

However, the individual graphics operations run inside of your display func do of course perform the rendering on the GPU; the CPU is still computing which graphics operation to execute, but not actually rendering the results. Each gl function is a normal CPU function, but what it does is send a command through your system bus to your graphics card, which then does the actual rendering.

Furthermore, these operations are asynchronous; the gl functions don't wait for your GPU to finish the operation before letting your program continue. This is useful because your CPU and GPU can both be working simultaneously — the GPU draws graphics while the CPU figures out what graphics to draw. On the other hand, if you do need communication in the other direction — such as glReadPixels — then the CPU has to wait for the GPU to catch up. This is also the difference between glFlush and glFinish.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文