Newsletter: Lowest prices viagra Viagra lowest price Buy cialis uk Buy viagra online cheap Phentermine very cheap Soma bike Phentermine hoodia diet pill Diet online phentermine pill purchase Herbal viagra alternatives Information viagra woman Cheap pharmacy viagra Effects of long term xanax use Viagra high blood pressure Order hydrocodone online Phentermine prescription diet pill Viagra online uk Phentermine with master card Cialis drug for impotence 2005 comment december leave viagra Cleocin Tramadol saturday delivery Viagra dangers Viagra for woman information Anti cialis impotence Phentermine money orders Vicodin prescription Discount phentermine prescription Purchase soma online Xanax photos Phentermine cod delivery Prempro Generic money order viagra Phentermine ionamin canada Cod diet phentermine pill Lexapro and xanax Cod xanax Purchase tramadol Cash on delivery phentermine Meridia vs. Phentermine Cialis levitra viagra compare Vicodin for sale Prescription free viagra Xanax dosage 3mg xanax Lamictal Sample viagra Drug loss phentermine weight Prescription xanax Prescription phentermine with cod payment Buy phentermine without a prescription Phentermine free shipping Information viagra Cialis comparison levitra Generic name viagra Xanax precriptions Free viagra trial Lotrimin Xanax and valium Xanax overnight delivery Free shipping with phentermine order Cyber pharmacy viagra Meridia Viagra online ordering Buy ambien online Meridia side effects Information about street drugs or xanax bars Generic uk viagra Meridia order Generic overnight viagra Phentermine pharmacies online Bob dole viagra Paris france cheep viagra Herbal online viagra Lowest price on phentermine Phentermine diet drug Buy phentermine shipped usps Online viagra Phentermine online consultation Viagra without prescription Comparison levivia viagra Concomitant use of cialis and levitra Viagra herbal Buy phentermine cod Tramadol 100 mg no prescription Xanax photo Buy viagra line Xanax prescription Alprazolam xanax over night Lopid Phentermine by cod Viagra overnight delivery Buy cheap cialis Viagra advertisements Tramadol 50mg Viagra buy in uk online Hydrocodone guaifenesin Tramadol dog Xanax death Xanax american express Buy viagra canada Ambien withdrawal Diet hcl phentermine pill Phentermine in stock ready to ship saturday delivery Pictures of mylan xanax Hydrocodone apap Phentermine from mexico Cheap cialis generic Herbal substitute viagra Vicodin es Celexa phentermine Drug screening phentermine Adipex diet phentermine pill Phentermine weight loss pills Comparisons on online viagra suppliers Dilantin Phentermine blue capules 100 mg viagra Hydrocodone info Cialis vs viagra Drug interaction sibutramine and phentermine Buying phentermine without prescription 50mg generic viagra Adalat Naproxen 37 effects phentermine side Lovastatin Vicodin online Buying vicodin online Lexapro Is klonopin stronger than xanax Cialis information Buy phentermine in the uk Glipizide Phentermine free consultation Cheap phentermine perscription Phentermine hcl Compare viagra price Pharmacy phentermine sister Online pharmacies with doctor consultation for viagra Prozac and phentermine Xanax dosages Phentermine and fast shipping Vicodin picture Xanax depression Next day phentermine 120 tramadol Viagra free pill Generic viagra cialis 25 mg viagra Order cialis uk Atropine Viagra on line Order xanax online Chemical name for viagra Levivia and viagra Xanax uses Tramadol effects Alesse Xanax tablet Xanax overnight Phentermine cod shipping Fda approved phentermine Xanax xr 3 mg Buy canada cialis Prescription weight loss medication phentermine Xanax effects Discount cialis online Cheap tramadol 180 Viagra generico impotencia Amiloride Viagra alternatives uk Buy generic xanax Phentermine from canada Chromium Hydrocodone cough syrup Viagra overnight delivery Xanax withdrawal symptoms Snorting phentermine Hydrocodone ap ap Real phentermine Online pharmacy duromine viagra international Cialis tablet Phentermine forums and chats Phendimetrazine No prescripton phentermine Drug screening phentermine Colon cleanse ambien Order ambien online Soma online Buy online tramadol Phentermine weight loss pill Overnight tramadol Viagrafix corporation Lipitor Veterinary use of tramadol Phentermine us Phentermine online prescriptions Lisinopril with viagra Xanax long term use Buy hydrocodone overnight Alcohol hydrocodone Viagra soft tabs Different types of phentermine Cialis dysfunction erectile levitra viagra Phentermine delivered overnight Phentermine online no prescription Fioricet Buy cheapest online place viagra Saturday delivery cheapest phentermine Filing income tax buy tramadol Phentermine no doctor Phentermine pharmacy cod Cheapest secure delivery cialis uk Drug interactions tramadol elavil Ash of soma Cialis online sales Dog xanax Pulmonary hypertension viagra Xanax on line Cheap tramadol cod No prescription cialis Best viagra prices online Herbal viagra Xanax online prescription Phentermine resident sale virginia Viagra sales uk Viagra xenical Xanax death Does it viagra work Viagra online order guide Cheapest diet phentermine pill Phentermine 37.5 no prescription Viagra patent expiration Cialis info Cheap price on phentermine Free viagra canada Phentermine prescriptions online Viagra for sale Order phentermine cod Viagra story Generic ambien Buy pal pay phentermine using Valium vicodin Ambien cr Best price phentermine Phentermine no rx needed Viagra shelf life Best viagra prices online Fastin phentermine Purchase phentermine Purchase fioricet Fioricet order Cheapest phentermine Buy soma Cheap phentermine perscription Alternative to viagra drug Non prescription phentermine Add link phentermine purchase Phentermine 180 Advair Low price phentermine Cialis review Xanax online overnight Tramadol drug Natural viagra free samples Online phentermine prescriptions Otc viagra How do i stop taking phentermine Female viagra alternative Lowest price viagra Herbal phentermine forum Cialis forums Buy phentermine tablet Viagra generico impotencia Cialis viagra Online consultation phentermine Grapefruit xanax Herbal viagra Buy vicodin without prescription Inform your doctor medication phentermine dose weight Information viagra woman Hydrocodone withdrawal symptom Difference between cialis and viagra Buy viagra online uk 100 mg tramadol How viagra works Buy phentermine with no prescription Clomipramine Viagra info Cialis levitra better Killer pain tramadol Diet online phentermine pill Cheapest phentermine online no prescription Augmentin Get phentermine Blindness viagra Hydrocodone for ibs Hydrocodone effects Stopping xanax Xanax libido Buy cialis soft tabs Ambien side effects Generic cialis uk Viagra dose Xanax pics Oxycontin xanax bars percasettes and lor tabs Buy phentermine online cash on delivery Saturday delivery phentermine Order phentermine online 5 buy online no prescription Diet phentermine pill Fioricet medication Discount phentermine online Generic fioricet Phentermine 37.5&90 $89 mastercard Cialis eli lilly Cialis no prescription Viagra pill picture Cialis online discount Phentermine meridia xenical review Order xanax on line Does phentermine speed up metabolism Fioricet info Phentermine pharmacy cod Phentermine addiction Online xanax prescription Phentermine cod overnight Cialis tablet Cheap diet phentermine pill Soma getting Buy cheapest online viagra Buy cheap no phentermine prescription Cheap viagra canada Tools needed for injecting xanax Buy viagra pill online Buy phentermine prozac Tramadol dosage for dogs Ecotrin Generic viagra online Xanax overnight shipping Generic meridia Cheap viagra pills Phentermine amide Compare generic viagra prices Ephedrine 150 tramadol Urine drug testing of tramadol Alternative to viagra online Prescription order viagra online What is phentermine How long xanax stays in system Tramadol use in dogs Free phentermine prescriptions Generic soma Viagra prescriptions online Drug vicodin Phentermine 15 mgs Cheap phentermine without a prescription Buy viagra in uk Ambien and pregnancy Mastercard phentermine Phentermine hormone Hydrocodone lortab Taking viagra or levivia as a booster for cialis Phentermine on line w&o prescription Cheap tramadol cod free fedex Best cialis price Hyzaar Cheapest phentermine 90 day orders Viagra without a perscription Ambien on line Maxzide Online viagra sales Ssri phentermine heart Free sample prescription for viagra Buy viagra internet Phentermine diet medication Buy online viagra where Mexican phentermine Viagra cheap prescription Buy xanax online without a prescription Picture of generic xanax Good morning viagra commercial Negative side effects of phentermine Diet ingredient phentermine pill Tramadol dosage Appetite suppressants equivelant to phentermine Phentermine and blood in stool Soma addiction Add a link viagra Generic viagra cialis Viagra free pill How long xanax stays in system Nortriptyline Buy xanax no perscription needed amex accepted Is viagra safe for woman Xanax info Cheap tramadol without prescription Cialis new viagra Effects long phentermine side term Vicodin withdrawal Ionamin phentermine Purchase tramadol without a prescription Cialis drug prescription Paris cheep phentermine Viagra tablets Phentermine gynecomastia Hydrocodone info Inexpensive viagra Canada xanax Does phentermine help weight loss Paris france cheep viagra Finasteride 100 phentermine How fast does phentermine work Cialis comparison levivia viagra Order cialis uk Buy phentermine Cialis for woman Diet phentermine Ambien prescription Cheap discount phentermine Phentermine forum Free viagra without prescription Canadian pharmacy phentermine 90 cod count day phentermine How long does xanax stay in your body Tramadol avinza drug interaction Inject xanax Cialis price 5 cheap Kaopectate Cialis viagra Picture of xanax pill Phentermine discount Permax Xanax drug testing Cyber pharmacy phentermine Drug interaction xanax and holy basil Buy cheap fioricet No prescription phentermine free shipping Lowest prices on phentermine Is phentermine addictive How to inject xanax pills Ambien online Physican's desk reference phentermine Phentermine canadian pharmacy Phentermine tablet Phentermine diet pill side effects Amphetamine Afrin Buy viagra 1 Viagra overdose Generic ambien Ambien overnight Tramadol cheap Phentermine hcl side effects Phentermine 37.5mg tablets What does phentermine do to your heart Viagra testimony Order phentermine c o d Cheap prescription viagra Viagra on line uk Best online deal for phentermine Premphase Viagra prescriptions Fda us approved phentermine Order xanax paying cod Buy generic online phentermine Ambien cr dosage Can i buy phentermine anywhere in uk Generic soma Phentermine purchase Buy herbal viagra Female viagra Xanax for anxiety Viagra prescriptions Cialis injury lawyer ohio Phentermine sales What does phentermine look like Phentermine and sibutramine be combined Tramadol prescription Viagra pill picture Xanax next day delivery Mark martin viagra Generic viagra in canada Buy no phentermine prescription Viagra and levivia Erection viagra Phentermine risks Epivir Diet discount phentermine pill No perscription xanax cheap Phentermine hoodia Importing cialis from canada to us Xanax valium Viagra substitutes Buy xanax without prescription Xanax 2mg Fioricet phentermine shipping Cheap phentermine online 37 5 Buy vicodin without prescription 180 phentermine Mexican pharmacy phentermine Phentermine blogging Xanax cod 50mg generic viagra Buy online viagra Phentermine shortage Phentermine fact Compare prices tramadol

