Graphics Reference
In-Depth Information
2.
Within the Direct3D Initialization region, change the
CreateWithSwapChain call to pass in the debug flag:
Device.CreateWithSwapChain(
SharpDX.Direct3D.DriverType.Hardware,
// Enable Device debug layer
DeviceCreationFlags.Debug,
new SwapChainDescription()
{
3.
Next, we will replace the existing swapChain.Present with the following:
// Output the current active Direct3D objects
System.Diagnostics.Debug.Write(
SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects());
// This is a deliberate invalid call to Present
swapChain.Present(0, PresentFlags.RestrictToOutput);
4.
Debug the project ( F5 ) and there should be an exception thrown. The debug
output should contain something like this for the ReportActiveObjects call:
[0]: Active COM Object: [0x11BFB00] Class: [SharpDX.DXGI.
SwapChain] Time [05/17/2013 16:32:33] Stack:
c:\Projects\D3DRendering\Ch01_03Debugging\Program.cs(60,13)
: Void Main()
[1]: Active COM Object: [0x11A9C1C] Class: [SharpDX.Direct3D11.
Device] Time [05/17/2013 16:32:33] Stack:
c:\Projects\D3DRendering\Ch01_03Debugging\Program.cs(60,13)
: Void Main()
[2]: Active COM Object: [0x11ABE48] Class: [SharpDX.Direct3D11.
DeviceContext] Time [05/17/2013 16:32:33] Stack:
c:\Projects\D3DRendering\Ch01_03Debugging\Program.cs(60,13)
: Void Main()
[3]: Active COM Object: [0x11C0034] Class: [SharpDX.Direct3D11.
Texture2D] Time [05/17/2013 16:32:33] Stack:
c:\Projects\D3DRendering\Ch01_03Debugging\Program.cs(85,13)
: Void Main()
[4]: Active COM Object: [0x11E0A74] Class: [SharpDX.Direct3D11.
RenderTargetView] Time [05/17/2013 16:32:33] Stack:
c:\Projects\D3DRendering\Ch01_03Debugging\Program.cs(86,13)
: Void Main()
 
Search WWH ::




Custom Search