- if (name[0] == 'C' && name[1] == 'G' && name[2] == 'L') {
- glretrace::retrace_call_cgl(*call);
- }
- else if (name[0] == 'w' && name[1] == 'g' && name[2] == 'l') {
- glretrace::retrace_call_wgl(*call);
+ while ((call = parser.parse_call())) {
+ bool swapRenderTarget = call->flags & trace::CALL_FLAG_SWAP_RENDERTARGET;
+ bool doSnapshot =
+ snapshot_frequency.contains(*call) ||
+ compare_frequency.contains(*call)
+ ;
+
+ // For calls which cause rendertargets to be swaped, we take the
+ // snapshot _before_ swapping the rendertargets.
+ if (doSnapshot && swapRenderTarget) {
+ if (call->flags & trace::CALL_FLAG_END_FRAME) {
+ // For swapbuffers/presents we still use this call number,
+ // spite not have been executed yet.
+ snapshot(call->no);
+ } else {
+ // Whereas for ordinate fbo/rendertarget changes we use the
+ // previous call's number.
+ snapshot(call->no - 1);
+ }