aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_blitter.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_blitter.c')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 6a32de619..48808ae08 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -241,7 +241,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
}
if (ctx->has_stream_out) {
- velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ velem[0].src_format = PIPE_FORMAT_R32_UINT;
ctx->velem_state_readbuf = pipe->create_vertex_elements_state(pipe, 1, &velem[0]);
}
@@ -263,8 +263,8 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
memset(&so, 0, sizeof(so));
so.num_outputs = 1;
- so.output[0].num_components = 4;
- so.stride[0] = 4;
+ so.output[0].num_components = 1;
+ so.stride[0] = 1;
ctx->vs_pos_only =
util_make_vertex_passthrough_shader_with_so(pipe, 1, semantic_names,
@@ -1247,12 +1247,23 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
struct pipe_vertex_buffer vb;
struct pipe_stream_output_target *so_target;
+ if (srcx >= src->width0 ||
+ dstx >= dst->width0) {
+ return;
+ }
+ if (srcx + size > src->width0) {
+ size = src->width0 - srcx;
+ }
+ if (dstx + size > dst->width0) {
+ size = dst->width0 - dstx;
+ }
+
/* Drivers not capable of Stream Out should not call this function
* in the first place. */
assert(ctx->has_stream_out);
/* Some alignment is required. */
- if (srcx % 4 != 0 || dstx % 4 != 0 || size % 16 != 0 ||
+ if (srcx % 4 != 0 || dstx % 4 != 0 || size % 4 != 0 ||
!ctx->has_stream_out) {
struct pipe_box box;
u_box_1d(srcx, size, &box);
@@ -1277,7 +1288,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
so_target = pipe->create_stream_output_target(pipe, dst, dstx, size);
pipe->set_stream_output_targets(pipe, 1, &so_target, 0);
- util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 16);
+ util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4);
blitter_restore_vertex_states(ctx);
blitter_unset_running_flag(ctx);