Yes, but you'd want your per-frame code to be called as early as possible after a swap so that your code has as much time as possible to do work without missing the next swap (YMMV of course if there's a pipeline of buffered frames waiting for presentation - but this should be kept low to reduce button-to-screen latency).