summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2017-02-24 18:40:40 +0100
committerRoland Scheidegger <[email protected]>2017-02-24 20:39:56 +0100
commitc3a94d9195bff3a870d5a78dd53bd69c26eb23af (patch)
tree3c6e888e14427680170075dcf303291f7ca2ee5f
parent98334889744a327ff0e049d0c97317536f49ae33 (diff)
gallium/util: (trivial) fix util_clear_render_target
the format of the rt can be different than the one of the texture, so must propagate the format explicitly to the helper. Broken since 3f9c5d62441eba38e8b1592aba965ed5db6fd89b (but unused by st/mesa).
-rw-r--r--src/gallium/auxiliary/util/u_surface.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index f2a471d1227..5abf96625e0 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -423,6 +423,7 @@ util_clear_color_texture_helper(struct pipe_transfer *dst_trans,
static void
util_clear_color_texture(struct pipe_context *pipe,
struct pipe_resource *texture,
+ enum pipe_format format,
const union pipe_color_union *color,
unsigned level,
unsigned dstx, unsigned dsty, unsigned dstz,
@@ -430,7 +431,6 @@ util_clear_color_texture(struct pipe_context *pipe,
{
struct pipe_transfer *dst_trans;
ubyte *dst_map;
- enum pipe_format format = texture->format;
dst_map = pipe_transfer_map_3d(pipe,
texture,
@@ -491,16 +491,16 @@ util_clear_render_target(struct pipe_context *pipe,
dx, 0, w, 1,
&dst_trans);
if (dst_map) {
- util_clear_color_texture_helper(dst_trans, dst_map, dst->format, color,
- width, height, 1);
+ util_clear_color_texture_helper(dst_trans, dst_map, dst->format,
+ color, width, height, 1);
pipe->transfer_unmap(pipe, dst_trans);
}
}
else {
unsigned depth = dst->u.tex.last_layer - dst->u.tex.first_layer + 1;
- util_clear_color_texture(pipe, dst->texture, color, dst->u.tex.level,
- dstx, dsty, dst->u.tex.first_layer,
- width, height, depth);
+ util_clear_color_texture(pipe, dst->texture, dst->format, color,
+ dst->u.tex.level, dstx, dsty,
+ dst->u.tex.first_layer, width, height, depth);
}
}
@@ -674,7 +674,8 @@ util_clear_texture(struct pipe_context *pipe,
else
desc->unpack_rgba_float(color.f, 0, data, 0, 1, 1);
- util_clear_color_texture(pipe, tex, &color, level, box->x, box->y, box->z,
+ util_clear_color_texture(pipe, tex, tex->format, &color, level,
+ box->x, box->y, box->z,
box->width, box->height, box->depth);
}
}