混合Cg和GLSL着色器(Mixing up Cg and GLSL shaders)

编程入门 行业动态 更新时间:2024-10-27 02:24:44
混合Cg和GLSL着色器(Mixing up Cg and GLSL shaders)

我刚刚得到了一个旧的OpenGL(2.1)/ Cg(3.1)代码,我应该改进它,特别是延迟着色渲染,我想改变其中一个传递的内核。

我正在加入GLSL(3.30)因为我更习惯了。 它似乎有效,但我想知道它是否会影响两者的混合性能(GLSL / Cg) 。 换句话说,生成的asm代码应该完全同质?

I've just got an old OpenGL(2.1)/Cg(3.1) code, which I should improve, particularly a deferred shading rendering , where I want to change the kernel of one of the passes.

I'm adding GLSL(3.30) As I'm much more habituated. It seems to work, but I'm wondering if it could be some performance impact mixing up both (GLSL/Cg). In other words, the generated asm code should completely homogeneous?

最满意答案

您不能在单个着色器中混合使用GLSL和Cg,但在不同的着色器中,它应该可以正常工作。 Cg代码无论如何都会被转换为GLSL(除非您使用的是Nvidia驱动程序,在这种情况下它可能会直接转换为着色器asm代码)。 您可以查看Cg编译器生成的GLSL代码,如果您想查看它是否做了可能效率低下的奇怪事情。

You can't mix GLSL and Cg in a single shader, but in different shaders, it should work fine. The Cg code just gets translated to GLSL anyways (unless you're using an Nvidia driver, in which case it may get translated directly to shader asm code). You can look at the GLSL code generated by the Cg compiler if you want to see if its doing anything odd that might be inefficient.

更多推荐

本文发布于:2023-07-19 21:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1187554.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:着色器   GLSL   Cg   Mixing   shaders

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!