D3D: Wrap context to do prune redundant state changes