Tuesday, July 19, 2011

Threaded rendering

The enesim stack has been actively developed on the past months, we have lots of new features and new design concepts but this post is about threaded rendering. Recently a threaded rendering path has been committed into enesim given outstanding results, for examlple running the benchmark application with the circle.escen example we have:

Without threaded rendering

./benchmark -f ../../examples/circle01.escen -d -t 10000
../../examples/circle01.escen [15.375 sec]

And with threaded rendering

./benchmark -f ../../examples/circle01.escen -d -t 10000
../../examples/circle01.escen [4.948 sec]

This test was done on a quad core CPU and the gain is around 3x, of course the gain depends on the actual renderer to draw, the more complex the better.


Andreas Pokorny said...

Is that software only rasterization?
What kind of threading is used? Each thread taking a separate tile, or was the scene divided into layers of shapes with some sort of final blend step?

turran said...

Yes, the "threaded rendering" is done only on the software backend. At the end the idea is that the final destination surface (the place to draw the Enesim's Renderers) are divided in spans, so every CPU is in charge of drawing a particular set of spans.

The renderers at the end are in charge of drawing, such drawing operation is only a fill operation. But the renderers can also do the blending if they support it (through a features flag) to speed up the operation.