Sign in to follow this  

[help]Direct2D Performance Problem

This topic is 2844 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[i][1],m_GeometryF[i].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:37:40 PM]

Share this post


Link to post
Share on other sites

This topic is 2844 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this