Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
[mesa.git] / src / gallium / drivers / nv20 / nv20_vbo.c
index 4edc4efebd841f95a5242c0f3078a3eed42aadd4..84d7db6c5e27c3274eea2f40340e06311db8a04e 100644 (file)
@@ -1,6 +1,7 @@
 #include "draw/draw_context.h"
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
+#include "pipe/p_inlines.h"
 
 #include "nv20_context.h"
 #include "nv20_state.h"
@@ -13,6 +14,7 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
                     unsigned indexSize,
                     unsigned prim, unsigned start, unsigned count)
 {
+       struct pipe_screen *pscreen = pipe->screen;
        struct nv20_context *nv20 = nv20_context( pipe );
        struct draw_context *draw = nv20->draw;
        unsigned i;
@@ -25,17 +27,17 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
        for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
                if (nv20->vtxbuf[i].buffer) {
                        void *buf
-                               = pipe->winsys->buffer_map(pipe->winsys,
-                                               nv20->vtxbuf[i].buffer,
-                                               PIPE_BUFFER_USAGE_CPU_READ);
+                               = pipe_buffer_map(pscreen,
+                                                 nv20->vtxbuf[i].buffer,
+                                                 PIPE_BUFFER_USAGE_CPU_READ);
                        draw_set_mapped_vertex_buffer(draw, i, buf);
                }
        }
        /* Map index buffer, if present */
        if (indexBuffer) {
                void *mapped_indexes
-                       = pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
-                                       PIPE_BUFFER_USAGE_CPU_READ);
+                       = pipe_buffer_map(pscreen, indexBuffer,
+                                         PIPE_BUFFER_USAGE_CPU_READ);
                draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
        }
        else {
@@ -55,15 +57,16 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
         */
        for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
                if (nv20->vtxbuf[i].buffer) {
-                       pipe->winsys->buffer_unmap(pipe->winsys, nv20->vtxbuf[i].buffer);
+                       pipe_buffer_unmap(pscreen, nv20->vtxbuf[i].buffer);
                        draw_set_mapped_vertex_buffer(draw, i, NULL);
                }
        }
        if (indexBuffer) {
-               pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
+               pipe_buffer_unmap(pscreen, indexBuffer);
                draw_set_mapped_element_buffer(draw, 0, NULL);
        }
 
+       draw_flush(nv20->draw);
        return TRUE;
 }