A PIX debugging session

Here’s an article I’ve been meaning to write for a little while. It’s about PIX, the DirectX utility that ships with the DirectX SDK. It’s a great utility for tracking down rendering issues. The point of this article isn’t really to explain it in great detail, because it’s easy to use. It’s mostly to expose people to the tool and encourage you to check it out! This is a debugging session I did after tracking down a crash bug in dynamic cubemaps in the upcoming TGEA release. The crash bug was pretty easy to find. But when I fixed it, I got this result:

The “spider ball” in this image should be reflecting the tower it is next to, what gives? Let’s use PIX to figure it out. First, to launch PIX, find it under DirectX Utilities under the DX SDK folder. You’ll get a blank screen. Next, select File->New Experiment. Then for “Program Path”, enter the path to your executable. Then, select the “A single-frame capture to Direct3D whenever F12 is pressed.” radio button. Finally, hit the “Start Experiment”. This will launch the app. The next step is to get your app to render your bug. In this example, I moved the camera so I was looking at the spider ball again and hit the F12 key. The game will pause while PIX records all of the DirectX API calls and state into a log file. Then quit. You’ll end up with a screen like this:

The treeview in the lower left pane is a list of all DirectX calls made during the frame that was recorded. If you click on the render tab in the right pane PIX will show you the scene up to the API call selected in the left pane. You can learn a lot about how an app renders by just hitting the “D down” button and watching the scene draw step by step in the render pane.

