Sign in to follow this  

GLSL Optimizations

This topic is 4664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I been trying to optimize GLSL, but there is absolutely no information on optimization out there. By the way, I notice that the CGC compiler does an extraordinary job at optimizing GLSL especially on the NV40 chipset, but fps are like money, you can never have enough! :) The only information available is at the “NVIDIA GPU Programming Guide”, which has very few tips (like changing vecs for halfs). So I was wondering if anyone knows any tip or secret on GLSL optimization. Thanks...

Share this post


Link to post
Share on other sites
You just have to play and figure out yourself. It actually depends on what type of application it is and what the bottle neck for that is.

1) Bandwidth usage
2) number of vertex processors
3) number of fragment processors
4) number of ALU units each one of them have
5) number of texture fetch and vector operations each ALU can do in one clock cycle
6) Memory and vertex/fragment processor clock speeds
7) Vertex/Fragment/Texture L1 & L2 cache sizes.

using these you can get a rough estimate of the framerate and probably can figure out what could be the bottle neck in your program.

Share this post


Link to post
Share on other sites
While I cant think of anything off the top of my head (atm I'm happy enuff to let the compiler deal with it) I will say be carefull of non-standard tips (which is a large problem when reading NV tips due to the GLSL=>CG conversion which goes on), for example while half is indeed a reserved word its not part of the standard and ATI's drivers will fail if you try to use a "half" type

Share this post


Link to post
Share on other sites
Quote:
Original post by dimensionX
You just have to play and figure out yourself. It actually depends on what type of application it is and what the bottle neck for that is.

1) Bandwidth usage
2) number of vertex processors
3) number of fragment processors
4) number of ALU units each one of them have
5) number of texture fetch and vector operations each ALU can do in one clock cycle
6) Memory and vertex/fragment processor clock speeds
7) Vertex/Fragment/Texture L1 & L2 cache sizes.

using these you can get a rough estimate of the framerate and probably can figure out what could be the bottle neck in your program.


Yep, I been playing with those all day. Also with NVShaderPerf!
I really like NVShaderPerf but I cannot find the way of getting the performance from 'vertex shader'. Is it posible? does anyone knows how to do it?

Also what can i do with cache? is there a way of making anything from the shader get and hit the more often the cache?

Quote:
Original post by _the_phantom_
While I cant think of anything off the top of my head (atm I'm happy enuff to let the compiler deal with it) I will say be carefull of non-standard tips (which is a large problem when reading NV tips due to the GLSL=>CG conversion which goes on), for example while half is indeed a reserved word its not part of the standard and ATI's drivers will fail if you try to use a "half" type


Ups, thats true. Thank God I know my programs are only going to be used in NV40 or NV40-GT cards.

Share this post


Link to post
Share on other sites
If I remember correctly NVShaderPerf only has support for GeForceFX series chipset only until NV35.

In my opinion it's the dummest estimate.

Put both the shaders in one file, see if NVShaderPerf gives separate results.

Share this post


Link to post
Share on other sites
from what ive seen the nvidia glsl compiler seems to do a really good job at optimization (youll be lucky to get a shader from 80cycles down to 79cycles)
anyways most optimzations to be made are in the standard methods move per fragment stuff to per vertex etc

Share this post


Link to post
Share on other sites

This topic is 4664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this