D3D: Implemented cache for dynamic render states