How to Update WP8/WinRT Shaders¶
Since cocos2d-x uses ANGLE backend for rendering on WP8 and WinRT, we need to precompile all shaders before the App is started up.
At present a cocos2d shader compiler tool is provided to generate all cached shaders which are delivered with engine. Those include all the common shaders defined in the program cache implementation. If you are adding a new shader into them or modifying a existing shader. You have to update the precompiled shader data using the tool.
Below is a simple instruction for that:
- Open the solution file
- Build and run. (Note that it is only supported by Visual Studio 2013)
- Click the compile button.
- In the dialog box, select
cocos\platform\wp8\shaders\precompiledshaders.h(or the WinRT version regarding what platform you are using).
- Now all the cached programs are precompiled.
For those who are trying to adding a new custom shader, the steps might be kind of inconvenience.
You need to use another tool provided by ANGLE
- Download the project WinRT shader compiler, build and run.
winrtcompiler.exeto generate the precompiled data, check the README file for more detailed usages.
- Copy the generated data to the corresponding
precompiledshaders.hfile, also update its SHA1 key and the total program number.
- Now cocos2d-x will find the precompiled shader data by the key.
Actually this is just a simple work around. We are developing a new general tool which will handle all those stuff in a proper way. It may be coming in this late summer.