diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-03-14 12:01:27 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-03-14 13:16:24 +0800 |
commit | d6262bdcfb64e1f88f6a890829f5c30c26bc372b (patch) | |
tree | 64fdc0915f8f4b319b90e6b3d1b2ded50ae35d53 | |
parent | 48bc3cca89f7aecc40d1661e695796113df6e583 (diff) | |
download | external_mesa3d-d6262bdcfb64e1f88f6a890829f5c30c26bc372b.zip external_mesa3d-d6262bdcfb64e1f88f6a890829f5c30c26bc372b.tar.gz external_mesa3d-d6262bdcfb64e1f88f6a890829f5c30c26bc372b.tar.bz2 |
st/glx: Sync the back buffer to the front buffer.
Consider this rendering sequence
* render to the back buffer
* swap buffers
* read from the front buffer
The front buffer is expected to have the contents of the back buffer.
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/xm_st.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c index de5a35e..bcb8285 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_st.c +++ b/src/gallium/state_trackers/glx/xlib/xm_st.c @@ -197,18 +197,36 @@ xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, struct pipe_texture **out) { struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi); - unsigned statt_mask, i; + unsigned statt_mask, new_mask, i; + boolean resized; statt_mask = 0x0; for (i = 0; i < count; i++) statt_mask |= 1 << statts[i]; + /* record newly allocated textures */ + new_mask = statt_mask & ~xstfb->texture_mask; + + resized = (xstfb->buffer->width != xstfb->texture_width || + xstfb->buffer->height != xstfb->texture_height); /* revalidate textures */ - if (xstfb->buffer->width != xstfb->texture_width || - xstfb->buffer->height != xstfb->texture_height || - (xstfb->texture_mask & statt_mask) != statt_mask) { + if (resized || new_mask) { xmesa_st_framebuffer_validate_textures(stfbi, xstfb->buffer->width, xstfb->buffer->height, statt_mask); + + if (!resized) { + enum st_attachment_type back, front; + + back = ST_ATTACHMENT_BACK_LEFT; + front = ST_ATTACHMENT_FRONT_LEFT; + /* copy the contents if front is newly allocated and back is not */ + if ((statt_mask & (1 << back)) && + (new_mask & (1 << front)) && + !(new_mask & (1 << back))) { + xmesa_st_framebuffer_copy_textures(stfbi, back, front, + 0, 0, xstfb->texture_width, xstfb->texture_height); + } + } } for (i = 0; i < count; i++) { |