Direct3d program debugging tool pix

Source: Internet
Author: User
A painless introduction to pix for Windows

For those interested in game development technology, it's been a great week of product releases! Monday we saw the 1.0 Release of xNa game studio Express. wednesday brought the release of the December 2006 version of the DirectX SDK, which has des the product I work on, pix for Windows. friday, Visual Studio 2005 SP1 was released. congratulations to everyone involved with these products!

I thought I 'd write a short introductory article on using pix for Windows. PIX can be used in your different ways to analyze, debug, optimize, and test programs that use direct3d, and it has a lot of features -- so it might be a bit intimidating at first. the basic usage pattern is pretty straightforward, though, so if you haven't ever used pix before, maybe this walkthrough will encourage you to give it a try. whether you write programs using native direct3d, managed DirectX, or xNa, pix can show you a lot of useful information about what your program is doing and how you can make it work better.

I recommend that you download the December 2006 dxsdk (and newer versions as they are released), since pix gains new features and improvements with each release.

Once you have the dxsdk installed on your computer, you'll find the PIX under the Start menu:


--> Microsoft DirectX SDK (December 2006)

--> DirectX utilities

--> Pix for Windows

The first thing you need to do in pix is to createExperiment(Use file --> new experiment). An experiment tells pix how to run your program (calledTarget Program) And what to do while target program is running. You can create complex experiments to do all sorts of fancy things, but probably 90% of the time you simply want to do something like the following:

Note that I 've set the "program path" to the executable for my feedback xNa program, and chosen to gather "A single-frame capture of direct3d whenever F12 is pressed ."

That wasn't too hard to set up... let's see what happens! Click "Start experiment" to launch the target program under pix.

PIX overlays some information on top of the target program while it runs. when you press F12, you shocould see the file size jump from zero to a few megabytes (the size varies depending on the program ). this lets you know that the capture took place, and you shoshould close your program at this point. PIX responds by bringing upRun FileRepresenting the data that it gathered.

The run file window is divided into severalPanesThat show different kinds of information. you can drag the separators between the panes to show the most information on the panes that you currently are interested in. note that in the window menu, you can choose "Save As custom pane layout" to have pix automatically use your pane layout every time you open a run file. for now, we're not interested in the timeline pane, since it is usually not very helpful for single-frame captures, so use the separators to divide the screen space between the remaining panes.

The events pane shows one row for eachEventIn the capture, including one event for each direct3d call. you can use the "+" icon to expand events that contain other events. for now, click the frame event to select it. now click the render tab in the details pane, And You shoshould see the result of rendering that frame.

The render tab always shows the contents of the back buffer as of the currently-selected event. so you can watch your frame render bit by bit, by selecting each draw call. the "d Down" toolbar button makes this easier; it moves to the next draw call. (but see below for a note about programs that change the render target ).

When a draw call is selected, the mesh tab shows useful information about the vertex data that was processed by the graphics pipeline. you can see the data both before and after going through the vertex shader, and see where it ended up relative to the viewport.

Note that several object pointers are shown in blue text. this indicates that pix can show more information about the objects. for most object types, you can right-click a blue pointer and choose to view the object. this brings up a new tab in the details pane that shows the object contents. viewing the direct3d device object lets you see all the settings for the device, including all the render state and bound objects such as vertex buffers, index buffers, and textures.

If your program uses multiple render targets (as the feedback program does), You shoshould keep in mind that the render tab shows the contents of the back buffer, not the current render target. so you shoshould find the setrendertarget call and bring up a view of the render target to see the drawing happen on that surface. the tab for the current render target has a little icon next to it.

I hope this gives you a sense of how pix can help you examine your program's usage of direct3d. give pix a try and see if it gives you ideas on how to make your program run better! I'll give more examples of using pix in future posts.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.