[In this Microsoft-sponsored article, part of the Gamasutra XNA microsite, the team behind graphics debugging tool PIX explains the improvements in the June 2008 release, also revealing a sneak peek at upcoming additions to the tool.]
PIX for Windows® is a comprehensive graphics debugging/optimization
tool that records detailed information about an application's use of Direct3D®.
PIX collects data for a single rendered frame or a continuous stream of rendered
frames. It can include logs of Direct3D calls made by the application, performance
counter data, screenshots, and much more.
With PIX, you can step through the function
calls and shader instructions executed by your application and see exactly how
the final frame image is constructed. This is a powerful way both to track down
bugs and to identify inefficient usage of Direct3D.
This article focuses on the new features and improvements
that were made in the June 2008 release of PIX for Windows, which you can find
in the DirectX
SDK, and gives a sneak peek at what is to come in future versions.
Figure 1. PIX for Windows (click for full size)
Advanced Draw Call Support
The June 2008 version of PIX improves support for draw calls
in a number of key areas. The Render view, Mesh view, Pixel History, and Shader
Debugger have all been updated to support Direct3D 9's hardware instancing and
Direct3D 10's DrawIndexedInstanced, DrawInstanced, and DrawAuto functions.
When viewing instanced geometry in the Mesh view, note that the
Post-Vertex Shader tab, Post-Geometry Shader tab, and the Viewport pane now
display the vertices and primitives for all instances generated by the original
Analyzing a particular pixel using the Pixel History or
Shader Debugger allows you to drill down to each instance rendered by the
instanced draw calls.
Figure 2. Render view support for draw instancing (click for full size)
Predicated draw calls were introduced in Direct3D 10 as a
means to skip draw calls on the GPU, without needing feedback from the CPU. For
instance, you could conditionally draw some complex object based on whether a
lower resolution model of that object, such as its bounding box, is visible.
The occlusion test for whether the simple object is visible or not, and the
conditional drawing of the complex object, both happen on the GPU without
having to deal with the complex threading issues of communication between GPU
and CPU. This predication mechanism has been used effectively in professional
titles as a simple and powerful way to do scene graph culling on the GPU.
PIX now supports Direct3D 10's ID3D10Predicate objects during capture and when viewing geometry in
the Mesh view.
One of the most common ways to use PIX is in single-frame
capture mode. In this mode, the user launches the target program from PIX,
navigates to an area where there is a rendering glitch or performance problem,
then triggers a capture of a single frame for analysis. With previous versions
of PIX, the target program would run noticeably slower while in this mode. This
overhead has been drastically reduced in the June 2008 version of PIX, making
it much easier to get to the frame of interest.
In addition, PIX's overall memory footprint has been reduced, which
boosts performance and decreases the likelihood of a memory failure.
Figure 3. A single-frame capture (click for full size)