Size of Effect file

Started by
1 comment, last by EvilDecl81 19 years, 7 months ago
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.
________________
"I'm starting to think that maybe it's wrong to put someone who thinks they're a Vietnamese prostitute on a bull"       -- Stan from South Park
Lab74 Entertainment | Project Razor Online: the Future of Racing (flashsite preview)
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

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.
EvilDecl81

This topic is closed to new replies.

Advertisement