static boolean st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi, struct st_framebuffer_iface *stdrawi, struct st_framebuffer_iface *streadi) { struct st_context *st = (struct st_context *) stctxi; struct st_framebuffer *stdraw, *stread; boolean ret; _glapi_check_multithread(); if (st) { /* reuse or create the draw fb */ stdraw = st_framebuffer_reuse_or_create(st->ctx->WinSysDrawBuffer, stdrawi); if (streadi != stdrawi) { /* do the same for the read fb */ stread = st_framebuffer_reuse_or_create(st->ctx->WinSysReadBuffer, streadi); } else { stread = NULL; /* reuse the draw fb for the read fb */ if (stdraw) st_framebuffer_reference(&stread, stdraw); } if (stdraw && stread) { st_framebuffer_validate(stdraw, st); if (stread != stdraw) st_framebuffer_validate(stread, st); ret = _mesa_make_current(st->ctx, &stdraw->Base, &stread->Base); st->draw_stamp = stdraw->stamp - 1; st->read_stamp = stread->stamp - 1; st_context_validate(st, stdraw, stread); } else { struct gl_framebuffer *incomplete = _mesa_get_incomplete_framebuffer(); ret = _mesa_make_current(st->ctx, incomplete, incomplete); } st_framebuffer_reference(&stdraw, NULL); st_framebuffer_reference(&stread, NULL); } else { ret = _mesa_make_current(NULL, NULL, NULL); } return ret; }
/** * Re-validate the framebuffers. */ void st_manager_validate_framebuffers(struct st_context *st) { struct st_framebuffer *stdraw = st_ws_framebuffer(st->ctx->DrawBuffer); struct st_framebuffer *stread = st_ws_framebuffer(st->ctx->ReadBuffer); if (stdraw) st_framebuffer_validate(stdraw, st); if (stread && stread != stdraw) st_framebuffer_validate(stread, st); st_context_validate(st, stdraw, stread); }