vega: Use pipe_context::blit instead of util_blit_pixels_tex.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 17 Sep 2013 18:01:11 +0000 (19:01 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 18 Sep 2013 10:23:28 +0000 (11:23 +0100)
Only compile-tested but it seems straightforward.

Reviewed-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/state_trackers/vega/vg_context.c
src/gallium/state_trackers/vega/vg_context.h

index c63618816835143e79ea9bc9d958edea200954ff..46c7d9649fdc62e09266a063c4c5766df6d0b366 100644 (file)
@@ -41,7 +41,6 @@
 #include "cso_cache/cso_context.h"
 
 #include "util/u_memory.h"
-#include "util/u_blit.h"
 #include "util/u_sampler.h"
 #include "util/u_surface.h"
 #include "util/u_format.h"
@@ -138,8 +137,6 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
    ctx->sc = shaders_cache_create(ctx);
    ctx->shader = shader_create(ctx);
 
-   ctx->blit = util_create_blit(ctx->pipe, ctx->cso_context);
-
    return ctx;
 }
 
@@ -147,7 +144,6 @@ void vg_destroy_context(struct vg_context *ctx)
 {
    struct pipe_resource **cbuf = &ctx->mask.cbuf;
 
-   util_destroy_blit(ctx->blit);
    renderer_destroy(ctx->renderer);
    shaders_cache_destroy(ctx->sc);
    shader_destroy(ctx->shader);
@@ -443,23 +439,35 @@ static void vg_prepare_blend_texture(struct vg_context *ctx,
                                      struct pipe_sampler_view *src)
 {
    struct st_framebuffer *stfb = ctx->draw_buffer;
-   struct pipe_surface *surf;
-   struct pipe_surface surf_tmpl;
+   struct pipe_context *pipe = ctx->pipe;
+   struct pipe_blit_info info;
 
    vg_context_update_blend_texture_view(ctx, stfb->width, stfb->height);
 
-   u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture);
-   surf = ctx->pipe->create_surface(ctx->pipe,
-                                    stfb->blend_texture_view->texture,
-                                    &surf_tmpl);
-   if (surf) {
-      util_blit_pixels_tex(ctx->blit,
-                           src, 0, 0, stfb->width, stfb->height,
-                           surf, 0, 0, stfb->width, stfb->height,
-                           0.0, PIPE_TEX_MIPFILTER_NEAREST);
-
-      pipe_surface_reference(&surf, NULL);
-   }
+   memset(&info, 0, sizeof info);
+   info.dst.resource = stfb->blend_texture_view->texture;
+   info.dst.level = 0;
+   info.dst.box.x = 0;
+   info.dst.box.y = 0;
+   info.dst.box.z = 0;
+   info.dst.box.width = stfb->width;
+   info.dst.box.height = stfb->height;
+   info.dst.box.depth = 1;
+   info.dst.format = stfb->blend_texture_view->format;
+   info.src.resource = src->texture;
+   info.src.level = src->u.tex.first_level;
+   info.src.box.x = 0;
+   info.src.box.y = 0;
+   info.src.box.z = src->u.tex.first_layer;
+   info.src.box.width = stfb->width;
+   info.src.box.height = stfb->height;
+   info.src.box.depth = 1;
+   info.src.format = src->format;
+   info.mask = PIPE_MASK_RGBA;
+   info.filter = PIPE_TEX_MIPFILTER_NEAREST;
+   info.scissor_enable = 0;
+
+   pipe->blit(pipe, &info);
 }
 
 struct pipe_sampler_view *vg_prepare_blend_surface(struct vg_context *ctx)
index d61c7cfeff15ce1334ed8166db512fde29276565..5a2a322743df95be0db0cfa285b95c49ff30546e 100644 (file)
@@ -129,8 +129,6 @@ struct vg_context
    struct pipe_sampler_state blend_sampler;
    struct vg_paint *default_paint;
 
-   struct blit_state *blit;
-
    int32_t draw_stamp;
 };