u_vbuf: override set_vertex_buffers
authorMarek Olšák <maraeo@gmail.com>
Sat, 31 Mar 2012 03:32:25 +0000 (05:32 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 23 Apr 2012 23:39:21 +0000 (01:39 +0200)
12 files changed:
src/gallium/auxiliary/util/u_vbuf.c
src/gallium/auxiliary/util/u_vbuf.h
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_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

index 7883845de856a9e17ff5de76fb7c37ad21c7bc3d..92a7df1eda8575e0931e1078e8b8196c430aba78 100644 (file)
@@ -70,6 +70,11 @@ struct u_vbuf_priv {
    struct translate_cache *translate_cache;
    struct cso_cache *cso_cache;
 
+   /* Vertex buffers for the driver.
+    * There are no user buffers. */
+   struct pipe_vertex_buffer real_vertex_buffer[PIPE_MAX_ATTRIBS];
+   int nr_real_vertex_buffers;
+
    /* The index buffer. */
    struct pipe_index_buffer index_buffer;
 
@@ -99,6 +104,9 @@ struct u_vbuf_priv {
 
    void (*driver_set_index_buffer)(struct pipe_context *pipe,
                                   const struct pipe_index_buffer *);
+   void (*driver_set_vertex_buffers)(struct pipe_context *,
+                                    unsigned num_buffers,
+                                    const struct pipe_vertex_buffer *);
 };
 
 static void u_vbuf_init_format_caps(struct u_vbuf_priv *mgr)
@@ -209,8 +217,8 @@ void u_vbuf_destroy(struct u_vbuf *mgrb)
    for (i = 0; i < mgr->b.nr_vertex_buffers; i++) {
       pipe_resource_reference(&mgr->b.vertex_buffer[i].buffer, NULL);
    }
-   for (i = 0; i < mgr->b.nr_real_vertex_buffers; i++) {
-      pipe_resource_reference(&mgr->b.real_vertex_buffer[i].buffer, NULL);
+   for (i = 0; i < mgr->nr_real_vertex_buffers; i++) {
+      pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL);
    }
 
    translate_cache_destroy(mgr->translate_cache);
@@ -324,13 +332,13 @@ u_vbuf_translate_buffers(struct u_vbuf_priv *mgr, struct translate_key *key,
    }
 
    /* Setup the new vertex buffer. */
-   mgr->b.real_vertex_buffer[out_vb].buffer_offset = out_offset;
-   mgr->b.real_vertex_buffer[out_vb].stride = key->output_stride;
+   mgr->real_vertex_buffer[out_vb].buffer_offset = out_offset;
+   mgr->real_vertex_buffer[out_vb].stride = key->output_stride;
 
    /* Move the buffer reference. */
    pipe_resource_reference(
-      &mgr->b.real_vertex_buffer[out_vb].buffer, NULL);
-   mgr->b.real_vertex_buffer[out_vb].buffer = out_buffer;
+      &mgr->real_vertex_buffer[out_vb].buffer, NULL);
+   mgr->real_vertex_buffer[out_vb].buffer = out_buffer;
 }
 
 static boolean
@@ -364,15 +372,15 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf_priv *mgr,
                /*printf("found slot=%i for type=%i\n", i, type);*/
                fallback_vbs[type] = i;
                i++;
-               if (i > mgr->b.nr_real_vertex_buffers) {
-                  mgr->b.nr_real_vertex_buffers = i;
+               if (i > mgr->nr_real_vertex_buffers) {
+                  mgr->nr_real_vertex_buffers = i;
                }
                break;
             }
          }
          if (i == PIPE_MAX_ATTRIBS) {
             /* fail, reset the number to its original value */
-            mgr->b.nr_real_vertex_buffers = mgr->b.nr_vertex_buffers;
+            mgr->nr_real_vertex_buffers = mgr->b.nr_vertex_buffers;
             return FALSE;
          }
       }
@@ -495,7 +503,7 @@ u_vbuf_translate_begin(struct u_vbuf_priv *mgr,
 
          /* Fixup the stride for constant attribs. */
          if (type == VB_CONST) {
-            mgr->b.real_vertex_buffer[mgr->fallback_vbs[VB_CONST]].stride = 0;
+            mgr->real_vertex_buffer[mgr->fallback_vbs[VB_CONST]].stride = 0;
          }
       }
    }
