D3D speedups

This PR picks 4 commits of galop1n's D3D branch which are simple d3d backend changes.
Maybe change this to an unsigned int, since that's what UpdateSubresource takes as an argument where it's used.