OpenGL Scene Graph Optimization

The new OpenGL scene graph introduced in Storyboard 6.0 turns the old synchronous immediate mode OpenGL render manager into an asynchronous deferred OpenGL renderer. The new rendering paradigm allows the Engine to re-sequence, sort and combine GL calls in ways that are more efficient for both the CPU and GPU. For example, with the ability to sort, the depth buffer can be leveraged for all rendering elements on the current screen, which when combined with separate opque and alpha operation ordering allows the engine to use hardware accelerated depth testing to greatly reduced overdraw on the GPU. This is functionality that should improve an application's performance without any change to the application itself.

The OpenGL scene graph also adds support for batching for some common elements and state transitions. This allows for previously separate elements with each their own expensive GL draw calls to be combined together based. This has the effect of greatly reduced the overall number of GL draw calls in particular. Currently fills can be batched, along with glyphs and images for which we leverage our image atlas, that allows us to access multiple images or glyphs from a single texture.

To maximize the benefit of batching, an application design should try to keep as many common classes of rendering elements together within the Z-order of the design to help improve the probability that they will be batched together. For example try to avoid a scenario where controls with single render extensions are organized (in a stacked Z order) as image, fill, image, fill a more ideal scenario would be (where possible): image, image, fill, fill.

In order to offer some additional configurability for design scenarios where the new rendering optimizations are not aligned with the application design, it is possible to control the batching and sorting behaviour with the engine options -orender_mgr,no_batch or -orender_mgr,no_z_sort.

The other configuration option that can play a significant role in rendering performance are the resource manager options that control the size of the font and image cache. The size of this cache plays a significant role in how much content can be batched together for draw operations. The -oresource_mgr,image_block_size={-1|0|X} and -oresource_mgr,font_block_size={-1|0|X} options can be use to configure the size and behaviour of the caches generally the larger the block sizes, the great chance things will be batched with a large potential gain on performance at the cost of a potential increase memory usage.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.