你能把Cg推多远?
经验丰富的着色器开发人员告诉我,虽然 Cg 对于简单着色器非常有用,但由于生成的着色器代码中存在错误,建议直接为高级着色器执行 GLSL/HLSL。
使用 Cg 的具体限制和/或已知问题是什么...是否有某些事情它不能做,或者是否需要尝试看看...使用 Cg 直到问题出现?
I have been told by experienced shader developers that while Cg is great for simple shaders, it is advised to do GLSL/HLSL directly for advanced shaders, due to bugs in resultant shader code.
What specifically are the limits and/or known problems with using Cg... are there certain things it just can't do, or is it a case of try and see... work with Cg until problems arise?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如前所述,Cg在其年龄范围内是好的。自 SM3 时代以来,它就没有进行过重大修改。我会要求那些“经验丰富的着色器开发人员”引用具体错误。
我喜欢 DirectX 中的 HLSL,因为编译器看起来更干净,而且预着色器是个好东西。
无论如何,iPad 和 WebGL 等上下文现在都需要 GLSL。
但 Cg 仍然有重要的用途。例如,我几乎每天都在 Maya 中使用它。它与 HLSL 的密切关系使得 CgFX 对于我们内部工具链中的 OpenGL/DirectX 之间的共享非常有用。
Cg is fine within the scope of its age, as previously described. It hasn't had a major overhaul since the SM3 days. I would ask those "experienced shader developers" to cite specific errors.
I'm fond of HLSL within DirectX because the compiler seems a bit cleaner and preshaders are a fine thing.
GLSL is now required for contexts like iPad and WebGL anyway.
But Cg still has important uses. I use it in Maya almost daily, for example. Its close relationship to HLSL makes CgFX very useful for sharing between OpenGL/DirectX in our in-house tool chain.