Maybe it is better using the on_d3d_reset event?