aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_manager.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-06-23 09:46:13 +0200
committermarha <marha@users.sourceforge.net>2011-06-23 09:46:13 +0200
commite4b391377808d3a264dacdac7db76add26dee26c (patch)
tree509bf94b6db55f8837e3bb4d6e0c22eb672d1e26 /mesalib/src/mesa/state_tracker/st_manager.c
parent9a95bb2454d9f38a5a8c3e6a10b764517006ac9f (diff)
parent97c96ddb6f56be198c2e8bf04ff25bc7b48dd1f2 (diff)
downloadvcxsrv-e4b391377808d3a264dacdac7db76add26dee26c.tar.gz
vcxsrv-e4b391377808d3a264dacdac7db76add26dee26c.tar.bz2
vcxsrv-e4b391377808d3a264dacdac7db76add26dee26c.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mesa/main/mtypes.h mesalib/src/mesa/main/state.c mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c mesalib/src/mesa/state_tracker/st_cb_drawpixels.c mesalib/src/mesa/state_tracker/st_format.c mesalib/src/mesa/state_tracker/st_format.h pixman/pixman/pixman-arm-common.h pixman/pixman/pixman-arm-neon.c pixman/pixman/pixman-fast-path.c pixman/pixman/pixman-fast-path.h pixman/pixman/pixman.h xorg-server/configure.ac xorg-server/hw/xwin/man/XWin.man xorg-server/manpages.am
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_manager.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 46be55318..c95514cbe 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -716,38 +716,49 @@ st_api_get_current(struct st_api *stapi)
return (st) ? &st->iface : NULL;
}
+static struct st_framebuffer *
+st_framebuffer_reuse_or_create(struct gl_framebuffer *fb,
+ struct st_framebuffer_iface *stfbi)
+{
+ struct st_framebuffer *cur = st_ws_framebuffer(fb), *stfb = NULL;
+
+ if (cur && cur->iface == stfbi) {
+ /* reuse the current stfb */
+ st_framebuffer_reference(&stfb, cur);
+ }
+ else {
+ /* create a new one */
+ stfb = st_framebuffer_create(stfbi);
+ }
+
+ return stfb;
+}
+
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, *stfb;
+ struct st_framebuffer *stdraw, *stread;
boolean ret;
_glapi_check_multithread();
if (st) {
- /* reuse/create the draw fb */
- stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
- if (stfb && stfb->iface == stdrawi) {
- stdraw = NULL;
- st_framebuffer_reference(&stdraw, stfb);
+ /* 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 {
- stdraw = st_framebuffer_create(stdrawi);
- }
-
- /* reuse/create the read fb */
- stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
- if (!stfb || stfb->iface != streadi)
- stfb = stdraw;
- if (stfb && stfb->iface == streadi) {
stread = NULL;
- st_framebuffer_reference(&stread, stfb);
- }
- else {
- stread = st_framebuffer_create(streadi);
+ /* reuse the draw fb for the read fb */
+ if (stdraw)
+ st_framebuffer_reference(&stread, stdraw);
}
if (stdraw && stread) {