Lots of fixes and D binding improvements.

* Lots of improvements to D bindings.
* const correctness fixes in MFStateBlock.
* Fixed MFPrimitive, which was broken when submitting multiple MFBegin() sequences.
* Added Viewport state to the renderer (D3D9 only so far).