Game Development Reference
In-Depth Information
such as series of if/then/else statements, or to debug mathematical expressions by
stepping and watching how the variable values change after each step.
Parallel Nsight supports two stepping commands: Step In and Step Over. On
a line of source code that contains no function calls, both of these step commands
simply execute the current line of source code pointed to by the program counter
and moves the program counter to the next line of source.
However, if the source line does contain a function call, Step In will step to
the actual next line of source code to be executed, which is the first line in the
function called from the current line of source. Conversely, Step Over will execute
all instructions executed by the function call and will increment the program counter
tothenextlineofsourcecodeinthecurrentscope.
You can also use the Run To Cursor functionality of Visual Studio, but as of
Version 1.5 of Parallel Nsight, the Set Next Statement function does not work when
debugging HLSL shader code.
Inspecting variables and evaluating expressions while debugging. Once stopped
at the source line of interest, another important capability is the ability to see the
values of variables in the source code.
To accomplish this, Parallel Nsight fully supports the built-in Visual Studio
Locals and Watches tool windows. These windows are active once the debugger has
stopped at a particular line of code and show you the value of variables (Locals) or
user-defined expressions (Watches) in the current debug focus.
The Locals Window is populated automatically with all variables local to the
scope where the program counter is pointing, while the Watches window allows a
developer to enter an arbitrary expression to be evaluated in that same context.
Both windows can be used in combination with breakpoints and stepping to view
the values at particular places in the computation. As of Version 1.5 of Parallel
Nsight, you cannot set the value for any variables.
The Graphics Debug Focus. Thus far, the functionality of the Parallel Nsight
shader debugger has focused on debugging a single primitive, for example, a pixel.
However, GPUs are inherently parallel processors, and as such, there are often
several primitives in flight on the GPU at any one time. When halted at a
breakpoint in a shader, the Graphics Debug Focus tool window offers a way to
switchfocustoanyotheractiveprimitiveontheGPU(see Figure21.8 ) .Switch-
ing focus will also switch the Locals and the Watch tool windows to show infor-
mation and evaluate expressions in the context of the newly focused primitive's
code.
Switching focus to a different primitive type or shader will also switch the cur-
rent program counter in Visual Studio. The Graphics Debug Focus always opens
on a summary page, which shows you all of the different primitives currently in
flight. Primitive-specific context and visualization can be found by switching to
the primitive-specific tabs, such as the pixel or the vertex tab.
Search WWH ::




Custom Search