diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2008-01-27 12:35:33 +1100 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-01-27 12:35:33 +1100 |
commit | a556034514582dc8e1b8b65f56020031d513331b (patch) | |
tree | 182aaf4be24733e2943f9e39cfb86bc22f942efb /src/mesa/state_tracker/st_atom_constbuf.c | |
parent | 9043323f1437f9c6791845b3ddbb9af912b45110 (diff) | |
parent | b717de3238a028a3fdfbaf13eb02dbde262f03e7 (diff) |
Merge branch 'upstream-gallium-0.1' into darktama-gallium-0.1
Diffstat (limited to 'src/mesa/state_tracker/st_atom_constbuf.c')
-rw-r--r-- | src/mesa/state_tracker/st_atom_constbuf.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 57f5ec68d2..21416da2e0 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -37,6 +37,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_winsys.h" +#include "pipe/p_inlines.h" #include "st_context.h" #include "st_atom.h" @@ -69,8 +70,13 @@ void st_upload_constants( struct st_context *st, _mesa_load_state_parameters(st->ctx, params); - if (!cbuf->buffer) - cbuf->buffer = ws->buffer_create(ws, 1, 0, 0); + if (cbuf->buffer && cbuf->size != paramBytes) + pipe_buffer_reference( ws, &cbuf->buffer, NULL ); + + if (!cbuf->buffer) { + cbuf->buffer = ws->buffer_create(ws, 1, PIPE_BUFFER_USAGE_CONSTANT, + paramBytes); + } if (0) { @@ -80,8 +86,11 @@ void st_upload_constants( struct st_context *st, } /* load Mesa constants into the constant buffer */ - ws->buffer_data(ws, cbuf->buffer, paramBytes, params->ParameterValues, - PIPE_BUFFER_USAGE_CONSTANT); + if (cbuf->buffer) { + memcpy(ws->buffer_map(ws, cbuf->buffer, PIPE_BUFFER_USAGE_CPU_WRITE), + params->ParameterValues, paramBytes); + ws->buffer_unmap(ws, cbuf->buffer); + } cbuf->size = paramBytes; |