Compile shaders
Xenko converts Xenko shaders ( and .xlfx
files) into the shader language used by the .
Xenko can convert the shaders at runtime (when the game is running) or at build time (when the editor builds the game assets). When Xenko generates shaders at runtime, rendering stops until the shader is compiled. This is usually something you want to avoid in your release build — especially on mobile platforms, which have less CPU, so the pause can be more noticable.
Xenko can't know in advance which shaders will be used at runtime. This is because users might generate new shader permutations by, for example, changing material parameters or modifying post-effect parameters from scripts. Additionally, the final shaders depend on the graphics features on the execution platform.
When Xenko needs a new shader at runtime, it checks its database to see if the shader has already been converted. If the shader is in the database, Xenko uses it.
If Record used effects is enabled in the package User Settings (see below), Xenko notifies Game Studio that it needs a new shader.
Game Studio notifies you that there are new shaders to import.
- If you click Import effects, Game Studio updates the Effect Log (or creates it if it doesn't exist) and adds them to the game database to be used the next time you build (see step 1).
- In Game Studio, in the Solution Explorer, select the package and click Package properties.
- In the Property Grid, set the properties.
The Effect compiler property specifies how to compile the shader.
Local: Convert the shader on the device. This is recommended for release versions of your game.
LocalOrRemote: Convert the shader on the developer machine; if this fails, try to convert it on the device. Like the Remote setting, this has no use for release versions of your game.
If you enable Record used effects, Game Studio adds new shaders to the Effect Log as soon as they're needed. We recommend you disable this for release versions of your game, as it can't connect to the developer machine.
As iOS devices can't connect directly to PC, to convert Xenko shaders remotely when developing for iOS, you need to use a Python script as a relay between the device, a Mac, and the developer PC.
Make sure your PC and Mac are connected to the same network.
On your Mac, install Python. You can download Python from the Python site.
Download and unzip .
Open Terminal, navigate to the folder where you unzipped the file, and execute xenko-ios-relay.py MyPcName, where MyPcName is the name of your developer PC.
Tip
To find the name of your developer PC, on the PC, press the Windows key, type About, and press Enter. The PC name is listed under PC name.
The iOS device should now be able to communicate with the PC via your Mac to build shaders remotely.
"[RouterClient]: Error: Could not connect to connection router using mode Connect. System.AggregateException: One or more errors occurred. —-> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:31254"