locked
Direct2D Internals

    General discussion

  • Is D2D implemented by driver or directly by hardware?

    Is it possible to implement a same function by D3D11 to get better performance?


    C++ DX11

    Monday, April 30, 2012 2:13 PM

All replies

  • That's a complicated question...

    In the distant past, video hardware had specifically functionality for accellerating "GDI" operations. This has long since been removed and replaced with "Direct3D" era solutions, programmable shaders, etc. The GDI vs. Direct2D story is well addressed by this article

    http://msdn.microsoft.com/en-us/library/windows/desktop/ff729480(v=vs.85).aspx

    Beyond that, it really depends on what exactly you are drawing with Direct2D. If you are just doing texture quads, then going directly to Direct3D might be a bit faster. If you are drawing filled circles, patterns, styled lines, etc. then you are better off using Direct2D as a well-optimized library for doing this kind of drawing.

    Monday, April 30, 2012 6:38 PM
  • Also the D2D is not flexible enough.

    For example. The outline drawn by ID2D1RenderTarget::DrawGeometry (the Stroke) is so monotonous that you can only set the width. If I want to implement the effect like "bevel" , I have to draw it many times with different widths. It cause low performance.  BMP and gradient brushes will not help, the brush is not a real brush, it's only a "mask" .  It seems the new D2D1_1 in WCP has no improvement about it. I hope it becomes a real BRUSH in D2D2 :)

    But now, I'm interested in what does DrawGeometry do,  or can I implement it myself ( with d3d )  ?


    C++ DX11

    Tuesday, May 01, 2012 2:13 AM
  • Hi Raptor K,

    It is correct that Direct2D currently supports constant width stroke. However, it does support various line joins including dashing. ID2D1StrokeStyle and ID2D1StrokeStyle1 lead to those options. The performance of stroking in Direct2D has been significantly improved in Windows 8.1. For the full detail of all the performance optimization including various usage of hardware capabilities, check out http://channel9.msdn.com/Events/Build/2013/3-191. Dan McLachlan's talk at //build conference 2013.

    Worachai Chaoweeraprasit
    Microsoft Corporation.

    Friday, September 13, 2013 10:47 PM
  • I used direct3d for my 2d app.

    I created a texture and then a shader resource and copied my screen buffer to the shader resource.

    This works very well and is very fast.


    n.Wright

    Wednesday, October 02, 2013 8:54 PM