The COMPLETE Effect and HLSL Cross-Reference

By Sebastien St-Laurent
ISBN 0-9766132-1-2
Jan 2006 (896 pages)

Buy directly from Paradoxal Press at $20.75 (Save 43%)

Page 154

...section, our transformation matrix was named WorldMatrix, which implied in itself that the parameter was the world transform matrix. This also implied that you would have to stick to this precise name for each of your effects if you wanted your application to work properly. If you were to change the...

Page 92

...emantics can easily be divided into four categories: vertex shader input, vertex shader output, pixel shader input and pixel shader output. Over the next few pages, I will present the four categories in a set of tables describing the semantics and their meaning. Keep in mind that in the tables below...

Page 111

...e to set the proper render states, set up your textures and constants. In addition, with the proliferation of more performant video cards came the introduction of new shaders, which have put a new burden on developers who want to reach a broad audience. Not only do you want to have the best looking ...

Page 100

...ber of components passed to this function can make a signi.cant performance difference. Another classic example of performance difference would be to use the mul function to apply skinning to a vertex using a 4-by-4 matrix when in reality a 4-by-3 matrix is needed, causing the compiler to generate 1...

Page 148

...meter is a handle to the parameter for which you wish to check the usage. The second parameter, hTechnique, is also a simple handle pointing to the technique at which you wish to look for parameter usage. This function returns a boolean value indicating if the speci.ed parameter is used within the s...

PIX Tutorial: Comparing Image Quality

This tutorial demonstrates how to use the PIX tool to generate screen shots of rendered frames, and how to compare per-pixel rendering results for frames rendered on hardware abstraction layer (HAL) and reference device types (see Device Types). The tutorial is divided into the following tasks:

Setup

The PIX is located at:

(SDK root)\Utilities\PIX\PIXWin.exe

The DirectX SDK contains many sample applications that can be tested with PIX. Executable sample applications are located at:

(SDK root)\Samples\C++\Direct3D\Bin

Duration

This tutorial will typically take 10-15 minutes.

Step 1: Create an Experiment to Grab a Screen Shot

Create an experiment for taking a screen capture at frame 1000 of the ShadowVolume Sample. This will require that you modify the experiment's default trigger and default action.

  1. Launch PIX (see Gathering Data_in the Basic View).
  2. In the PIX File menu, select New Experiment.
  3. Click More Options to go into the Advanced View.
  4. In the Trigger Type selection box, select Frame. You should see the following view:

    Figure 1.  PIX Advanced View with frame trigger selection

The Advanced View (unlike the Basic View discussed in PIX Tutorial: Gathering Data in the Basic View) is designed to let you enter triggers and actions directly. The following procedure will allow you to capture a screen shot capture at frame 1000:

  1. Make sure the T (for Trigger) is highlighted, and then enter "1000" in the Frame box.
  2. Click the A (for Action) so that it is highlighted.
  3. In the Action Type selection box, select Grab Screenshot.
  4. In the Path to screen shot box, either click the Browse button and locate a directory where you want to save the file, or type the file's directory path in the text entry box.

Figure 2.  PIX Advanced View with screen shot selection

Note    If you need to ensure deterministic behavior in your development environment, you should run your application with the -constantframetime command-line argument when you take screen shots for comparison.

Step 2: Generate a Screen Shot on a HAL Device

Now that you have your experiment set up, click Start Experiment. The following screen shot is generated:

Figure 3.  Screen shot of ShadowVolume sample frame 1000, on a HAL device

PIX screen captures can be saved to file formats .bmp, .dds, .jpg, .png, or .tga. For more information on these formats, see D3DXIMAGE_FILEFORMAT. Use the Texture File Converter Tool to convert to and from other file formats.

Step 3: Generate a Screen Shot on a Reference Device

Now rerun the experiment with a reference device. To do this, you will need to generate another action that switches the device to a reference device.

  1. First delete the existing trigger. Select the trigger, and, on the experiment toolbar, click the X button. Alternately, right-click the existing trigger and select Delete this Trigger.
  2. Add a new trigger action by selecting Add Trigger from the Edit menu, or click the T button on the experiment toolbar.
  3. In the Trigger Type box, select Frame. The numeral 1 should appear in the Frame box immediately below.
  4. Click the action icon titled Unspecified Action.
  5. In Action Type, select Modify D3D Device.
  6. In Device modification, select Force REF.
  7. From the Edit menu, select Insert Trigger, or click the T button on the experiment toolbar.
  8. In this second Trigger and Action, set up a screen shot at frame 1000 just as you did in Step 1: Create an Experiment to Grab a Screen Shot .

The experiment view should now look like this:

Figure 4.  PIX Advanced View with triggers set at frames 1 and 1000

Once again, run the experiment by clicking Start Experiment. This will generate the following screen shot using the reference device:

Figure 5.  Screen shot of ShadowVolume sample frame 1000, on a reference device

Step 4: Compare the Screen Shots

You can view a per-pixel comparison of the screen shots to see how they differ between HAL and reference device types. Because the differences in the images are subtle, you can use the file comparison feature of PIX.

From the File menu, select Compare Images. The following user interface is displayed:

Figure 6.  PIX Image Compare utility

  1. Click Source 1.
  2. Click the "Open Folder" button (

    Figure 7.  Open Folder button

    ) and browse to the first file to use in the comparison.
  3. Click Source 2 and browse to the second file to use in the comparison.
  4. Click Compare.

Alternately you can drag one or two image files onto the PIX window to display or compare the images.

The resulting display shows the RGB differences between the corresponding pixels in each of the two original images:

Figure 8.  PIX Image Compare display of HAL vs. reference screen shots at frame 1000

From the PIX View menu, select Extended View to display a simultaneous view of both original images and the comparison image. If necessary, resize the Image Compare window within PIX to display all three images. Cancel the Extended View selection to display the individual images one at a time.

The Image Compare utility can act upon files in the following formats: .bmp, .emf, .exif, .gif, .icon, .jpg, .png, .tif, and .wmf.

See Also

PIX Tutorial: Gathering Data in the Basic View PIX Command-Line Options: Open an Image File in the Image Compare View IX Command-Line Options: Save a Comparison of Two Image Files