Includer shader in multiple shader files
Members - Reputation: 213
Posted 18 February 2012 - 12:01 PM
I have HLSL shaders in .txt files and I want to use a common function (computeLight()) in multiple shader files. If I write the shader in a file common.psh and include it (with #include "common.psh") in files A.psh and B.psh : Will common.psh be compiled two times (for both A.psh and B.psh) or just one time?
Members - Reputation: 789
Posted 18 February 2012 - 12:45 PM
It will be compiled twice. I haven’t seen an option to let fxc dump object files for each included file (and also no way to link against such) so fxc will compile them again. (This is better for optimizations, too). You always have to recompile shaders when an included file changed.
Acagamics e.V. – IGDA Student Game Development Club (University of Magdeburg, Germany)
Moderators - Reputation: 5418
Posted 19 February 2012 - 12:31 AM