From: Roland Scheidegger Date: Fri, 15 Jan 2010 17:09:45 +0000 (+0100) Subject: Merge branch 'gallium-noconstbuf' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e5d0ad08167c178fcda005862e3dbead3e8c482;p=mesa.git Merge branch 'gallium-noconstbuf' Conflicts: src/gallium/drivers/softpipe/sp_draw_arrays.c src/mesa/state_tracker/st_draw_feedback.c --- 5e5d0ad08167c178fcda005862e3dbead3e8c482 diff --cc src/gallium/drivers/cell/ppu/cell_draw_arrays.c index 3fa8b975d39,2016b21a409..0a4da8ecc85 --- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c +++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c @@@ -59,9 -59,9 +59,9 @@@ cell_map_constant_buffers(struct cell_c } } - draw_set_mapped_constant_buffer(sp->draw, + draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, sp->mapped_constants[PIPE_SHADER_VERTEX], - sp->constants[PIPE_SHADER_VERTEX].buffer->size); + sp->constants[PIPE_SHADER_VERTEX]->size); } static void diff --cc src/gallium/drivers/llvmpipe/lp_state_fs.c index b73ca2d41ed,d129918fe2d..9f4bbef73fb --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@@ -724,10 -722,11 +723,10 @@@ llvmpipe_set_constant_buffer(struct pip assert(shader < PIPE_SHADER_TYPES); assert(index == 0); - if(shader == PIPE_SHADER_VERTEX) - draw_flush(llvmpipe->draw); + draw_flush(llvmpipe->draw); /* note: reference counting */ - pipe_buffer_reference(&llvmpipe->constants[shader].buffer, buffer); + pipe_buffer_reference(&llvmpipe->constants[shader], constants); if(shader == PIPE_SHADER_FRAGMENT) { llvmpipe->jit_context.constants = data; diff --cc src/gallium/drivers/softpipe/sp_draw_arrays.c index 2a27e5ce64d,96e1c5d8159..03b58d2fb72 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@@ -49,30 -48,22 +49,30 @@@ static voi softpipe_map_constant_buffers(struct softpipe_context *sp) { struct pipe_winsys *ws = sp->pipe.winsys; - uint i, size; + uint i, vssize, gssize; for (i = 0; i < PIPE_SHADER_TYPES; i++) { - if (sp->constants[i].buffer && sp->constants[i].buffer->size) - sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer, + if (sp->constants[i] && sp->constants[i]->size) + sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i], PIPE_BUFFER_USAGE_CPU_READ); } - if (sp->constants[PIPE_SHADER_VERTEX].buffer) - vssize = sp->constants[PIPE_SHADER_VERTEX].buffer->size; + if (sp->constants[PIPE_SHADER_VERTEX]) - size = sp->constants[PIPE_SHADER_VERTEX]->size; ++ vssize = sp->constants[PIPE_SHADER_VERTEX]->size; else - size = 0; + vssize = 0; - if (sp->constants[PIPE_SHADER_GEOMETRY].buffer) - gssize = sp->constants[PIPE_SHADER_GEOMETRY].buffer->size; - draw_set_mapped_constant_buffer(sp->draw, ++ if (sp->constants[PIPE_SHADER_GEOMETRY]) ++ gssize = sp->constants[PIPE_SHADER_GEOMETRY]->size; + else + gssize = 0; + + draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, sp->mapped_constants[PIPE_SHADER_VERTEX], - size); + vssize); + draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_GEOMETRY, + sp->mapped_constants[PIPE_SHADER_GEOMETRY], + gssize); } @@@ -87,12 -78,11 +87,12 @@@ softpipe_unmap_constant_buffers(struct */ draw_flush(sp->draw); - draw_set_mapped_constant_buffer(sp->draw, NULL, 0); + draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, NULL, 0); + draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_GEOMETRY, NULL, 0); - for (i = 0; i < 2; i++) { + for (i = 0; i < PIPE_SHADER_TYPES; i++) { - if (sp->constants[i].buffer && sp->constants[i].buffer->size) - ws->buffer_unmap(ws, sp->constants[i].buffer); + if (sp->constants[i] && sp->constants[i]->size) + ws->buffer_unmap(ws, sp->constants[i]); sp->mapped_constants[i] = NULL; } } diff --cc src/gallium/drivers/softpipe/sp_state_fs.c index aa12bb215a8,eba0563c62c..b7ed4441b43 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@@ -166,11 -159,8 +166,10 @@@ softpipe_set_constant_buffer(struct pip assert(shader < PIPE_SHADER_TYPES); assert(index == 0); + draw_flush(softpipe->draw); + /* note: reference counting */ - pipe_buffer_reference(&softpipe->constants[shader].buffer, - buf ? buf->buffer : NULL); + pipe_buffer_reference(&softpipe->constants[shader], buf); softpipe->dirty |= SP_NEW_CONSTANTS; } diff --cc src/mesa/state_tracker/st_draw_feedback.c index 0599acc8b6f,187e836c386..a05d6dd06bd --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@@ -240,11 -239,10 +240,11 @@@ st_feedback_draw_vbo(GLcontext *ctx /* map constant buffers */ mapped_constants = pipe_buffer_map(pipe->screen, - st->state.constants[PIPE_SHADER_VERTEX].buffer, + st->state.constants[PIPE_SHADER_VERTEX], PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_constant_buffer(st->draw, mapped_constants, + draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX, + mapped_constants, - st->state.constants[PIPE_SHADER_VERTEX].buffer->size); + st->state.constants[PIPE_SHADER_VERTEX]->size); /* draw here */