vega: adapt to new vertex element cso
authorRoland Scheidegger <sroland@vmware.com>
Mon, 1 Mar 2010 17:45:25 +0000 (18:45 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Mon, 1 Mar 2010 17:45:25 +0000 (18:45 +0100)
src/gallium/state_trackers/vega/api_masks.c
src/gallium/state_trackers/vega/polygon.c
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/vg_context.c
src/gallium/state_trackers/vega/vg_context.h

index 9c123a4cf955bcb9ea443df4afb31b4de6ee375c..7eb5ea1f07829eefcd7b6acdfbf6fa93c3012bc2 100644 (file)
@@ -86,6 +86,8 @@ draw_clear_quad(struct vg_context *st,
 
    /* draw */
    if (buf) {
+      cso_set_vertex_elements(st->cso_context, 2, st->velems);
+
       util_draw_vertex_buffer(pipe, buf, 0,
                               PIPE_PRIM_TRIANGLE_FAN,
                               4,  /* verts */
index 96fbbfc85a1858975f28d1ee1cde8614f50177ea..eef2c1eb8769f0329d5e7ba91ddf739cd8d5e2dc 100644 (file)
@@ -292,11 +292,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;
-   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, 
index 05620efa9c0d38f5464fd95f6ede265390dbab2d..47e8b470a11c94f881c11a1de257061170157234 100644 (file)
@@ -210,6 +210,7 @@ void renderer_draw_quad(struct renderer *r,
    buf = setup_vertex_data(r, x1, y1, x2, y2, depth);
 
    if (buf) {
+      cso_set_vertex_elements(r->cso, 2, r->owner->velems);
       util_draw_vertex_buffer(r->pipe, buf, 0,
                               PIPE_PRIM_TRIANGLE_FAN,
                               4,  /* verts */
@@ -248,6 +249,7 @@ void renderer_draw_texture(struct renderer *r,
                                s0, t0, s1, t1, 0.0f);
 
    if (buf) {
+      cso_set_vertex_elements(r->cso, 2, r->owner->velems);
       util_draw_vertex_buffer(pipe, buf, 0,
                            PIPE_PRIM_TRIANGLE_FAN,
                            4,  /* verts */
@@ -370,6 +372,7 @@ void renderer_copy_texture(struct renderer *ctx,
                          0.0f);
 
    if (buf) {
+      cso_set_vertex_elements(ctx->cso, 2, ctx->owner->velems);
       util_draw_vertex_buffer(ctx->pipe, buf, 0,
                               PIPE_PRIM_TRIANGLE_FAN,
                               4,  /* verts */
@@ -535,6 +538,7 @@ void renderer_copy_surface(struct renderer *ctx,
                            (float) dstX1, (float) dstY1, z);
 
    if (buf) {
+      cso_set_vertex_elements(ctx->cso, 2, ctx->owner->velems);
       util_draw_vertex_buffer(ctx->pipe, buf, 0,
                               PIPE_PRIM_TRIANGLE_FAN,
                               4,  /* verts */
@@ -587,6 +591,7 @@ void renderer_texture_quad(struct renderer *r,
                           s0, t0, s1, t1, 0.0f);
 
    if (buf) {
+      cso_set_vertex_elements(r->cso, 2, r->owner->velems);
       util_draw_vertex_buffer(pipe, buf, 0,
                               PIPE_PRIM_TRIANGLE_FAN,
                               4,  /* verts */
index 426bf9bc62b091a26b23ea8b4a5df9c038ba1c72..170391ec03117d5e9f1e59ca809ea81acc226775 100644 (file)
@@ -72,6 +72,7 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
                                       struct vg_context *share)
 {
    struct vg_context *ctx;
+   unsigned i;
 
    ctx = CALLOC_STRUCT(vg_context);
 
@@ -103,6 +104,13 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
    ctx->blend_sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
    ctx->blend_sampler.normalized_coords = 0;
 
+   for (i = 0; i < 2; i++) {
+      ctx->velems[i].src_offset = i * 4 * sizeof(float);
+      ctx->velems[i].instance_divisor = 0;
+      ctx->velems[i].vertex_buffer_index = 0;
+      ctx->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+   }
+
    vg_set_error(ctx, VG_NO_ERROR);
 
    ctx->owned_objects[VG_OBJECT_PAINT] = cso_hash_create();
index bc88c8d139dca9b992b8bb3cfc5cde71f3af2eb3..804e9e76d77e2799a33732f348cc7dd3eefb07ed 100644 (file)
@@ -146,6 +146,7 @@ struct vg_context
    struct vg_shader *clear_vs;
    struct vg_shader *texture_vs;
    struct pipe_buffer *vs_const_buffer;
+   struct pipe_vertex_element velems[2];
 };
 
 struct vg_object {