@@ -544,11 +552,11 @@ static void u_vbuf_translate_end(struct u_vbuf_priv *mgr)
    for (i = 0; i < VB_NUM; i++) {
       unsigned vb = mgr->fallback_vbs[i];
       if (vb != ~0) {
-         pipe_resource_reference(&mgr->b.real_vertex_buffer[vb].buffer, NULL);
+         pipe_resource_reference(&mgr->real_vertex_buffer[vb].buffer, NULL);
          mgr->fallback_vbs[i] = ~0;
       }
    }
-   mgr->b.nr_real_vertex_buffers = mgr->b.nr_vertex_buffers;
+   mgr->nr_real_vertex_buffers = mgr->b.nr_vertex_buffers;
 }
 
 #define FORMAT_REPLACE(what, withwhat) \
@@ -682,11 +690,11 @@ void u_vbuf_destroy_vertex_elements(struct u_vbuf *mgr,
    FREE(ve);
 }
 
-void u_vbuf_set_vertex_buffers(struct u_vbuf *mgrb,
-                               unsigned count,
-                               const struct pipe_vertex_buffer *bufs)
+static void u_vbuf_set_vertex_buffers(struct pipe_context *pipe,
+                                      unsigned count,
+                                      const struct pipe_vertex_buffer *bufs)
 {
-   struct u_vbuf_priv *mgr = (struct u_vbuf_priv*)mgrb;
+   struct u_vbuf_priv *mgr = (struct u_vbuf_priv*)pipe->draw;
    unsigned i;
 
    mgr->any_user_vbs = FALSE;
@@ -711,36 +719,41 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgrb,
 
       pipe_resource_reference(&mgr->b.vertex_buffer[i].buffer, vb->buffer);
 
-      mgr->b.real_vertex_buffer[i].buffer_offset =
+      mgr->real_vertex_buffer[i].buffer_offset =
       mgr->b.vertex_buffer[i].buffer_offset = vb->buffer_offset;
 
-      mgr->b.real_vertex_buffer[i].stride =
+      mgr->real_vertex_buffer[i].stride =
       mgr->b.vertex_buffer[i].stride = vb->stride;
 
       if (!vb->buffer ||
           mgr->incompatible_vb[i]) {
-         pipe_resource_reference(&mgr->b.real_vertex_buffer[i].buffer, NULL);
+         pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL);
          continue;
       }
 
       if (u_vbuf_resource(vb->buffer)->user_ptr) {
-         pipe_resource_reference(&mgr->b.real_vertex_buffer[i].buffer, NULL);
+         pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL);
          mgr->any_user_vbs = TRUE;
          continue;
       }
 
-      pipe_resource_reference(&mgr->b.real_vertex_buffer[i].buffer, vb->buffer);
+      pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, vb->buffer);
    }
 
    for (i = count; i < mgr->b.nr_vertex_buffers; i++) {
       pipe_resource_reference(&mgr->b.vertex_buffer[i].buffer, NULL);
    }
-   for (i = count; i < mgr->b.nr_real_vertex_buffers; i++) {
-      pipe_resource_reference(&mgr->b.real_vertex_buffer[i].buffer, NULL);
+   for (i = count; i < mgr->nr_real_vertex_buffers; i++) {
+      pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL);
    }
 
    mgr->b.nr_vertex_buffers = count;
