gallium: add fallback for copying buffers to all drivers
[mesa.git] / src / gallium / drivers / i915 / i915_surface.c
index d02c420f6c236b0b6bf5c51c57a4ce5b0c5d4dd4..ac6e94500c85297b7022c2edc70e1d279d8310b3 100644 (file)
@@ -37,6 +37,7 @@
 #include "util/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
+#include "util/u_surface.h"
 
 /*
  * surface functions using the render engine
@@ -51,6 +52,13 @@ i915_surface_copy_render(struct pipe_context *pipe,
 {
    struct i915_context *i915 = i915_context(pipe);
 
+   /* Fallback for buffers. */
+   if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
+      util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
+                                src, src_level, src_box);
+      return;
+   }
+
    util_blitter_save_blend(i915->blitter, (void *)i915->blend);
    util_blitter_save_depth_stencil_alpha(i915->blitter, (void *)i915->depth_stencil);
    util_blitter_save_stencil_ref(i915->blitter, &i915->stencil_ref);
@@ -158,6 +166,13 @@ i915_surface_copy_blitter(struct pipe_context *pipe,
    struct pipe_resource *spt = &src_tex->b.b;
    unsigned dst_offset, src_offset;  /* in bytes */
 
+   /* Fallback for buffers. */
+   if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
+      util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
+                                src, src_level, src_box);
+      return;
+   }
+
    /* XXX cannot copy 3d regions at this time */
    assert(src_box->depth == 1);
    if (dst->target != PIPE_TEXTURE_CUBE &&