From 507337864fa80caf9f26602324d2c28dd0a75d61 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 24 Apr 2012 19:52:26 +0200 Subject: gallium: change set_constant_buffer to be UBO-friendly --- src/mesa/state_tracker/st_atom_constbuf.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 05667a74305..87bb51543f5 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -63,7 +63,7 @@ void st_upload_constants( struct st_context *st, /* update constants */ if (params && params->NumParameters) { - struct pipe_resource *cbuf; + struct pipe_constant_buffer cb; const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4; /* Update the constants which come from fixed-function state, such as @@ -77,10 +77,12 @@ void st_upload_constants( struct st_context *st, * avoid gratuitous rendering synchronization. * Let's use a user buffer to avoid an unnecessary copy. */ - cbuf = pipe_user_buffer_create(pipe->screen, - params->ParameterValues, - paramBytes, - PIPE_BIND_CONSTANT_BUFFER); + cb.buffer = pipe_user_buffer_create(pipe->screen, + params->ParameterValues, + paramBytes, + PIPE_BIND_CONSTANT_BUFFER); + cb.buffer_offset = 0; + cb.buffer_size = paramBytes; if (ST_DEBUG & DEBUG_CONSTANTS) { debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n", @@ -89,8 +91,8 @@ void st_upload_constants( struct st_context *st, _mesa_print_parameter_list(params); } - st->pipe->set_constant_buffer(st->pipe, shader_type, 0, cbuf); - pipe_resource_reference(&cbuf, NULL); + st->pipe->set_constant_buffer(st->pipe, shader_type, 0, &cb); + pipe_resource_reference(&cb.buffer, NULL); st->state.constants[shader_type].ptr = params->ParameterValues; st->state.constants[shader_type].size = paramBytes; -- cgit v1.2.3