diff options
author | Jakob Bornecrantz <[email protected]> | 2009-05-18 02:50:15 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2009-05-18 20:54:09 +0100 |
commit | 7d11a392d780ef7f0374f8da87e3ba416d880cf2 (patch) | |
tree | b3126632fa9c816af898b0e2970efdb7f9b704fa | |
parent | d0639d067e9b95875b1d395eaa66388884996296 (diff) |
st/dri: Only create new textures if drawable has changed
-rw-r--r-- | src/gallium/state_trackers/dri/dri_drawable.c | 12 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_drawable.h | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 15a2088df51..865cc8d0b6c 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -138,6 +138,18 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv) dri_drawable->pBackClipRects[0].x2 = dri_drawable->w; dri_drawable->pBackClipRects[0].y2 = dri_drawable->h; + if (drawable->old_num == count && + drawable->old_w == dri_drawable->w && + drawable->old_h == dri_drawable->h && + memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0) { + return; + } else { + drawable->old_num = count; + drawable->old_w = dri_drawable->w; + drawable->old_h = dri_drawable->h; + memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count); + } + for (i = 0; i < count; i++) { enum pipe_format format = 0; int index = 0; diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h index 78a66624aaf..0f654d804a7 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.h +++ b/src/gallium/state_trackers/dri/dri_drawable.h @@ -46,6 +46,11 @@ struct dri_drawable unsigned attachments[8]; unsigned num_attachments; + __DRIbuffer old[8]; + unsigned old_num; + unsigned old_w; + unsigned old_h; + /* gallium */ struct st_framebuffer *stfb; struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; |