// From d3d10.cpp