Welcome to MSDN Blogs Sign in | Join | Help

Syndication

Announcing the Direct2D Debug Layer

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.

Published Friday, October 30, 2009 10:02 PM by Mark Lawrence

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Announcing the Direct2D Debug Layer @ Saturday, October 31, 2009 8:07 AM

The debug layer looks nice.  Now the only thing missing is proper D2D<->D3D11 backbuffer interop support. :D

Seth

# re: Announcing the Direct2D Debug Layer @ Thursday, November 05, 2009 7:22 AM

Will the debug library be included in the next DirectX SDK?  Will there be a similar layer for DirectWrite?

JK

# re: Announcing the Direct2D Debug Layer @ Thursday, November 05, 2009 7:25 AM

Symbols would be a good thing to include for call stacks

JK

# re: Announcing the Direct2D Debug Layer @ Sunday, November 08, 2009 10:36 AM

"Now the only thing missing is proper D2D<->D3D11 backbuffer interop support."

+1 to that.

JJ

# re: Announcing the Direct2D Debug Layer @ Thursday, November 12, 2009 7:23 PM

@ JK

Q: Will the debug library be included in the next DirectX SDK?  Will there be a similar layer for DirectWrite?

A: Thanks for your feedback! Currently, the Direct2D debug layer is only available on MSDN Code Gallery. We do see the benefit of including it in the SDK, but there is no plan to do so at the moment.  And in reference to having a similar layer for DirectWrite, it's good to hear people are interested, and we will take into consideration.

-Aisha [MSFT]

Aisha Ayoub

# re: Announcing the Direct2D Debug Layer @ Thursday, November 12, 2009 7:24 PM

@JK

Q: Symbols would be a good thing to include for call stacks

A: Thanks for the suggestion, we’ll take it into consideration!

-Aisha [MSFT]

Aisha Ayoub

# re: Announcing the Direct2D Debug Layer @ Friday, November 13, 2009 8:20 AM

@Aisha

I also reported a bug via the documentation

resulting in a memory leak if creating a dxgi render target with the debug library enabled.  I did it via the link on the documentation though as I didn't see a place to do it via connect.  Just a heads up to ask them if you haven't heard anything ;)

JK

# re: Announcing the Direct2D Debug Layer @ Monday, November 16, 2009 4:52 PM

@ JK

Q:I also reported a bug via the documentation

resulting in a memory leak if creating a dxgi render target with the debug library enabled.  I did it via the link on the documentation though as I didn't see a place to do it via connect.  Just a heads up to ask them if you haven't heard anything ;)

A: The D2D debug layer keeps a number of zombied objects alive after release in order to catch over-release bugs. These shouldn’t be holding onto any expensive resources. How large a leak did you observe in this scenario?

-Aisha [MSFT]

Aisha Ayoub

# re: Announcing the Direct2D Debug Layer @ Wednesday, November 18, 2009 9:38 AM

Hi. I installed D2D debug layer and get "D2D DEBUG WARNING - A large number of unreleased interfaces were found. Currently there are [2001] unreleased interfaces allocated by this DLL.". I tried to find what is leaked, but everything looks good.

The question is how to get some kind of list of currently alive objects?

daVinci

# re: Announcing the Direct2D Debug Layer @ Saturday, November 21, 2009 8:32 AM

@daVinci

This warning is issued simply when a large enough number of objects have been allocated that we suspect there might be a leak. The threshold for the next warning is raised for each occurrence. If you continue to execute your app and the scene complexity isn't growing, and you keep getting this warning with higher object counts, you are almost definitely leaking. If you close your application and release the D2D factory (it must actually be finally released), you should receive a complete list of any outstanding objects at that point. These are pretty much guaranteed to be leaked.

Mark Lawrence

# re: Announcing the Direct2D Debug Layer @ Monday, November 23, 2009 7:15 AM

@Aisha

It held onto a dxgi render target which I needed to resize via the ResizeBuffers DXGI call on my swap chain.  That call failed because I couldn't release the render target due to the d2d debug layer.

JK

# re: Announcing the Direct2D Debug Layer @ Sunday, November 29, 2009 10:39 PM

@daVinci

Thanks for bringing this to our attention, we are currently investigating this issue.

Mark Lawrence

# re: Announcing the Direct2D Debug Layer @ Saturday, December 05, 2009 7:13 PM

Does the layer work under Vista SP2 + Platform Update?

Direct2D is working for me on my laptop.

I just installed the debug layer hoping to get some info.

I enabled the flag for options and passed it to the CreateFactory.

I don't see any output in the debug window.

Is there a registry or other setting change to make?

Thanks.

Keith

kalbr

# re: Announcing the Direct2D Debug Layer @ Monday, December 07, 2009 8:40 PM

@Keith

Q:

I just installed the debug layer hoping to get some info.

I enabled the flag for options and passed it to the CreateFactory.

I don't see any output in the debug window.

Is there a registry or other setting change to make?

A:

The Direct2D debug layer only outputs messages if it observes a likely error, warning  or a fairly certain performance issue. If there is a particular issue that you are trying to track down and you aren’t getting feedback from the layer, it would be useful to understand what this is. To see if the debug layer is running, check if D2D1Debug.dll is being loaded into your process.

Mark Lawrence

# re: Announcing the Direct2D Debug Layer @ Saturday, December 12, 2009 8:37 AM

Thanks Mark.

Yeah, I saw it loading.

My expectation was that there would have been a status msg (when using information mask).

You are correct it only outputs if there's a problem.  I saw it do that when I cached the render target and had too many cached brushes.

Keith

kalbr

# re: Announcing the Direct2D Debug Layer @ Tuesday, December 15, 2009 9:32 AM

@ Keith

>> My expectation was that there would have been a status msg (when using information mask).

Thanks for the feedback, we’ll look into this.

Mark Lawrence

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
Page view tracker