Game Development Community

Loading shaders inside ResourceManager

by Bryce "Cogburn" Weiner · in Torque Game Engine Advanced · 03/04/2007 (10:07 pm) · 2 replies

I'm trying to package a little app, but when I zip up the shaders directory, suddenly none of the shaders can be found.

I've been able to modify the engine to use the ResourceManager to load shaders, but I have to have the shaders under a modpath.

Not a big deal... I think. Everything is working fine (it still needs to create procedural shaders), but I'm wondering if I haven't broken something that I won't realize until I start doing more advanced shader programming.

It looked like shaders operating outside the ResourceManager might have been an oversight, so I'm not sure if this is a bug. Is there a reason why the shaders directory resided outside a modpath?

If it doesn't break anything, is anyone interested in a resource?

#1
03/05/2007 (3:35 am)
I had planned to do this soon as well, but never really got to it.

I can not think of any reason why it would break, though. It is loaded once and never streamed, unlike Atlas.
#2
03/05/2007 (9:13 am)
There's ONE issue that makes my implementation sloppy.

#include'd files are not loaded via D3DXCompileShader. I had to open each shader and replace the #include with the values to be included. For being able to protect my assets, it was a worthy tradeoff.

When running w/o the cut and paste job, shaders that utilize #include generate an error X1505 when the shader is loaded (cannot find #include). Supposedly there's a way to specify an #include path for D3DXCompileShader, but it's beyond my knowledge and Google ability.

For what it's worth, I moved shaders/ under common/, where it makes the most sense.

I'm hoping someone can provide a clean answer to the #include problem, otherwise I'll just work on resourcing this with my current design.