locked
Direct2D performance for line drawings

    Question

  • I'm trying to render a large number of lines in a XAML app using Direct2D. I'm managing to render about 2 million lines a second by passing the lines to an ID2D1PathGeometry, and calling DrawGeometry on an ID2D1DeviceContext.

    I would like to know if I am getting to the limits of how many lines I can render in a second, or if I there are alternative methods to speed this up. Would it be any quicker to use Direct3D or GDI?

    Currently I am just rendering a static image, however I will want to pan and zoom the image later on, as well as possibly wanting to modify it.

    Friday, August 24, 2012 2:56 PM

Answers

  • Hi,

    The performance of D2D is better than GDI, because it get the benefit from hardware acceleration.

    For scenarios where the use of hardware acceleration is not feasible, Direct2D includes a high-performance software rasterizer. When rendering in software, applications that use Direct2D experience substantially better rendering performance than with GDI+ and with similar visual quality. The software rasterizer is also designed for use in a service context.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by D.G.Thomas Wednesday, August 29, 2012 8:08 AM
    Monday, August 27, 2012 7:09 AM
    Moderator
  • It depends on if you are drawing simple lines or using any line styles. Direct3D can render single-width lines very fast, but it can't render 'thick' lines, pattern lines, or rounded/beveled lines.
    • Marked as answer by D.G.Thomas Wednesday, August 29, 2012 8:08 AM
    Tuesday, August 28, 2012 6:09 PM

All replies

  • D3D may be faster. Since d2d is based on d3d.


    C++ DX11

    Sunday, August 26, 2012 9:34 AM
  • Hi,

    The performance of D2D is better than GDI, because it get the benefit from hardware acceleration.

    For scenarios where the use of hardware acceleration is not feasible, Direct2D includes a high-performance software rasterizer. When rendering in software, applications that use Direct2D experience substantially better rendering performance than with GDI+ and with similar visual quality. The software rasterizer is also designed for use in a service context.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by D.G.Thomas Wednesday, August 29, 2012 8:08 AM
    Monday, August 27, 2012 7:09 AM
    Moderator
  • Thanks Jesse,

    Could I expect any performance improvements by skipping the D2D layer and going straight for D3D as Raptor K suggests?

    Does the performance I'm getting sound reasonable? This is my first experience doing any rendering work, so I haven't got any frame of reference.

    I'm running on an Intel Core2 Duo E7500, 4GB RAM, GeForce 9300 GE.

    Thanks again!

    Tuesday, August 28, 2012 9:13 AM
  • It depends on if you are drawing simple lines or using any line styles. Direct3D can render single-width lines very fast, but it can't render 'thick' lines, pattern lines, or rounded/beveled lines.
    • Marked as answer by D.G.Thomas Wednesday, August 29, 2012 8:08 AM
    Tuesday, August 28, 2012 6:09 PM
  • Thanks Chuck,

    I think that covers it. I'm going to be drawing single width lines so I'll investigate using Direct3D.

    Cheers,

    David

    Wednesday, August 29, 2012 8:09 AM