Enable CSF generation
by thanasimos · 03/12/2014 (3:29 pm) · 7 comments
I dont know why it was disabled but loading precompiled shaders instead of re-compiling them improves a lot loading times especially on "heavy" missions. Enabling compiled shaders may be useful in shipping builds.
- At source/gfx/D3D9/gfxD3D9Shader.cpp
- Define TORQUE_ENABLE_CSF_GENERATION in your torqueConfig.h
- Recompile and run your game. The generated .csf files should exist in shaders/procedural directory.
- Add
$shaders::forceLoadCSF = true;
in your default.cs or main.cs
Around line 951 change
if ( !_saveCompiledOutput(filePath, code, bufferLayoutF, bufferLayoutI) && smLogErrors )to
if (!_saveCompiledOutput(filePath, code, bufferLayoutF, bufferLayoutI,samplerDescriptions) && smLogErrors)
#define TORQUE_ENABLE_CSF_GENERATION
#2
03/12/2014 (5:09 pm)
ok got it!! had to run the game first with $shaders::forceLoadCSF = false; than I set it to true to use the precompiled shaders... works great thank you......
#3
03/13/2014 (8:13 am)
This is great! Having worked quite a bit with shaders lately, I know how long the compilation of some shaders actually takes (several seconds for shaders with a for-loop).
#4
On second thought, there may be a work-around twhen this is the case. Just check if the procedural shaders map is empty then run with forceLoadCSF = false, else set it to true.
03/14/2014 (6:13 am)
Just a stupid question, isn't there a problem when a user changes the gfx card? I thought that the shaders had to be recompiled then.On second thought, there may be a work-around twhen this is the case. Just check if the procedural shaders map is empty then run with forceLoadCSF = false, else set it to true.
#5
03/16/2014 (6:52 am)
It needs a button for the end user. So he can choose between load precompiled and generate shaders, if he start the game. Maybe a clean shader button also.
#6
03/29/2014 (2:07 am)
This would be a great candidate for a pull request if we can work out the usability issues! For example, if forceLoadCSF is false but there are no shaders, it should be treated as if it's true. Maybe that needs to happen wherever the warning is occurring from.
#7
I know now. If you have shaders that use a
Furthermore I have solved the problem when no shaders are present.
09/01/2014 (1:48 am)
Quote:I dont know why it was disabled...
I know now. If you have shaders that use a
defines = "...";in the ShaderData (like the UnderWaterShader) to distinguish between two forms of the same shader (UnderWaterShader and WaterShader both use the same pixel and vertex shader with the UNDERWATER defines makes the difference), then the compiled shader goes wrong. If you want to use the csf's then you have to create two shaders in the mentioned case.
Furthermore I have solved the problem when no shaders are present.

Torque Owner Donnie Hutson Jr
getting tons of these errors and game crashs???