我刚刚得到了一个旧的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.
更多推荐
发布评论