Merge branch 'gallium-userbuf'
authorMarek Olšák <maraeo@gmail.com>
Fri, 11 May 2012 14:38:13 +0000 (16:38 +0200)
committerMarek Olšák <maraeo@gmail.com>
Fri, 11 May 2012 14:38:13 +0000 (16:38 +0200)
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

20 files changed:
1  2 
src/gallium/docs/source/screen.rst
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/nouveau/nouveau_buffer.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_state.c
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/radeonsi/evergreen_state.c
src/gallium/drivers/radeonsi/r600_state_common.c
src/gallium/drivers/radeonsi/radeonsi_pipe.h
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_state.h
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_draw_feedback.c

index d912dc6d81d15a0e2b8fb609b670807f44d30739,f6c6f3fd119e69580f10037d308b4f3ef2008f64..ff63ce83beab003853ebf4622e5198012f396918
@@@ -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:
index 5e32b2717fd80f9f964cebb280f0b2e2ad54f2af,a17540a1492032db7e00db222043e8c089c41f20..7f840e2b42e1ef45f633b121167d4e3cdd37a9b5
@@@ -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->redefine_user_buffer = u_default_redefine_user_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;
 +}
Simple merge
Simple merge
Simple merge
index edcca23746b33b87299306370dafb4dc83fe1834,398cb98248c02557db642088ce3d1d939c16ff9e..1e05cc4caeee8f9eea5e1fff69922c73f8d5492b
@@@ -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
  };
  
  /**
Simple merge
Simple merge
Simple merge
index 42dc3757615744da3c92cb0134ef0a90ef7dd903,ab2290f2c9da747c87eb7f1b2a46852b9a5fb283..a8c20f45acda0f58e9a20347a5a85b84eefb2058
@@@ -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;
-    unsigned i, num_instances = 1;
-    unsigned max_index_plus_base;
 +   const struct gl_client_array **arrays = ctx->Array._DrawArrays;
 -   GLboolean new_array =
 -      st->dirty.st &&
 -      (st->dirty.mesa & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) != 0;
+    unsigned i;
 +   GLboolean new_array;
  
     /* Mesa core state should have been validated already */
     assert(ctx->NewState == 0x0);
  
-    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;
-    }
 +   /* 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;
 +
     /* Validate state. */
     if (st->dirty.st) {
        GLboolean vertDataEdgeFlags;
index 257618aa992fc6272e93ad6f04c47fe4eeb3bc47,ee19898b3ea1b1f907c997203912af8306087c1b..4209fb214f8c659a4f2943d188f541f1ee207e05
@@@ -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;