d3dretrace: Dump screenshots from swapchains.

It works for D3D10, but it is still work in progress. Need to:
- Support D3D11
- Dump device context state too.

See issue #187.
d3dretrace: Helper COM smart pointer template.
d3dretrace: Dump screenshots from swapchains on D3D11 too.
d3dretrace: Restore state dump from swapchains.
d3dretrace: Use com_ptr<> in more places.

Fixing a few leaks in the process.
d3dretrace: Update d3d8 state dump to match d3d9.

Not thoroughly tested though.