DirectX object naming
Thursday, December 9, 2010 | Permalink
The other day I was cleaning all the old files that have been collecting over time on my desktop, including a number of presentations and papers I hadn't bothered to read yet. Deep in a PowerPoint presentation I found a little note about a nice and hardly advertised feature of PIX and the debug runtime. By using the SetPrivateData(WKPDID_D3DDebugObjectName, length, name) function resources can be given a name. Having seen debug output from the debug runtime such as "Destroy Buffer: Name="unnamed" blah blah" before I suspected such functionality existed, but googling on it before didn't turn up any information. Although after bumping into it I found this entry on the Games for Windows and the DirectX SDK blog
Assigning names to objects is of course of great help when debugging things in PIX. Note that you need the June 2010 version of PIX for this to work.
I will include this functionality in Framework4 so that all resource creating functions take a name parameter, which of course will be passed along to the runtime. Speaking of Framework4, after long time with little or no time to work on it, I have lately made some decent progress on bringing it to something reasonably close to an initial release of. I hope to be able to release that in the not too distant future, together with my first DX11 demo as well, which is long overdue.
Monday, December 13, 2010
Nice to have names for everything. I personally wrap everything with BeginEvent and EndEvent in debug builds, with a logical grouping even events it really helps with debugging. There is also the SetMarker function which drops a marker into the event window, useful for plotting CPU times and general information. Will have to add SetPrivateData to my D3DProfiling regime, only question is does it work with D3D9 and D3D10 as well (for the fallback cases)?