||Direct2D vs. VPR
Mattias Andersson <firstname.lastname@example.org>
||Mon, 1 Mar 2010 02:15:32 +0100
I've just had the chance to do a full benchmark comparison between Direct2D
and the rest of the rasterizers in my benchmark application. Of course I was
very curious to see how Direct2D compares with VPR.
Background: Direct2D is Microsoft's latest API for high-performance 2D
graphics. As with Direct3D, Direct2D is said to take advantage of graphics
hardware acceleration. Direct2D uses so called per-primitive antialiasing,
which is very much on par with VPR, AGG and LibArt.
Interestingly, Direct2D provided both some of best and some of the worst
benchmark results. The key for achieving good performance in Direct2D seems
to be "hidden geometry". My theory here is that Direct2D takes advantage of
the vertex processor of the graphics card in order to remove any primitives
that are hidden *before* they are actually drawn. This tecnique is also
known as "occlusion culling".
Here are the tests that were benchmarked:
1. 5k ellipses
2. 20k thick lines
3. 20k thin lines
4. 5k splines
5. 2k text output
In the two first benchmark tests, Direct2D's performance advantage is
indisputable. Here we have large solid primitives that will efficiently
occlude the primitives in the background. Especially the thick line
benchmark gives an exceptional performance.
However, when we perform the same line benchmark as before (still 20k
lines), but adjust the line width from 10px to 1px, there is suddenly a
tenfold performance loss. Apparently here the occlusion culling technique
becomes much less usable and VPR is now a winner by a factor 2.
In the spline test VPR is again a winner, although by a small margin this
time. This is probably because there is a lot of geometry at the edges that
is not hidden very well.
Also, in the "text output" test VPR is a winner, this time by a factor 3.
This is also a case where Direct2D is not able to utilize occlusion culling
Overall, I don't think we have a clear-cut winner -- if you want optimal
performance then the biggest consideration would be to determine how much
hidden geometry will be drawn in a single Direct2D BeginDraw/EndDraw block.
Direct2D is the only rasterizer that will actually remove geometry before