-   mgr->b.nr_real_vertex_buffers = count;
+   mgr->nr_real_vertex_buffers = count;
+
+   if (!mgr->any_user_vbs && !mgr->incompatible_vb_layout) {
+      mgr->driver_set_vertex_buffers(pipe, mgr->nr_real_vertex_buffers,
+                                     mgr->real_vertex_buffer);
+   }
 }
 
 static void u_vbuf_set_index_buffer(struct pipe_context *pipe,
@@ -835,7 +848,7 @@ u_vbuf_upload_buffers(struct u_vbuf_priv *mgr,
       start = start_offset[i];
       assert(start < end);
 
-      real_vb = &mgr->b.real_vertex_buffer[i];
+      real_vb = &mgr->real_vertex_buffer[i];
       ptr = u_vbuf_resource(mgr->b.vertex_buffer[i].buffer)->user_ptr;
 
       u_upload_data(mgr->b.uploader, start, end - start, ptr + start,
@@ -855,7 +868,7 @@ unsigned u_vbuf_draw_max_vertex_count(struct u_vbuf *mgrb)
 
    for (i = 0; i < nr; i++) {
       struct pipe_vertex_buffer *vb =
-            &mgr->b.real_vertex_buffer[velems[i].vertex_buffer_index];
+            &mgr->real_vertex_buffer[velems[i].vertex_buffer_index];
       unsigned size, max_count, value;
 
       /* We're not interested in constant and per-instance attribs. */
@@ -1059,9 +1072,8 @@ static void u_vbuf_get_minmax_index(struct pipe_context *pipe,
    }
 }
 
-enum u_vbuf_return_flags
-u_vbuf_draw_begin(struct u_vbuf *mgrb,
-                  struct pipe_draw_info *info)
+void u_vbuf_draw_begin(struct u_vbuf *mgrb,
+                       struct pipe_draw_info *info)
 {
    struct u_vbuf_priv *mgr = (struct u_vbuf_priv*)mgrb;
    int start_vertex, min_index;
@@ -1071,7 +1083,7 @@ u_vbuf_draw_begin(struct u_vbuf *mgrb,
    if (!mgr->incompatible_vb_layout &&
        !mgr->ve->incompatible_layout &&
        !mgr->any_user_vbs) {
-      return 0;
+      return;
    }
 
    if (info->indexed) {
@@ -1150,9 +1162,9 @@ u_vbuf_draw_begin(struct u_vbuf *mgrb,
       util_dump_vertex_buffer(stdout, mgr->b.vertex_buffer+i);
       printf("\n");
    }
-   for (i = 0; i < mgr->b.nr_real_vertex_buffers; i++) {
+   for (i = 0; i < mgr->nr_real_vertex_buffers; i++) {
       printf("real %i: ", i);
-      util_dump_vertex_buffer(stdout, mgr->b.real_vertex_buffer+i);
+      util_dump_vertex_buffer(stdout, mgr->real_vertex_buffer+i);
       printf("\n");
    }
    */
@@ -1165,7 +1177,8 @@ u_vbuf_draw_begin(struct u_vbuf *mgrb,
       info->start = 0;
    }
 
-   return U_VBUF_BUFFERS_UPDATED;
+   mgr->driver_set_vertex_buffers(mgr->pipe, mgr->nr_real_vertex_buffers,
+                                  mgr->real_vertex_buffer);
 }
 
 void u_vbuf_draw_end(struct u_vbuf *mgrb)
@@ -1184,5 +1197,7 @@ static void u_vbuf_install(struct u_vbuf_priv *mgr)
 
    pipe->draw = mgr;
    mgr->driver_set_index_buffer = pipe->set_index_buffer;
+   mgr->driver_set_vertex_buffers = pipe->set_vertex_buffers;
    pipe->set_index_buffer = u_vbuf_set_index_buffer;
+   pipe->set_vertex_buffers = u_vbuf_set_vertex_buffers;
 }
index 4a449fca972a0d54093366a6e40f98828a5a73fc..06665b522acd43872811d65c486ddaee6bd3ed1d 100644 (file)
@@ -61,12 +61,6 @@ struct u_vbuf {
    struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
    unsigned nr_vertex_buffers;
 
-   /* Contains only real vertex buffers.
-    * Hardware drivers should use real_vertex_buffers[i]
-    * instead of vertex_buffers[i].buffer. */
-   struct pipe_vertex_buffer real_vertex_buffer[PIPE_MAX_ATTRIBS];
-   int nr_real_vertex_buffers;
-
    /* This uploader can optionally be used by the driver.
     *
     * Allowed functions:
@@ -92,10 +86,6 @@ enum u_fetch_alignment {
    U_VERTEX_FETCH_DWORD_ALIGNED
 };
 
-enum u_vbuf_return_flags {
-   U_VBUF_BUFFERS_UPDATED = 1
-};
-
 
 struct u_vbuf *
 u_vbuf_create(struct pipe_context *pipe,
@@ -119,12 +109,8 @@ void u_vbuf_bind_vertex_elements(struct u_vbuf *mgr,
 void u_vbuf_destroy_vertex_elements(struct u_vbuf *mgr,
                                     struct u_vbuf_elements *ve);
 
-void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr,
-                               unsigned count,
-                               const struct pipe_vertex_buffer *bufs);
-
-enum u_vbuf_return_flags u_vbuf_draw_begin(struct u_vbuf *mgr,
-                                           struct pipe_draw_info *info);
+void u_vbuf_draw_begin(struct u_vbuf *mgr,
+                       struct pipe_draw_info *info);
 
 unsigned u_vbuf_draw_max_vertex_count(struct u_vbuf *mgr);
 
index 920612b8de56fc52979217298b417c0cca1d57a3..103780ffe63c3be4439d029b1d57f8be411da109 100644 (file)
@@ -67,8 +67,8 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
         util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
                                          r300->vbuf_mgr->vertex_buffer);
     } else {
-        util_blitter_save_vertex_buffers(r300->blitter, r300->swtcl_nr_vertex_buffers,
-                                         r300->swtcl_vertex_buffer);
+        util_blitter_save_vertex_buffers(r300->blitter, r300->nr_vertex_buffers,
+                                         r300->vertex_buffer);
     }
 
     if (op & R300_SAVE_FRAMEBUFFER) {
index 23fac30109529139d77643b07a0bfc963fb95c8b..74d5e8ed36c4fcae3d47d0727860342076f1fdb6 100644 (file)
@@ -80,7 +80,7 @@ static void r300_release_referenced_objects(struct r300_context *r300)
     }
 
     /* Manually-created vertex buffers. */
-    pipe_resource_reference(&r300->dummy_vb, NULL);
+    pipe_resource_reference(&r300->dummy_vb.buffer, NULL);
     pipe_resource_reference(&r300->vbo, NULL);
 
     r300->context.delete_depth_stencil_alpha_state(&r300->context,
@@ -480,7 +480,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         vb.height0 = 1;
         vb.depth0 = 1;
 
-        r300->dummy_vb = screen->resource_create(screen, &vb);
+        r300->dummy_vb.buffer = screen->resource_create(screen, &vb);
     }
 
     {
index de582666ec9c7ab7afce2965a48cfbe2049a7bc9..086799dbaddd431fc5312552adcfb054901708b2 100644 (file)
@@ -470,7 +470,7 @@ struct r300_context {
 
     /* When no vertex buffer is set, this one is used instead to prevent
      * hardlocks. */
-    struct pipe_resource *dummy_vb;
+    struct pipe_vertex_buffer dummy_vb;
 
     /* The currently active query. */
     struct r300_query *query_current;
@@ -580,8 +580,8 @@ struct r300_context {
 
     struct u_vbuf *vbuf_mgr;
     struct pipe_index_buffer index_buffer;
-    struct pipe_vertex_buffer swtcl_vertex_buffer[PIPE_MAX_ATTRIBS];
-    unsigned swtcl_nr_vertex_buffers;
+    struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+    unsigned nr_vertex_buffers;
 
     struct util_slab_mempool pool_transfers;
 
index e4afe786d65bb77d523a15e831c9f7e1dc57992a..467339f6a626257c765747e4c950f9720797840b 100644 (file)
@@ -823,7 +823,7 @@ void r300_emit_textures_state(struct r300_context *r300,
 void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
                              boolean indexed, int instance_id)
 {
-    struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer;
+    struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
     struct pipe_vertex_element *velem = r300->velems->velem;
     struct r300_resource *buf;
     int i;
@@ -1223,10 +1223,11 @@ validate:
                                 r300_resource(r300->vbo)->domain);
     /* ...vertex buffers for HWTCL path... */
     if (do_validate_vertex_buffers && r300->vertex_arrays_dirty) {
-        struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer;
-        struct pipe_vertex_buffer *last = r300->vbuf_mgr->real_vertex_buffer +
-                                      r300->vbuf_mgr->nr_real_vertex_buffers;
+        struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
+        struct pipe_vertex_buffer *last = r300->vertex_buffer +
+                                      r300->nr_vertex_buffers;
         struct pipe_resource *buf;
+
         for (; vbuf != last; vbuf++) {
             buf = vbuf->buffer;
             if (!buf)
index 49013c061b78e7062215909e65f909f714f5a1c6..84162bfa638a387c4eb18b58dd5e2491ef7dfbfb 100644 (file)
@@ -148,7 +148,7 @@ static void r300_emit_draw_init(struct r300_context *r300, unsigned mode,
 static void r300_split_index_bias(struct r300_context *r300, int index_bias,
                                   int *buffer_offset, int *index_offset)
 {
-    struct pipe_vertex_buffer *vb, *vbufs = r300->vbuf_mgr->real_vertex_buffer;
+    struct pipe_vertex_buffer *vb, *vbufs = r300->vertex_buffer;
     struct pipe_vertex_element *velem = r300->velems->velem;
     unsigned i, size;
     int max_neg_bias;
@@ -367,7 +367,7 @@ static void r300_draw_arrays_immediate(struct r300_context *r300,
         velem = &r300->velems->velem[i];
         size[i] = r300->velems->format_size[i] / 4;
         vbi = velem->vertex_buffer_index;
-        vbuf = &r300->vbuf_mgr->real_vertex_buffer[vbi];
+        vbuf = &r300->vertex_buffer[vbi];
         stride[i] = vbuf->stride / 4;
 
         /* Map the buffer. */
@@ -401,7 +401,7 @@ static void r300_draw_arrays_immediate(struct r300_context *r300,
         vbi = r300->velems->velem[i].vertex_buffer_index;
 
         if (map[vbi]) {
-            r300->rws->buffer_unmap(r300_resource(r300->vbuf_mgr->real_vertex_buffer[vbi].buffer)->buf);
+            r300->rws->buffer_unmap(r300_resource(r300->vertex_buffer[vbi].buffer)->buf);
             map[vbi] = NULL;
         }
     }
@@ -754,11 +754,7 @@ static void r300_draw_vbo(struct pipe_context* pipe,
     }
 
     r300_update_derived_state(r300);
-
-    /* Start the vbuf manager and update buffers if needed. */
-    if (u_vbuf_draw_begin(r300->vbuf_mgr, &info) & U_VBUF_BUFFERS_UPDATED) {
-        r300->vertex_arrays_dirty = TRUE;
-    }
+    u_vbuf_draw_begin(r300->vbuf_mgr, &info);
 
     /* Draw. */
     if (info.indexed) {
@@ -831,10 +827,10 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
             (indexed ? PREP_INDEXED : 0),
             indexed ? 256 : 6);
 
-    for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
-        if (r300->swtcl_vertex_buffer[i].buffer) {
+    for (i = 0; i < r300->nr_vertex_buffers; i++) {
+        if (r300->vertex_buffer[i].buffer) {
             void *buf = pipe_buffer_map(pipe,
-                                  r300->swtcl_vertex_buffer[i].buffer,
+                                  r300->vertex_buffer[i].buffer,
                                   PIPE_TRANSFER_READ |
                                   PIPE_TRANSFER_UNSYNCHRONIZED,
                                   &vb_transfer[i]);
@@ -856,8 +852,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
     draw_flush(r300->draw);
     r300->draw_vbo_locked = FALSE;
 
-    for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
-        if (r300->swtcl_vertex_buffer[i].buffer) {
+    for (i = 0; i < r300->nr_vertex_buffers; i++) {
+        if (r300->vertex_buffer[i].buffer) {
             pipe_buffer_unmap(pipe, vb_transfer[i]);
             draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
         }
index ab5c18158d1530223ab2166aa88536d7f3b24427..3345bae0990466ccf1b4d6324ce8fbc25dcacef6 100644 (file)
@@ -1593,22 +1593,20 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
                                     const struct pipe_vertex_buffer* buffers)
 {
     struct r300_context* r300 = r300_context(pipe);
-    struct pipe_vertex_buffer dummy_vb = {0};
 
     /* There must be at least one vertex buffer set, otherwise it locks up. */
     if (!count) {
-        dummy_vb.buffer = r300->dummy_vb;
-        buffers = &dummy_vb;
+        buffers = &r300->dummy_vb;
         count = 1;
     }
 
+    util_copy_vertex_buffers(r300->vertex_buffer,
+                             &r300->nr_vertex_buffers,
+                             buffers, count);
+
     if (r300->screen->caps.has_tcl) {
-        u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
         r300->vertex_arrays_dirty = TRUE;
     } else {
-        util_copy_vertex_buffers(r300->swtcl_vertex_buffer,
-                                 &r300->swtcl_nr_vertex_buffers,
-                                 buffers, count);
         draw_set_vertex_buffers(r300->draw, count, buffers);
     }
 }
index a26b44516f9efb7e05c2929d43937e74a4366c14..3b437bad3258517b106a2b2ce484e0a47c755990 100644 (file)
@@ -1713,8 +1713,8 @@ static void evergreen_emit_db_misc_state(struct r600_context *rctx, struct r600_
 static void evergreen_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom *atom)
 {
        struct radeon_winsys_cs *cs = rctx->cs;
-       struct pipe_vertex_buffer *vb = rctx->vbuf_mgr->real_vertex_buffer;
-       unsigned count = rctx->vbuf_mgr->nr_real_vertex_buffers;
+       struct pipe_vertex_buffer *vb = rctx->vertex_buffer;
+       unsigned count = rctx->nr_vertex_buffers;
        unsigned i;
        uint64_t va;
 
index e49fbdf898ade091945f4288f6da9de70963d8a3..dfc93d1ff700fa819c9131878df0714249a83bc1 100644 (file)
@@ -355,6 +355,8 @@ struct r600_context {
        unsigned color0_format;
 
        struct pipe_index_buffer index_buffer;
+       struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
+       unsigned                nr_vertex_buffers;
 };
 
 static INLINE void r600_emit_atom(struct r600_context *rctx, struct r600_atom *atom)
index 9d3197419e596aee545f6f55bbd6e4a93307e5da..2498196fd5ea5444aff1227cc361f7a04494a700 100644 (file)
@@ -1692,8 +1692,8 @@ static void r600_emit_db_misc_state(struct r600_context *rctx, struct r600_atom
 static void r600_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom *atom)
 {
        struct radeon_winsys_cs *cs = rctx->cs;
-       struct pipe_vertex_buffer *vb = rctx->vbuf_mgr->real_vertex_buffer;
-       unsigned count = rctx->vbuf_mgr->nr_real_vertex_buffers;
+       struct pipe_vertex_buffer *vb = rctx->vertex_buffer;
+       unsigned count = rctx->nr_vertex_buffers;
        unsigned i, offset;
 
        for (i = 0; i < count; i++) {
index a2cf05def177a86a6ec14abdc3a0a63bcf8d9ab0..864996d006f5621af6f77bc355b3a792422b716b 100644 (file)
@@ -400,7 +400,7 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
 {
        struct r600_context *rctx = (struct r600_context *)ctx;
 
-       u_vbuf_set_vertex_buffers(rctx->vbuf_mgr, count, buffers);
+       util_copy_vertex_buffers(rctx->vertex_buffer, &rctx->nr_vertex_buffers, buffers, count);
        rctx->vertex_buffers_dirty = true;
 }
 
@@ -766,11 +766,11 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo)
        r600_update_derived_state(rctx);
 
        /* Update vertex buffers. */
-       if ((u_vbuf_draw_begin(rctx->vbuf_mgr, &info) & U_VBUF_BUFFERS_UPDATED) ||
-           rctx->vertex_buffers_dirty) {
+       u_vbuf_draw_begin(rctx->vbuf_mgr, &info);
+       if (rctx->vertex_buffers_dirty) {
                r600_inval_vertex_cache(rctx);
                rctx->vertex_buffer_state.num_dw = (rctx->chip_class >= EVERGREEN ? 12 : 10) *
-                                                  rctx->vbuf_mgr->nr_real_vertex_buffers;
+                                                  rctx->nr_vertex_buffers;
                r600_atom_dirty(rctx, &rctx->vertex_buffer_state);
                rctx->vertex_buffers_dirty = FALSE;
        }