zoukankan      html  css  js  c++  java
  • [转]Using NVidia PerfHUD from within Visual Studio

    http://my.opera.com/adelamro/blog/2008/06/30/using-nvidia-perfhud-from-within-visual-studio

    NVidia has just recently released NVidia PerfHUD 6.0, an update of the extremely valuable and convenient tool for any serious Direct3D programmer. This tool alone is enough reason to make me not think twice before buying an NVidia card again on my next VGA upgrade. Oh, and another thing about Nvidia is that they have recently acquired Agia and accelerated physics has already become available on some Nvidia cards! The PhysX SDK is free too! NVidia Banzai up
    Here are some tips (or a description of how I do things) that might help you use this tool efficiently without problems while working in VS. I've posted some of this on GameDev.net and the NVidia developer forums, so some copy-pasting was used here.

    Go to Tools->External Tools and choose Add then give it a good title "NVidia perfHUD". In the Command box, point it to the NVidia perfHUD exe (not your exe). You will want to pass your exe as an argument, so in the Arguments box enter $(TargetPath) (no quotes). You will also probably need to set the Initial Directory to $(TargetDir) or $(ProjectDir). Then, use the "Move Up" button to move the new tool to the top of the list. Click Ok.


    Now, add it to the Debug toolbar (where it logically belongs). To do that, go to Tools->Customize... then from the Categories list (the list to the left) select Tools, then from the list to the right look for "External Command 1" (it's 1 because we moved NVidia PerfHUD to the top of the list earlier), then drag it and drop it on one of the visible toolbars (the Debug toolbar is the most reasonable choice).


    At this point, you can click on the newly added toolbar item to launch NVidia perfHUD with your exe. But you will probably want to add a keyboard shortcut to it. To do that, go to Tools->Options, and from the left select Environment->Keyboard. Now, in the text box titled "Show commands containing:", enter ExternalCommand1. This will narrow down the list to one item (which is the one we need). Then give it an intuitive shortcut (I use Ctrl+Alt+N and select Global from the "Use new shortcut in:" combo).

    Then, to make it look nice, customize the toolbar button and give it an image instead of having its title displayed. I recommend you grab the icon from the NVidia PerfHUD exe, convert it to a bitmap and use that.


    Also, it is likely that you will get problems with the current directory when you try to use PerfHUD (all code that uses relative file names such as "textures\particle.bmp" will fail). You see, PerfHUD apparently sets the working directory of the process to the directory containing the exe. By default, Visual Studio creates release executables in a .\release folder and debug excutables in a .\debug folder inside the project's directory, but when you run your exe from within VS, VS sets the working directory to be the project directory. The solution I use to this is to have VS write the exe directly inside the project's directory, and not in the .\release or .\debug subdirectories. This way, regardless of how you run your exe, the working directory will always be the project directory. To do that, go to the project's properties, and in the combo box titled "configuration" at the top, select All Configurations. Then in the "General" tab, set the Output Directory to be $(ProjectDir) and apply. Now, select Linker > General, and set the Output File property to$(OutDir)\$(ProjectName)_r.exe for the Release configuration, and set it to$(OutDir)\$(ProjectName)_d.exe for the Debug configuration. As you should be able to figure, _r stands for release and _d for debug.
  • 相关阅读:
    如何提高代码质量
    高效代码审查的十个经验
    代码质量管理(一)
    企业级分布式事务
    X/Open DTP——分布式事务模型
    patchca整合Spring MVC生成超炫的验证码
    兄弟,不要这样写服务器代码
    [转]预备知识—程序的内存分配
    [转]MMORPG服务器架构
    myEclipse使用有感
  • 原文地址:https://www.cnblogs.com/pulas/p/2511819.html
Copyright © 2011-2022 走看看