D3D: Filter redundant API calls by caching state in StateManager

All D3D resources are now set through StateManager, which allows to avoid most of redundant API calls.