From: Marek Olšák Date: Fri, 11 May 2012 14:38:13 +0000 (+0200) Subject: Merge branch 'gallium-userbuf' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bb4c5d72d7c7cb1d9e7016e2c07c36875f30011a;p=mesa.git Merge branch 'gallium-userbuf' Conflicts: src/gallium/docs/source/screen.rst src/gallium/drivers/nv50/nv50_state.c src/gallium/include/pipe/p_defines.h src/mesa/state_tracker/st_draw.c --- bb4c5d72d7c7cb1d9e7016e2c07c36875f30011a diff --cc src/gallium/docs/source/screen.rst index d912dc6d81d,f6c6f3fd119..ff63ce83bea --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@@ -110,8 -110,15 +110,17 @@@ The integer capabilities * ``PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY``: This CAP describes a hw limitation. If true, pipe_vertex_element::src_offset must always be aligned to 4. If false, there are no restrictions on src_offset. +* ``PIPE_CAP_COMPUTE``: Whether the implementation supports the + compute entry points defined in pipe_context and pipe_screen. + * ``PIPE_CAP_USER_INDEX_BUFFERS``: Whether user index buffers are supported. + If not, the state tracker must upload all indices which are not in hw + resources. + * ``PIPE_CAP_USER_CONSTANT_BUFFERS``: Whether user constant buffers are + supported. If not, the state tracker must upload constants which are not in hw + resources. + * ``PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT``: Describes the required + alignment of pipe_constant_buffer::buffer_offset. + .. _pipe_capf: diff --cc src/gallium/drivers/nv50/nv50_state.c index 5e32b2717fd,a17540a1492..7f840e2b42e --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@@ -1051,11 -975,5 +1062,8 @@@ nv50_init_state_functions(struct nv50_c pipe->set_vertex_buffers = nv50_set_vertex_buffers; pipe->set_index_buffer = nv50_set_index_buffer; -} + pipe->create_stream_output_target = nv50_so_target_create; + pipe->stream_output_target_destroy = nv50_so_target_destroy; + pipe->set_stream_output_targets = nv50_set_stream_output_targets; - - pipe->redefine_user_buffer = u_default_redefine_user_buffer; +} - diff --cc src/gallium/include/pipe/p_defines.h index edcca23746b,398cb98248c..1e05cc4caee --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@@ -481,7 -477,9 +481,10 @@@ enum pipe_cap PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY = 65, PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY = 66, PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY = 67, - PIPE_CAP_COMPUTE = 68 - PIPE_CAP_USER_INDEX_BUFFERS = 68, - PIPE_CAP_USER_CONSTANT_BUFFERS = 69, - PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT = 70 ++ PIPE_CAP_COMPUTE = 68, ++ PIPE_CAP_USER_INDEX_BUFFERS = 69, ++ PIPE_CAP_USER_CONSTANT_BUFFERS = 70, ++ PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT = 71 }; /** diff --cc src/mesa/state_tracker/st_draw.c index 42dc3757615,ab2290f2c9d..a8c20f45acd --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@@ -976,61 -903,16 +902,23 @@@ st_draw_vbo(struct gl_context *ctx { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; - struct pipe_index_buffer ibuffer; + struct pipe_index_buffer ibuffer = {0}; struct pipe_draw_info info; + const struct gl_client_array **arrays = ctx->Array._DrawArrays; - unsigned i, num_instances = 1; - unsigned max_index_plus_base; + unsigned i; - GLboolean new_array = - st->dirty.st && - (st->dirty.mesa & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) != 0; + GLboolean new_array; /* Mesa core state should have been validated already */ assert(ctx->NewState == 0x0); + /* Get Mesa driver state. */ + st->dirty.st |= ctx->NewDriverState; + ctx->NewDriverState = 0; + + new_array = + (st->dirty.st & (ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM)) || + (st->dirty.mesa & (_NEW_PROGRAM | _NEW_BUFFER_OBJECT)) != 0; + - if (ib) { - int max_base_vertex = 0; - - /* Gallium probably doesn't want this in some cases. */ - if (!index_bounds_valid) - if (!all_varyings_in_vbos(arrays)) - vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, - nr_prims); - - for (i = 0; i < nr_prims; i++) { - num_instances = MAX2(num_instances, prims[i].num_instances); - max_base_vertex = MAX2(max_base_vertex, prims[i].basevertex); - } - - /* Compute the sum of max_index and max_base_vertex. That's the value - * we need to use when creating buffers. - */ - if (max_index == ~0) - max_index_plus_base = max_index; - else - max_index_plus_base = max_index + max_base_vertex; - } - else { - /* Get min/max index for non-indexed drawing. */ - min_index = ~0; - max_index = 0; - - for (i = 0; i < nr_prims; i++) { - min_index = MIN2(min_index, prims[i].start); - max_index = MAX2(max_index, prims[i].start + prims[i].count - 1); - num_instances = MAX2(num_instances, prims[i].num_instances); - } - - /* The base vertex offset only applies to indexed drawing */ - max_index_plus_base = max_index; - } - /* Validate state. */ if (st->dirty.st) { GLboolean vertDataEdgeFlags; diff --cc src/mesa/state_tracker/st_draw_feedback.c index 257618aa992,ee19898b3ea..4209fb214f8 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@@ -107,9 -108,8 +107,9 @@@ st_feedback_draw_vbo(struct gl_context struct pipe_vertex_buffer vbuffers[PIPE_MAX_SHADER_INPUTS]; struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; struct pipe_index_buffer ibuffer; - struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS]; + struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {NULL}; struct pipe_transfer *ib_transfer = NULL; + const struct gl_client_array **arrays = ctx->Array._DrawArrays; GLuint attr, i; const GLubyte *low_addr = NULL; const void *mapped_indices = NULL;