Launching the Remote Shader Compiler
The Remote Shader Compiler can be found in the folder
<Root>\Tools\RemoteShaderCompiler. The executable is called CrySCompileServer.exe. A configuration file is also available that can be used to configure the TCP port the server application will listen on.
You can launch the Remote Shader Compiler by starting CrySCompileServer.exe manually. However, usually it makes sense to set it up as a service, so that it is always started with the operating system.
Requests for shaders are executed in parallel, it can make sense to ensure sufficient cores are available for the server, if you notice significant delays in acquiring shaders at runtime.
There are four important variables that should be set in the config.ini file:
- MailError should be set to an internal company e-mail address to which notifications about compilation errors will be sent.
- The cache directory (TempDir), in which the binary shaders are stored once they got compiled, needs to point to a valid absolute path (default is <WorkingDirectory>\Temp).
- port is the TCP port, which has to match the setting in the game's system.cfg
- MailServer is the mail server of your company.
The complete config.ini file should look like this:
In the root folder of the Remote Shader Compiler, each supported platform has its own sub-folder with additional sub-folders for different version numbers. The paths are hard-coded and can be configured in
RenderDll\Common\Shaders\ShaderCache.cpp if required.
All paths follow this pattern:
As part of the engine package distributed to you, the appropriate shader-compilers are already included for your use, that match the code of that version. Just copy the entire RemoteShaderCompiler folder and run the provided binary.
The cache subfolder of the remote shader compiler will contain different txt list files of all the combinations requested so far by the game. The listfiles in the root folder contain all the global shader combination, which have ever been requested on a certain platform on any level.
The game submits the requests to the remote shader compiler either during actual gameplay or during loading phases, even when remote shader compiling itself is disabled. This is to be sure that all possible shader combinations are collected, and the shader caches which are generated during the shader cache generation phase are as complete as possible.
Usage of the Remote Shader Compiler by the game can be configured with the following cvar setting which is usually put into the system.cfg file:
If r_ShadersRemoteCompiler is set to 0, no remote shader compilation will be performed and the engine will do local shader compilation instead (which will fail on consoles).
When enabled, the game has to know the location of the Remote Shader Compiler. The IP address of the server can be configured with the following CVar:
It is possible to specify more than one Remote Shader Compiler, as shown in the following sample. The IP addresses need to be separated by semicolons.
Please note that it is not possible to use the network name of the server instead of the IP address since no name resolving is performed.
If the remote shader compile server uses user-defined port number (as specified in config.ini), the port number can be configured with the following CVar.
Submitting request lines to the remote shader compiler can also be disabled with the following cvar, which can be handy when experimenting with shaders and you don't want to have these combinations added to the global shader cache:
As a final note, it is not required to have a central remote shader compile server for the whole company. It is also possible to set up the Remote Shader Compiler locally on each PC that requires shader compilation and it is actually handy when writing shaders.