Debugging plus

Yesterday I had a cool debugging session while working on my HDR demo. One of postprocessing filters produced weird results and I went off to investigate that. The usual tricks: debugging in Visual Studio to make sure right sample offsets are generated; D3D debug runtime, D3DX debug, reference rasterizer, firing up NVPerfHud and doing frame analysis, doing full capture with PIX and inspecting device state, etc.

Nothing helped.

Then I noticed that in the pixel shader, I wrote
sample = tex2D( s0, uv + vSmpOffsets[i] )
instead of
sample += tex2D( s0, uv + vSmpOffsets[i] )
Aaargh. So much for a plus sign.

How to deal with such bugs? Why some bugs are trivial to find, and some are hard? Why sometimes (often?) the time required to find the bug does not correlate with bug's "trickiness"? Why sometimes I can find a tricky bug in big unknown codebase in a couple of minutes; yet spend two hours on the plus sign in my own small code?

I've got no answers to the above.

By the way: PIX is a great tool, but D3D guys should really polish the UI :)



Jumped onto HDR bandwagon

I'm doing a small HDR demo for fun. Nothing fancy - linear gamma, Reinhard's tone mapping and whatnot - everyone does that. But the thing I made so far does not even look good! :)

I'm trying to support both HDR and FSAA at the same time on ordinary DX9 hardware (no Radeons 1k) by using RGBE8 rendertarget for the main scene. It's all okay so far.

The most difficult task right now is making it look good. Once I have that I'll post the results.



Bought Rag Doll Kung Fu

Like I promised :)

It ownz, period.




Headphones on, winamp alternatively playing The Jupiter Sound and Four Themes and a Masterplan by Little Bitchard. Just the right kind of music for asp.net coding. At least the music is good :)



An article on efficient D3DX Effects state management

I wrote an article on the subject I was talking about recently - an auto-magical system that manages device states in the effects. The article and links to implementation are on my homepage here: nesnausk.org/nearaz/texts/d3dx_fx_states.html