Dynamically creating materials creates thousands of files
by Dave Calabrese · in Torque Game Engine Advanced · 10/03/2008 (3:31 pm) · 1 replies
As my other posts have probably let on, I'm working on a game where there is some dynamic material changes happening. I've realized that whenever a change is made - the game creates a new set of .HLSL files. When my game is making a lot of dynamic changes, I'm getting over 2000 files in the procedural shaders directory! I did some hunting around in the engine code, and it looks like it is keeping a count of the materials generated, but it never clears this count. It LOOKS like, if this value is reset to 0 every time 'reinitMaterials();' is run, then it should start overwriting existing .HLSL files rather than always creating new ones. Can anyone think of a reason why this is a bad idea, or maybe have a better solution to this problem?
Thanks!
-Dave Calabrese
Gaslight Studios
Thanks!
-Dave Calabrese
Gaslight Studios
About the author
Torque Owner Brian Richardson
You could also find ShaderGenManager::openNewShaderStream, force shaderInMemory to true by removing the #ifdef. You'll have to add some sort of flush here on reInitMatinstance as well, or this will grow without bounds. The advantage here is that the shader never hits the disk.