Merge remote branch 'origin/7.8'
[mesa.git] / src / gallium / state_trackers / vega / api_masks.c
index 4f9f3dae173d1ba92c75a7c76d02f31fda81c8d2..7c28ea5c87292adb926047a704a86e9850f74564 100644 (file)
@@ -31,8 +31,7 @@
 
 #include "vg_context.h"
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
-#include "pipe/internal/p_winsys_screen.h" /* for winsys->update_buffer */
+#include "util/u_inlines.h"
 
 #include "util/u_pack_color.h"
 #include "util/u_draw_quad.h"
@@ -52,7 +51,7 @@ draw_clear_quad(struct vg_context *st,
                 const VGfloat color[4])
 {
    struct pipe_context *pipe = st->pipe;
-   struct pipe_buffer *buf;
+   struct pipe_resource *buf;
    VGuint i;
 
    /* positions */
@@ -82,17 +81,20 @@ draw_clear_quad(struct vg_context *st,
    /* put vertex data into vbuf */
    buf =  pipe_user_buffer_create(pipe->screen,
                                   st->clear.vertices,
-                                  sizeof(st->clear.vertices));
+                                  sizeof(st->clear.vertices),
+                                 PIPE_BIND_VERTEX_BUFFER);
 
 
    /* 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 */
                               2); /* attribs/vert */
 
-      pipe_buffer_reference(&buf, NULL);
+      pipe_resource_reference(&buf, NULL);
    }
 }
 
@@ -116,10 +118,6 @@ clear_with_quad(struct vg_context *st, float x0, float y0,
      x1, y1);
    */
 
-   if (st->pipe->winsys && st->pipe->winsys->update_buffer)
-      st->pipe->winsys->update_buffer( st->pipe->winsys,
-                                       st->pipe->priv );
-
    cso_save_blend(st->cso_context);
    cso_save_rasterizer(st->cso_context);
    cso_save_fragment_shader(st->cso_context);
@@ -129,14 +127,11 @@ clear_with_quad(struct vg_context *st, float x0, float y0,
    {
       struct pipe_blend_state blend;
       memset(&blend, 0, sizeof(blend));
-      blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
-      blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
-      blend.colormask |= PIPE_MASK_R;
-      blend.colormask |= PIPE_MASK_G;
-      blend.colormask |= PIPE_MASK_B;
-      blend.colormask |= PIPE_MASK_A;
+      blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
+      blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
+      blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
+      blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
+      blend.rt[0].colormask = PIPE_MASK_RGBA;
       cso_set_blend(st->cso_context, &blend);
    }