Bunch of things working towards d3d support