Analyze Direct3D Calls

You can use PIX to log all the Direct3D calls made by the target program. This is a convenient method of learning how the target program uses Direct3D. Because a log is simply a listing of the API calls, there are several empty windows when PIX opens the PIXRun file:

Viewing a Log of Direct3D Calls in the Event View

This analysis is done running the BasicHLSL sample and logging the calls made in frame 3. Here are the events you see when you run the experiment.

API Calls made by the Target Program

There are five events listed, starting with event number 1 and ending with event number 736. Expanding frame 3 shows that these events take place in frame 3.

The event view shows an event by event listing of all the API calls made in frame 3. The frame starts by clearing the rendertarget, followed by a call to BeginScene and goes right into SetTechnique. Followed by 733 other events. Notice that the first 5 events, say from event 4 - 9, are each Direct3D API calls made by the target program. So the call log shows all the Direct3D calls made by your target program.

API Calls made by D3DX

However, PIX does more than that. Skip down to event 17, which is BeginPass. Have you ever wanted to know what happens when BeginPass is called when rendering an effect? You can find out by expanding this node in PIX.

As you can see, BeginPass sets the vertex shader, updates a constant value, and sets the pixel shader. These API calls are not made by the target program, they are made by D3DX as a result of the target program calling BeginPass. You can use PIX to see API calls that are made by the target program as well as calls made by D3DX.

Also shown in the same figure is the detail behind a DrawSubset call. Notice that the target program calls DrawSubset, which calls SetVertexDeclaration, SetStreamSource, SetIndices and DrawIndexedPrimitive. So when you are profiling DrawSubset and trying to figure out why the profiler is returing numbers bigger than you expect, PIX can help you see the state changes that occur as a result of a single API call.

This example was done selecting the call logging option with an experiment using the basic view. This option defaults to the counters you see shown here in the event view. You may not customize the counters from the basic view when logging calls. If you need more control over the data collected, switch to the advanced view and customize your triggers and actions to choose from a very large set of counters.

See Also

User's Guide