Reprinted-how to debug shader with PIX for Windows

Source: Internet
Author: User

Http://hi.baidu.com/_%E2d_%B7%B3_%DE%B2%C2%D2/blog/item/6c5251d185c124d9572c84ae.html

 

Next, we will introduce how to debug the shader by using the tool pix for Windows that comes with the dx sdk. Here is a brief introduction. For details, refer to the documentation of the PIX. How to find the document? Open the DirectX documentation for C ++ under the dx sdk Start Menu. My version is from January 1, August. So far, it seems to be the latest version. Then:DirectX software development kit/tools/DirectX Performance Tools/pix.

Let's get started. First, let's select an example. Use the basichlsl demo provided by Microsoft. First, we need to compile and link ourProgram. For this demo, it is simply OK to comment out the following two sentences:

# Define debug_vs // uncomment this line to debug vertex shaders
# Define debug_ps // uncomment this line to debug pixel shaders

Now we should generate an executable file. My executable file address is: e: \ Documents ents \ Visual Studio 2008 \ projects \ directxsamples \ basichlsl \ debug \ basichlsl.exe remember it.

Then go to the menu and open the PIX for windows under dxsdk. If there is no accident, you should be able to see this interface:

Let's create a new experiment. The method is File> new experiment (PS: Ctrl + N or click the toolbar directly ). Then you will see the following interface:

As shown above, click Start experiment to start the application.

Note: Because pixel shader debugging is enabled, the system switches to the reference device. Therefore, a warning is displayed and the system will be stuck during running. However, hold on to it. The culprit is:

// debugging vertex shaders requires either ref or software vertex processing
// and debugging pixel shaders requires ref.
# ifdef debug_vs
If (pdevicesettings-> d3d9. devicetype! = D3ddevtype_ref)
{< br> pdevicesettings-> d3d9. behaviorflags & = ~ D3dcreate_hardware_vertexprocessing;
pdevicesettings-> d3d9. behaviorflags & = ~ D3dcreate_puredevice;
pdevicesettings-> d3d9. behaviorflags | = d3dcreate_software_vertexprocessing;
}< BR ># endif
# ifdef debug_ps
pdevicesettings-> d3d9. devicetype = d3ddevtype_ref;
# endif

After the program runs, let's pressF12Key. (It can also be another key, depending on your settings, you can go to the interface aboveMore Option.) Then let's exit and exit the wizard dialog box for creating a new experiment. Then, this interface is displayed:


OK. This is the sixth frame for analysis. Select render in the detail window, and select frame6in the event. Then you can see this interface:

Next, right-click a pixel and select debug This pixel.

 

Have you seen the link on the left? (Such as debug vertex0.) Click them to try.



Is it easy? This is a lightweight tool that does not occupy resources and is quite useful.

 

 

 

 

 

 

 

 

 

 

 

 

Haha. The same is true for Pixel:

 


I also just got in touch with the PIX and couldn't find any information everywhere, so I had to learn it myself. I hope this little bit of stuff will help you. In addition, the PIX is a very powerful tool. It can do more than this. It can also be used to check bugs to check performance consumption and play the role of NVIDIA perfhud ~~ Select the first option in the four options in the Wizard window ~~

You are welcome to share other good methods and usage. Thank you.

PS: Friendly reminder: if you cannot see the image clearly, you can use the features provided by IE7 to enlarge the webpage.

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: info-contact@alibabacloud.com 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.