summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/svga/svga_pipe_blit.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-09-13 00:50:54 +0200
committerMarek Olšák <maraeo@gmail.com>2012-09-30 18:57:57 +0200
commitad3d5dbcc52dd866c54b768a13429bcd4c4573b0 (patch)
tree0b3a3896350f79855b7e72c10296a502b2e8a419 /src/gallium/drivers/svga/svga_pipe_blit.c
parent3d9d4b1ce6e700d85920eca84ae58a4dcf7288c2 (diff)
svga: implement blit
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/drivers/svga/svga_pipe_blit.c')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blit.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c
index 8e114d3e30e..34ac995ef60 100644
--- a/src/gallium/drivers/svga/svga_pipe_blit.c
+++ b/src/gallium/drivers/svga/svga_pipe_blit.c
@@ -29,6 +29,7 @@
#include "svga_cmd.h"
#include "svga_surface.h"
+#include "util/u_format.h"
#include "util/u_surface.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
@@ -150,8 +151,71 @@ static void svga_surface_copy(struct pipe_context *pipe,
}
+static void svga_blit(struct pipe_context *pipe,
+ const struct pipe_blit_info *blit_info)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct pipe_blit_info info = *blit_info;
+
+ if (info.src.resource->nr_samples > 1 &&
+ info.dst.resource->nr_samples <= 1 &&
+ !util_format_is_depth_or_stencil(info.src.resource->format) &&
+ !util_format_is_pure_integer(info.src.resource->format)) {
+ debug_printf("svga: color resolve unimplemented\n");
+ return;
+ }
+
+ if (util_try_blit_via_copy_region(pipe, &info)) {
+ return; /* done */
+ }
+
+ if (info.mask & PIPE_MASK_S) {
+ debug_printf("svga: cannot blit stencil, skipping\n");
+ info.mask &= ~PIPE_MASK_S;
+ }
+
+ if (!util_blitter_is_blit_supported(svga->blitter, &info)) {
+ debug_printf("svga: blit unsupported %s -> %s\n",
+ util_format_short_name(info.src.resource->format),
+ util_format_short_name(info.dst.resource->format));
+ return;
+ }
+
+ /* XXX turn off occlusion and streamout queries */
+
+ util_blitter_save_vertex_buffers(svga->blitter,
+ svga->curr.num_vertex_buffers,
+ svga->curr.vb);
+ util_blitter_save_vertex_elements(svga->blitter, (void*)svga->curr.velems);
+ util_blitter_save_vertex_shader(svga->blitter, svga->curr.vs);
+ /*util_blitter_save_geometry_shader(svga->blitter, svga->curr.gs);*/
+ /*util_blitter_save_so_targets(svga->blitter, svga->num_so_targets,
+ (struct pipe_stream_output_target**)svga->so_targets);*/
+ util_blitter_save_rasterizer(svga->blitter, (void*)svga->curr.rast);
+ util_blitter_save_viewport(svga->blitter, &svga->curr.viewport);
+ util_blitter_save_scissor(svga->blitter, &svga->curr.scissor);
+ util_blitter_save_fragment_shader(svga->blitter, svga->curr.fs);
+ util_blitter_save_blend(svga->blitter, (void*)svga->curr.blend);
+ util_blitter_save_depth_stencil_alpha(svga->blitter,
+ (void*)svga->curr.depth);
+ util_blitter_save_stencil_ref(svga->blitter, &svga->curr.stencil_ref);
+ /*util_blitter_save_sample_mask(svga->blitter, svga->sample_mask);*/
+ util_blitter_save_framebuffer(svga->blitter, &svga->curr.framebuffer);
+ util_blitter_save_fragment_sampler_states(svga->blitter,
+ svga->curr.num_samplers,
+ (void**)svga->curr.sampler);
+ util_blitter_save_fragment_sampler_views(svga->blitter,
+ svga->curr.num_sampler_views,
+ svga->curr.sampler_views);
+ /*util_blitter_save_render_condition(svga->blitter, svga->render_cond_query,
+ svga->render_cond_mode);*/
+ util_blitter_blit(svga->blitter, &info);
+}
+
+
void
svga_init_blit_functions(struct svga_context *svga)
{
svga->pipe.resource_copy_region = svga_surface_copy;
+ svga->pipe.blit = svga_blit;
}