Jump to content
  • Advertisement
Sign in to follow this  
dhanji

Size of Effect file

This topic is 5199 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

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!