X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glretrace_main.cpp;h=cd35889c9dff873303dd27d26274829d296e664d;hb=0f0a598677d6d1c97be830c5fa20d6187480aa52;hp=3a900927a128a3d6d46ec0055002d03f964f7fe6;hpb=46963dad18214fc45b248ecdc9f5931cf417705d;p=apitrace diff --git a/glretrace_main.cpp b/glretrace_main.cpp index 3a90092..cd35889 100644 --- a/glretrace_main.cpp +++ b/glretrace_main.cpp @@ -103,6 +103,37 @@ checkGlError(Trace::Call &call) { std::cerr << "\n"; } +/** + * Grow the current drawble. + * + * We need to infer the drawable size from GL calls because the drawable sizes + * are specified by OS specific calls which we do not trace. + */ +void +updateDrawable(int width, int height) { + if (!drawable) { + return; + } + + if (width <= glretrace::drawable->width && + height <= glretrace::drawable->height) { + return; + } + + // Check for bound framebuffer last, as this may have a performance impact. + GLint draw_framebuffer = 0; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer); + if (draw_framebuffer != 0) { + return; + } + + glretrace::drawable->resize(width, height); + if (!drawable->visible) { + drawable->show(); + } + glScissor(0, 0, width, height); +} + void snapshot(unsigned call_no) { if (!drawable ||