Sign in to follow this  
dhanji

Size of Effect file

Recommended Posts

Is there any kind of limit (or recommended optimum) of the number of shaders/constants/techniques you can define in an effect (.fx file loaded by ID3DXEffect)? I try to keep the constants low by reusing them a lot between shaders, but is it a problem to have a whole library of shaders? I mean besides it being messy.

Share this post


Link to post
Share on other sites
Quote:
Original post by dhanji
Is there any kind of limit (or recommended optimum) of the number of shaders/constants/techniques you can define in an effect (.fx file loaded by ID3DXEffect)?

I try to keep the constants low by reusing them a lot between shaders, but is it a problem to have a whole library of shaders? I mean besides it being messy.

The only issue I'm aware of is that the more shaders you have, the better it'd be to compile them offline.
Half-life 2, IIRC, has ~2700 shaders

Share this post


Link to post
Share on other sites
Quote:
Original post by dhanji
Is there any kind of limit (or recommended optimum) of the number of shaders/constants/techniques you can define in an effect (.fx file loaded by ID3DXEffect)?

I try to keep the constants low by reusing them a lot between shaders, but is it a problem to have a whole library of shaders? I mean besides it being messy.


There isn't a limit, but keep in mind that since variables defined in the global scope are visible to all techniques, this can expand the working set of an effect file (especially if you have large swafts you aren't using).

Additionally, each effect file will create a stateblock if you use the restore/save state ability. This can cause memory stress on the driver which may fail if you haev too many active effects (e.g. > 500).

My advice, create as many asyou need, but don't be in a scenario where 99% of your loaded techinques aren't ever used.

Share this post


Link to post
Share on other sites

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