First of all, PIX is your friend. I repeat: PIX is your friend! Make sure you can run this tool with your app and get the vertex and pixel shader debugging features working, this is invaluable... That being said, PIX is a little bit whimsical at times so you need to make sure that your app is complian with PIX, ie:
- Shaders are compiled in debug mode so you don't have to debug the assembly output but your actual code. This is done by passing D3DXSHADER_DEBUG | D3DXSHADER_SKIPOPTIMIZATION as flags to D3DXCompileShader(...).
- Having 0 warnings while compiling your shaders improves stability
- If you experience troubles, you can try switching to softvare vertex processing or using the reference device (whis is going to be super slow but helps catching some bugs)
Next thing is about 3D maths and how it is done on computers - both CPU and GPU... There are many reasons why maths can go wrong down the chain if you're not careful. The kind of questions I tend to ask myself to try and prove me wrong and then eventually right when I write 3D maths includes:
- Which coordinate system this Matrix/Vector is into?
- Should I do Matrix * Vector or Vector * Matrix ??
- Should I use this Matrix or it's inverse? Transpose?
- Is it Z-up or Y-up?
- Is it a left handed or right handed coordinate system?
- In that float4, what should the W component be?
I'll probably post separately about lots of 3D maths quirks so I'll have that reference material somewhere in a reliable place.
-m
No comments:
Post a Comment