Just like Direct3D 10, Direct2D was designed to fit hand in glove with an optional debug layer that allows developers to receive rich information about design-time issues they might encounter when using Direct2D. Today, the Direct2D team is happy to announce that the debug layer is available from code gallery. For more information, and to download the layer, please see the debug layer entry in the SDK.

About the Direct2D Debug Layer

The Direct2D debug layer is an independent component that will intercept calls made from the application to Direct2D and provide feedback about various classes of errors, for example:

·         Incorrect threading usage of Direct2D objects.

·         Using Direct2D objects with the wrong factory.

·         Incorrect parameters passed to Direct2D.

In addition, the Direct2D debug layer also provides additional warnings and informational traces about issues that an application might optionally want to address, for example:

·         Using a software render target when a hardware render target might have been intended.

·         Using a more expensive primitive when a cheaper one would have worked.

Using the Direct2D Debug Layer

The Direct2D debug layer is designed not to change the behavior of Direct2D when it is used. If the debug layer is installed, it will not be invoked and will not result in any performance overhead unless the application explicitly requests that the debug layer be used.  To trace all issues, specify the D2D1_DEBUG_LEVEL_INFORMATION enumeration in the D2D1_FACTORY_OPTIONS structure before calling D2D1CreateFactory and run your application under a debugger.

We hope that you find the debug layer useful. We are also very happy to receive feedback about any issues you encounter during application development where you feel that a debug layer trace would have been helpful so that we can continue to improve the debug layer.