-
-
- /* save state (restored below) */
- cso_save_blend(ctx->cso);
- cso_save_depth_stencil_alpha(ctx->cso);
- cso_save_rasterizer(ctx->cso);
- cso_save_samplers(ctx->cso);
- cso_save_fragment_sampler_views(ctx->cso);
- cso_save_viewport(ctx->cso);
- cso_save_framebuffer(ctx->cso);
- cso_save_fragment_shader(ctx->cso);
- cso_save_vertex_shader(ctx->cso);
- cso_save_clip(ctx->cso);
- cso_save_vertex_elements(ctx->cso);
-
- /* set misc state we care about */
- cso_set_blend(ctx->cso, &ctx->blend);
- cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
- cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_clip(ctx->cso, &ctx->clip);
- cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
-
- /* sampler */
- ctx->sampler.min_img_filter = filter;
- ctx->sampler.mag_img_filter = filter;
- cso_single_sampler(ctx->cso, 0, &ctx->sampler);
- cso_single_sampler_done(ctx->cso);
-
- /* viewport */
- ctx->viewport.scale[0] = 0.5f * dst->width;
- ctx->viewport.scale[1] = 0.5f * dst->height;
- ctx->viewport.scale[2] = 0.5f;
- ctx->viewport.scale[3] = 1.0f;
- ctx->viewport.translate[0] = 0.5f * dst->width;
- ctx->viewport.translate[1] = 0.5f * dst->height;
- ctx->viewport.translate[2] = 0.5f;
- ctx->viewport.translate[3] = 0.0f;
- cso_set_viewport(ctx->cso, &ctx->viewport);
-
- /* texture */
- cso_set_fragment_sampler_views(ctx->cso, 1, &sampler_view);
-
- if (ctx->fs[writemask] == NULL)
- ctx->fs[writemask] =
- util_make_fragment_tex_shader_writemask(pipe, TGSI_TEXTURE_2D,
- writemask);
-
- /* shaders */
- cso_set_fragment_shader_handle(ctx->cso, ctx->fs[writemask]);
- cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
-
- /* drawing dest */
- memset(&fb, 0, sizeof(fb));
- fb.width = dst->width;
- fb.height = dst->height;
- fb.nr_cbufs = 1;
- fb.cbufs[0] = dst;
- cso_set_framebuffer(ctx->cso, &fb);
-
- /* draw quad */
- offset = setup_vertex_data_tex(ctx,
- (float) dstX0 / dst->width * 2.0f - 1.0f,
- (float) dstY0 / dst->height * 2.0f - 1.0f,
- (float) dstX1 / dst->width * 2.0f - 1.0f,
- (float) dstY1 / dst->height * 2.0f - 1.0f,
- s0, t0,
- s1, t1,
- z);
-
- util_draw_vertex_buffer(ctx->pipe, ctx->vbuf, offset,
- PIPE_PRIM_TRIANGLE_FAN,
- 4, /* verts */
- 2); /* attribs/vert */
-
- /* restore state we changed */
- cso_restore_blend(ctx->cso);
- cso_restore_depth_stencil_alpha(ctx->cso);
- cso_restore_rasterizer(ctx->cso);
- cso_restore_samplers(ctx->cso);
- cso_restore_fragment_sampler_views(ctx->cso);
- cso_restore_viewport(ctx->cso);
- cso_restore_framebuffer(ctx->cso);
- cso_restore_fragment_shader(ctx->cso);
- cso_restore_vertex_shader(ctx->cso);
- cso_restore_clip(ctx->cso);
- cso_restore_vertex_elements(ctx->cso);
-
- pipe_sampler_view_reference(&sampler_view, NULL);
-}
-
-
-void
-util_blit_pixels(struct blit_state *ctx,
- struct pipe_surface *src,
- struct pipe_sampler_view *src_sampler_view,
- int srcX0, int srcY0,
- int srcX1, int srcY1,
- struct pipe_surface *dst,
- int dstX0, int dstY0,
- int dstX1, int dstY1,
- float z, uint filter )
-{
- util_blit_pixels_writemask( ctx, src, src_sampler_view,
- srcX0, srcY0,
- srcX1, srcY1,
- dst,
- dstX0, dstY0,
- dstX1, dstY1,
- z, filter,
- TGSI_WRITEMASK_XYZW );
+ memset(&info, 0, sizeof info);
+ info.dst.resource = dst->texture;
+ info.dst.level = dst->u.tex.level;
+ info.dst.box.x = dstX0;
+ info.dst.box.y = dstY0;
+ info.dst.box.z = dst->u.tex.first_layer;
+ info.dst.box.width = dstX1 - dstX0;
+ info.dst.box.height = dstY1 - dstY0;
+ assert(info.dst.box.width >= 0);
+ assert(info.dst.box.height >= 0);
+ info.dst.box.depth = 1;
+ info.dst.format = dst->texture->format;
+ info.src.resource = src_tex;
+ info.src.level = src_level;
+ info.src.box.x = srcX0;
+ info.src.box.y = srcY0;
+ info.src.box.z = srcZ0;
+ info.src.box.width = srcX1 - srcX0;
+ info.src.box.height = srcY1 - srcY0;
+ info.src.box.depth = 1;
+ info.src.format = src_tex->format;
+ info.mask = writemask | (zs_writemask << 4);
+ info.filter = filter;
+ info.scissor_enable = 0;
+
+ pipe->blit(pipe, &info);