Merge pull request #1503 from kayru/d3d_optimization_cache D3D: Filter redundant API calls by caching state in StateManager