Jump to content
  • Advertisement
Sign in to follow this  
kamimail

[help]Direct2D Performance Issue

This topic is 3123 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have coded a simple application to compare the efficiency of Direct2D with GDI . but i was frustrated by the result: the rendering speed of Direct2D is about 10 times slower than GDI on my laptop which equips with a ati x1350 graphic adaptor. after creating 10000 polylines and hardware-support render target, i render those polyline using direct2D and GDI. i have tested the following case using Direct2D : (1)each line has a associative PathGeometry Object (2)using only one PathGeometry Object in which it has many figures initialization code snippet: GetClientRect(&rect); //1.generating point for(unsigned int i = 0; i < 10000;++i) { std::vector<D2D_POINT_2F> psf; for(unsigned int m = 0;m<10;++m) { int x = rand(); x = x % rect.right; int y = rand(); y = y % rect.bottom; D2D_POINT_2F _p={x,y}; psf.push_back(_p); } m_GeometryF.push_back(psf); } //2.create path geometry object and fill point ID2D1PathGeometry* pg = 0; ID2D1GeometrySink* pgs = 0; m_Renderer->GetD2DFactory()->CreatePathGeometry(&pg); pg->Open(&pgs); for(unsigned int i = 0; i < m_GeometryF.size();++i) {// for each polyline , create a figure D2D1_FIGURE_BEGIN fg = D2D1_FIGURE_BEGIN_HOLLOW; D2D1_FIGURE_END fe; fe = D2D1_FIGURE_END_CLOSED; pgs->BeginFigure(fb,fg); pgs->AddLines(&m_GeometryF[1],m_GeometryF.size()-1); pgs->EndFigure(fe); } the rendering stage is simple. rendering code snippet: RenderTarget->DrawGeometry(pg,Brush,(FLOAT)1);// the brush is a solid color brush I found that most time was consumed by the RenderTarget->EndDraw() method. is there anyone who known the reason? i think it may be an error deriving from an improper usage of Direct2D. thanks in advance. [Edited by - kamimail on March 1, 2010 11:35:18 PM]

Share this post


Link to post
Share on other sites
Advertisement
There could be a couple of things. You can look up the performance improvement page for D2D on msdn.

You should try to test since you find the bottleneck:

I would first try to deactivate the creation/draw of the polygons and draw only rects with about the same size (pixel amount).

You can also check what happens if you run it with software rendertarget.

Turn off Antialiasing.

Create the polygons/geometrypaths with only e.g. four points/lines.

Check to not use any slowing Flags when creating the rendertarget.

Update your driver to the latest one. In addition you should try the demo on another computer with a newer/faster gpu.
...



Share this post


Link to post
Share on other sites
Thanks,I have resolved the problem.if the antialias option is disabled, the d2d is really faster than gdi when you have considerable amount of geometric data.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!