Squashed commit of the following:
[mesa.git] / src / gallium / state_trackers / vega / polygon.c
index c06dbf52069be78348a35eef7c6e794bee5dd524..d2b7e489124ad607cf11cf43f40c32eba61af839 100644 (file)
@@ -58,7 +58,7 @@ struct polygon
    VGint    num_verts;
 
    VGboolean dirty;
-   struct pipe_buffer *vbuf;
+   struct pipe_resource *vbuf;
    struct pipe_screen *screen;
 };
 
@@ -110,7 +110,7 @@ struct polygon * polygon_create_from_data(float *data, int size)
 void polygon_destroy(struct polygon *poly)
 {
    if (poly->vbuf)
-      pipe_buffer_reference(&poly->vbuf, NULL);
+      pipe_resource_reference(&poly->vbuf, NULL);
 
    free(poly->data);
    free(poly);
@@ -272,13 +272,14 @@ static void draw_polygon(struct vg_context *ctx,
 
    if (poly->vbuf == NULL || poly->dirty) {
       if (poly->vbuf) {
-         pipe_buffer_reference(&poly->vbuf,
+         pipe_resource_reference(&poly->vbuf,
                                NULL);
       }
       poly->screen = pipe->screen;
       poly->vbuf= pipe_user_buffer_create(poly->screen,
                                           poly->data,
-                                          vert_size);
+                                          vert_size,
+                                         PIPE_BIND_VERTEX_BUFFER);
       poly->dirty = VG_FALSE;
    }
 
@@ -292,12 +293,12 @@ static void draw_polygon(struct vg_context *ctx,
    pipe->set_vertex_buffers(pipe, 1, &vbuffer);
 
    /* tell pipe about the vertex attributes */
+   memset(&velement, 0, sizeof(velement));
    velement.src_offset = 0;
    velement.instance_divisor = 0;
    velement.vertex_buffer_index = 0;
    velement.src_format = PIPE_FORMAT_R32G32_FLOAT;
-   velement.nr_components = COMPONENTS;
-   pipe->set_vertex_elements(pipe, 1, &velement);
+   cso_set_vertex_elements(ctx->cso_context, 1, &velement);
 
    /* draw */
    pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLE_FAN,