Slow texture lookup functions

If you wish to write shader which works on non-Nvidia cards, you must use only features allowed by the GLSL even if that means that the syntax will be not so pretty. Actually even the Nvidia compiler disables those “extensions” if you specify the #version directive to indicate that you wish to use features added by GLSL 1.20

In some cases (e.g. the fp16 support) it might be advantageous to detect the support for such feature and optionally use it however the const is imho not such case.

Actually I find the code more readable this way, & the compiler I guess let’s me do it for that reason…

The Nvidia GLSL compiler is based on the Cg compiler. I think that in the beginning it was simpler for them to add GLSL keywords and features to the Cg compiler than block the Cg features not allowed in the GLSL.

Actually even the Nvidia compiler disables those “extensions” if you specify the #version directive to indicate that you wish to use features added by GLSL 1.20

I use it and it compiles fine with the consts… But I guess you’re right about the portability issues. But still GPU ShaderAnalyzer is funny, I removed all the consts except one & it wouldn’t compile, and it didn’t show me where, couldn’t find it?? :slight_smile: Anyway I think I’ll use GLSLvalidate for the syntax, & then any other for performance issues… Thanks for claryfying this with the consts though, I didn’t know it!

It appears that they never reported the consts as portability warning so if they turn such warnings into errors, it slips by. Some other features like the half types seems to be correctly disabled.

But still GPU ShaderAnalyzer is funny, I removed all the consts except one & it wouldn’t compile, and it didn’t show me where, couldn’t find it?? :slight_smile:

Yes. Tool for shader analysis which has worse error reporting than the drivers is not ideal even if its main purpose is to analyze performance of working shaders.

Thanks for claryfying this with the consts though, I didn’t know it!

I hit those every time I move from C++ into GLSL.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.