Merge branch '7.8'
[mesa.git] / src / gallium / state_trackers / vega / vg_context.c
index f05a5e68c6d64b510dd55b02710d1d275ddf2007..170391ec03117d5e9f1e59ca809ea81acc226775 100644 (file)
@@ -34,7 +34,7 @@
 #include "st_inlines.h"
 
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
 #include "pipe/p_shader_tokens.h"
 
 #include "cso_cache/cso_context.h"
@@ -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();
@@ -286,8 +294,6 @@ static void update_clip_state(struct vg_context *ctx)
          renderer_draw_quad(ctx->renderer, minx, miny, maxx, maxy, 0.0f);
       }
 
-      blend->rt[0].colormask = PIPE_MASK_R; /*enable colorwrites*/
-      /* XXX really only for red channel? */
       cso_restore_blend(ctx->cso_context);
       cso_restore_fragment_shader(ctx->cso_context);
 
@@ -311,7 +317,7 @@ void vg_validate_state(struct vg_context *ctx)
          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;
-         /* could disable blending ? */
+         blend->rt[0].blend_enable = 0;
          break;
       case VG_BLEND_SRC_OVER:
          blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_SRC_ALPHA;
@@ -345,7 +351,7 @@ void vg_validate_state(struct vg_context *ctx)
          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;
-         /* could disable blending ? */
+         blend->rt[0].blend_enable = 0;
          break;
       case VG_BLEND_ADDITIVE:
          blend->rt[0].rgb_src_factor   = PIPE_BLENDFACTOR_ONE;