Visual Studio Graphics Debugger

来源:互联网 发布:小型机房网络拓扑 编辑:程序博客网 时间:2024/04/27 14:02

Visual Studio Graphics Debugger

Visual Studio Graphics Debugger(VS图形开发调试工具)支持在VS2013IDE中动态调试shaders。如果你熟悉之前版本的DirectX,你可能使用过图形调试工具PIX。Visual Studio Graphics Debugger已经取代了PIx但是基本的工作流程保持一致。


警告:
VS2013 Express版本并不支持Visual Studio Graphics Debugger。要使用这个调试工具,需要购买一个收费版。但是不必担心,你可以在没有VS Graphics Debugger的帮助下完成本书中的全部工作。


从VS主菜单上选择Debug-->Graphics-->Start Diagnostices,或者按Alt+F5就可以启动调试器。同时会启动应用程序,并在VS编辑栏中增加一个名称为Graphics Experiment.vsglog的选项卡。按下Print Screen键可以从运行中的程序截取单个帧的诊断信息。截取的图片会被添加到Log标签的侦列表中,允许在应用程序中多个不同的断点处分别截取不同的图片帧。
调试shaders与调试传统的应该程序完全不一样。回想一下,shader执行时是操作单个vertices和pixels。所以需要指定想要调试的pixel(同时也指定了对应的primitive)。在截取的图片帧上移动鼠标选择一个pixel,此时光标会变成一个放大的红色十字(如图3.8所示)。使用十字光标选择某个pixel时,会在Graphics Pixel History panel显示对应的记录。如果没有看到History panel,在VS的主菜单上选择Debug-->Graphics-->Pixel History。

图3.8 The Visual Studio Graphics Debugger log with a pixel selected from a captured frame. (Texture
by Emil Persson.)

选中某个pxiel,就可以在Graphics Pixel History panel中看到所有该pixel关联的绘制调用。可以扩展其中的一个用于绘制primitives列表。在扩展成一个primitive后,就可以观察到图形管线的多个阶段,比如提供shaders的阶段,以及output-merger阶段。注意图3.9中位于vertex和pixel shader后面的Play和Stop图标。点击某个shader后面的Play按钮就开始调试该shader代码。调试shaders的过程中,VS的调试窗口面板都可以使用(比如,Call Stack,Locals,Watch Windows)。后面几章会更加详细的讲述shader调试方法。


图3.9 The start/stop shader debugging buttons within the Visual Studio Graphics Debugger.


注意:
在图形调试过程中,如果你希望继续截取图片帧,那么不要关闭vsglog的选项卡。关闭该选项卡会停止图形调试进程,但不会停止应用程序。而是由常规的VS调试器来进行调试,但是图形诊断器结束运行,直到重新启动应用程序(或者按Alt+F5)。


Graphics Debugger Alternatives

你可能会使用AMD的GPU PerfStudio2和NVIDIA的Visual Studio Edition来代替Visual Studio Graphics Debugger。这两款工具都是免费的并提供了强大的功能。特别是GPU PerfStudio 2,对于使用VS的Express版本的开发来说是一个非常好的替代名,因为他是一个独立的工具不受限于你所便有的IDE。可以在本书的配套网站上找到这些工具的链接。


总结:
本意主要讲述了本书中所有使用的图形开发相关的工具。讨论了VS2013的用法,以及用于DirectX应用程序开发的主要库文件。也介绍了用于开发shader的NVIDIA FX Composer工具。最后,讲述了使用Visual Studio Graphics Debugger截取诊断信息并动态调试shader的方法。本意是第一部分,“An Introduction to 3D Rendering.”的结束,在下一章,将深入讲解shader开发创作。


Exercises

1. Set up your Visual Studio 2013 installation and the libraries discussed in this chapter. Visit the book’swebsite for links to these resources.2. Install NVIDIA FX Composer and experiment with the interface. In particular, explore the Render panel tobecome familiar with the camera controls. Add a sphere, teapot, torus, and plane to the Render panel, andmodify them using the mode keys Q, W, E, and R (translate, rotate, and scale).



0 0
原创粉丝点击