It’s cool to have all of this information at our fingertips, but it’d be cooler if we could filter it down to what we’re interested in. By right-clicking on a pixel in the scene and selecting “Debug This Pixel” we can do just that.

This will replace the render view with a list of all of the API calls that changed the color of that pixel. It’s a life story of that pixel for that frame. You can click on each of the links displayed to move the current selection in the treeview in the left hand pane to that API call.

In this next image, I just picked the first pixel that was black, which should get me to the API call I feel is generating the wrong image. It’s event 2893.

Now we can examine the state of D3D at the time of this call. This is awesome stuff! Rendering with DirectX (and OpenGL) basically involves setting up a large state machine. The types of states are rendering states, textures, texture sampling states, shaders, shader constants, and the list goes on. If any one of these states is incorrect, you’ll get rendering bugs. They can be hard to track down without a tool which allows one to examine the state of D3D. Often we have to do ad-hoc state checks by dumping textures to disk or querying the device and logging the state info out to a file. PIX provides the ability to check state without modifying your code. Getting back to my dynamic cubemap problem, the first question we must answer is: Is the dynamic cubemaptexture being rendered correctly? If it is being generated correctly, are we actually using it during the draw call? Let’s find out! Double click on the blue hexadecimal address to the left of the API call in the treeview in the left hand pane. In this example, it’s 0x056150D8. This will change the right hand pane to a view of the device. We can see a lot of state here. I want to look at the textures, so I choose “Pixel State” from the tabs and scroll down to the “Sampler” section. This section allows one to look at all of the current textures that are active during a draw call. Many bugs are just due to the wrong texture being bound, or no texture is bound at all!

