gallium: Simplify winsys buffer interface.

The properties of a buffer represented by struct pipe_buffer_handle are now
basically constant over its lifetime. The state tracker gets to deal with any
more complex buffer semantics it may need to provide.
This commit is contained in:
Michel Dänzer
2008-01-25 17:01:01 +01:00
parent 7a207682aa
commit 756d52ec12
26 changed files with 228 additions and 456 deletions

View File

@@ -69,8 +69,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)
ws->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 +85,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;