summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-18 09:22:15 +0100
committerBrian <brian.paul@tungstengraphics.com>2007-08-18 09:22:15 +0100
commit7274e14d4ada04d150f1115252cebd7a3ada797a (patch)
tree81d64efa943ecff5f0b0fceaefc9693f473e7ae7 /src/mesa/drivers/x11
parent8e4ed6323dff7c021b0f7d7711a89379e26ddb25 (diff)
fix xm_buffer_data
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/xm_softpipe.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/drivers/x11/xm_softpipe.c b/src/mesa/drivers/x11/xm_softpipe.c
index 09edea6265..432f306e94 100644
--- a/src/mesa/drivers/x11/xm_softpipe.c
+++ b/src/mesa/drivers/x11/xm_softpipe.c
@@ -51,6 +51,7 @@ struct xm_softpipe_winsys
struct xm_buffer
{
int refcount;
+ int size;
void *data;
void *mapped;
};
@@ -129,8 +130,12 @@ xm_buffer_data(struct pipe_winsys *pws, struct pipe_buffer_handle *buf,
unsigned size, const void *data )
{
struct xm_buffer *xm_buf = xm_bo(buf);
- assert(!xm_buf->data);
- xm_buf->data = malloc(size);
+ if (xm_buf->size != size) {
+ if (xm_buf->data)
+ free(xm_buf->data);
+ xm_buf->data = malloc(size);
+ xm_buf->size = size;
+ }
if (data)
memcpy(xm_buf->data, data, size);
}