To actually look at the texture, just double click on the blue hexadecimal address in the “texture” column. In the next picture, you can see the cubemap texture has data in it! This is good news, that means I can ignore all of the code that deals with generating the cubemap.

Next, I wanted to look at the pixel shader code that is used. Mostly because I forgot how the cubemap was working at the time. I wanted to see what other dependencies it might have: other textures, shader constants, etc. To do this, go back to the debugger frame that showed the history of the pixel and click on “Debug pixel (xx,xx)”. This will bring up the pixel shader that was used.

Looking at the shader, it only samples the cubemap and doesn’t rely on any shader constants. It’s time to look at the vertex shader to see what it passes to the pixel shader. To do this, just select “Debug Vertex X” in the history view.

Looking at this dump really fast, I could see that it needed to have these vertex shader constants: $modelview @ position 0, $cubeTrans @ position 16, and $cubeEyePos @ position 19. Let’s check the vertex shader constants and see if the data is good. To do this, select “Vertex State” from the tabs and scroll down to the vertex shader constants.

Oh crap! Look at positions 16-19, it’s full of zeros. So the cubemap transform isn’t getting set! I quickly searched the code to see what sets them up and found out that they’ll only be set if the material has “dynamicCubemap” set to true! D’oh! I fixed the material and got the following screen:

That was literally my debugging session, it took about 5 minutes. It could have taken a lot longer if I didn’t have the right tool. Hopefully, this was a good introduction to PIX. There are other uses for it: performance monitoring, resource usage, but this is what I use it for the most. I hope this article makes you reach for PIX the next time you have a rendering bug.

Post a Comment

You must be logged in to post a comment.