Coherent GT 1.7 is our largest update so far and it’s all about improved performance and easier integration in engines. The major change is substituting our previous rendering backend with our new library Renoir which improves overall rendering performance 15% – 70% depending on the UI. I’ll highlight the changes and advantages that Renoir brings.
General architecture of Renoir
The library was built around three paradigms:
- Make a “thin” library and move higher-level object management out of it
- Make a library that is compatible with the design of low-level APIs like DirectX 12, Vulkan, Metal etc.
- Make customizing and integrating the rendering easier in any engine
Renoir is a relatively low-level library by itself. It does minimal object or scene management – all those are moved in other subsystems of Coherent GT. This makes managing complexity much easier in Renoir and allows it to scale better with the available hardware. Renoir also powers our mobile UI product – Project Colibri for Games, so it’s deployed across all modern game hardware from GLES 2 phones to PlayStation 4 and Xbox One. The core of the library is cross-platform and all the API-specific code is put in different “backends”.
Conceptually Coherent GT and all other HTML 5 rendering engines have two aspects to rendering – generating high-level commands (draw circle, draw rectangle, draw pattern etc.) and the execution of these commands on the actual device. We sped-up both. The generation of high-level commands happens in the main UI thread and is now ~30-50% faster because the data structures are smaller and all commands are quickly “flattened” in a simple array. It’s a very “data-driven” way to do things. The buffer does minimal error checking and no object lifetime management. Тhis is similar to how the low-level command buffer objects work in DirectX 12, Vulkan, etc.
The Core of Renoir (on a render thread) actually takes the high-level commands and generates all that is needed for the rendering – vertex buffers, shaders etc. It also aggressively tries to batch commands to minimize state changes. Renoir is engineered with DirectX 12 in mind and it’s backend API is very similar to what you’ll see when implementing rendering in DirectX 12. The execution of the backend commands can be multi-threaded on APIs that allow it.
The low-level rendering commands are passed to a “backend” object that has to execute them in an API-specific way. Coherent GT comes with a number of pre-created backends for OpenGL 3.3+, DirectX 9/11/12, GNM, GLES 2 etc. We’ve made writing backends significantly easier in Renoir than it was in the previous library. Users can modify the existing backends to better integrate with their engines or write a completely new one. The shading system has also been re-worked to minimizes costly state changes.
New features and improvements
We have re-worked the image and resource caching scheme and now Coherent GT takes less memory both on RAM and VRAM. Users have also direct access to the internal caches of the library and can tailor them to their needs. For instance if you have a lot gradients you could benefit from increasing the cache dedicated to “special effects”.
Coherent GT now natively supports compressed textures that reduce memory footprint and increase performance. We advise developers to re-save large images in DDS with BC3 format (remember to pre-multiply) to take benefit of the feature. Large images are often needed in UI (think menu backgrounds) and using a compressed format will significantly reduce memory footprint.
Users have direct access to the source code of the rendering backends for all APIs, so they can integrate them more tightly and add their own telemetry, graphics-specific memory management etc. Coherent GT also no longer saves or restores any rendering state in the backends. Developers are in a much better place to decide which states have to be restored in their game anyway and the previous behavior often resulted in redundant state changes.
Adding special effects is much more optimized and cheaper to do now. Especially shadows and blurs as they are often used in modern game UI. Coherent GT 1.7 significantly improves their performance and introduces limits on the shadow width to prevent inadvertently creating huge blurs that hit heavily GPU performance.
All our samples have been re-worked to use only CSS animations and we have removed the GSAP library from the samples. We advise always using CSS animations, which are evaluated by Coherent GT in C++.
We have a ton of new features in our Coherent Editor including direct import from Photoshop, timeline animation editing and re-usable components called widgets. The new features are so many that we wrote a separate blog post to highlight all of them. Stay tuned.
We are very excited about Coherent GT 1.7 and Renoir. Tell us how GT 1.7 has improved your game!