# [SlimDX] Direct2D seems slower than GDI+

## Recommended Posts

Hello! In my application, I'm getting average frames per second of 36 using SlimDX's Direct2D implementation, whereas using exactly the same code I get averages of 48 using GDI+. Using a performance profiler on my app, I see that when I run with SlimDX, the function with the most individual work is SlimDX.Direct2D.RenderTarget.EndDraw(). This function is taking up nearly 60% of the time the application exclusively spending in any of its function. The second most expensive function is Direct2DDemo.Program.Main(), the entry point of my application, which takes up only 8%. Can anybody please suggest ways in which I can get SlimDX's Direct2D API to outperform GDI+? Many thanks!

##### Share on other sites
Quote:
 when I run with SlimDX, the function with the most individual work is SlimDX.Direct2D.RenderTarget.EndDraw().

This is what SlimDX's EndDraw function looks like:
Result RenderTarget::EndDraw(){  return RECORD_D2D( InternalPointer->EndDraw() );}

SlimDX isn't the cause of your performance woes, Direct2D is. What is likely happening is that D2D is blocking in the EndDraw call -- which is when D2D flushes all the pending draw commands to D3D to render -- waiting for the GPU.

It's likely you're setting up D2D incorrectly/inefficiently someplace. It also could be a v-sync problem, although you typically get apparent FPS rates of 30 or 60 or so for that, not 36 (although there is only a 0.003 second difference there).

You should post your code. I know very little about D2D but somebody else may be able to tell you what you're doing wrong.

##### Share on other sites
Quote:
 Original post by jpetrieYou should post your code. I know very little about D2D but somebody else may be able to tell you what you're doing wrong.

I've found somebody with the same problem who first posted it, with code, here to gamedev.net on 2010-03-01:
http://www.gamedev.net/community/forums/topic.asp?topic_id=563775

Simply turning off anti-aliasing solved the issue for him.

http://msdn.microsoft.com/en-us/library/dd372260%28VS.85%29.aspx

which mentions the GPU, but only really in relation to the copying of bitmaps, which is not my case.

So please, if anybody knows anything about Direct2D and is reading this, can they please shed a little more light onto the issue!

Many thanks.

[Edited by - Shunyata_Kharg on March 18, 2010 3:57:22 PM]

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628293
• Total Posts
2981869

• 11
• 10
• 10
• 11
• 17