EndDraw () takes up 80% of working time in Direct2D

There is one critical performance issue in my Direct2D application. I am using Direct2D to draw my graph using PathGeometry to improve performance and achieve clean rendering in Windows 8.1.

When creating DeviceResources, I create PathGeometry using the Factory interface. Then I set the points of the graph to draw a graph on the output surface. Finally, the ImageSource rendering will be used as the source for my Image element in XAML.

I just followed the sample link below to reach my scenario.

http://code.msdn.microsoft.com/windowsapps/XAML-SurfaceImageSource-58f7e4d5

The above example helped me get ImageSource output from Direct2D and finally use it in a XAML / C # application.

Let's look at my problem. I use more than 24 charts on one page of my Windows Store application. This graph allows the user to manipulate in the left and right positions, and also allows you to scale it to a certain level of scaling.

Therefore, whenever a user tries to manipulate a graph, I simply set the Translation and Scaling matrix to TransformedPathGeometry instead of creating a new one each and every time.

ID2D1TransformedGeometry *m_pTransformedGeometry; pFactory->CreateTransformedGeometry(graphgeometry, combinedMatrix, &m_pTransformedGeometry); 

Finally, I draw TransformedGeometry using the DrawGeometry method.

I tested my application using the performance analysis tool in VisualStudio2013. I could see that at a certain peek level, invoking the m_d2deviceContext-> EndDraw () method took more than 80% of the execution time. I have attached the screenshot below to get more information about this performance output.

Is there a way to significantly increase this performance ?

enter image description here

Could you help me help me with this?

Regards, David C

+4
source share
1 answer

There is a difference between slow performance and time consuming.

If your draw method works more than the other parts, it may mean that this method is slow, but it may also mean that your other parts do not need a lot of processor.

88.2% tells you that you spend more time drawing this material than other things.

Use a timer to determine if your draw is slow.

+2
source

Source: https://habr.com/ru/post/1500166/


All Articles