(D3D) Start bringing over XDK code to d3d.cpp