Recompiling shaders
by Manoel Neto · in Torque Game Engine Advanced · 05/22/2006 (2:28 pm) · 2 replies
I'm at a point where I'm doing lots of trial and error debugging in a particular custom HLSL shader, and having to close and reload TSE is being a major time-waster in the whole proccess.
I just can't move the shader over to RenderMonkey for debugging, because the problems I'm debugging are related to building up a matrix in TSE and passing it over to the shader, and I can't re-produce that in RM.
I tried a quick solution to get shaders recompiled:
But it doesn't work: the shader seems to be reloaded, recompiled, but nothing changes, as if it recompiled a cached shader. The further I could get was at D3DXAssembleShaderFromFileA(), which actually loads the shader form the file, but I haven't found a clue to why the shaders won't change, even if I modify them to something extreme as returning a single color.
Do anyone have a clue to this?
I just can't move the shader over to RenderMonkey for debugging, because the problems I'm debugging are related to building up a matrix in TSE and passing it over to the shader, and I can't re-produce that in RM.
I tried a quick solution to get shaders recompiled:
ConsoleMethod(ShaderData, reload, void, 2, 2, "()")
{
delete object->shader;
object->shader = NULL;
object->initShader();
}But it doesn't work: the shader seems to be reloaded, recompiled, but nothing changes, as if it recompiled a cached shader. The further I could get was at D3DXAssembleShaderFromFileA(), which actually loads the shader form the file, but I haven't found a clue to why the shaders won't change, even if I modify them to something extreme as returning a single color.
Do anyone have a clue to this?
About the author
Associate Manoel Neto
Default Studio Name
ConsoleMethod(ShaderData, reload, void, 2, 2, "()") { object->shader = NULL; object->initShader(); }It'll properly re-load the shader and re-compile the HLSL files. If there are any errors, they'll be printed to the console in the release build, but the debug build will throw out an assert. To disable the assert, open gfx/D3D/gfxD3DShader.cpp and comment out this line:
This makes it possible to tweak hlsl shaders using TSE directly, instead of relying on RenderMonkey for that.