summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-05-25 21:28:19 +0200
committerMarek Olšák <[email protected]>2010-05-25 23:32:25 +0200
commit59e51d9640c242a7c919472d935a91889c7840c9 (patch)
treee8ab438193f79143a2d3b597f6f6c5000d72574a /src/gallium/auxiliary/util
parent85c55f2cf485644d99adcdc1d256b857f9456d81 (diff)
r300g,util: remove pipe_surface from the util_blitter_fill interface and clean up
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c43
-rw-r--r--src/gallium/auxiliary/util/u_blitter.h11
2 files changed, 29 insertions, 25 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index c2d1af372c7..7c08ebc5767 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -715,10 +715,8 @@ static void util_blitter_do_copy(struct blitter_context *blitter,
blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, dst->width, dst->height, 0);
blitter_draw_quad(ctx);
-
}
-
void util_blitter_copy(struct blitter_context *blitter,
struct pipe_surface *dst,
unsigned dstx, unsigned dsty,
@@ -775,38 +773,41 @@ void util_blitter_copy(struct blitter_context *blitter,
blitter_restore_CSOs(ctx);
}
-void util_blitter_fill(struct blitter_context *blitter,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height,
- unsigned value)
+/* Fill a region of a surface with a constant value. */
+void util_blitter_fill_region(struct blitter_context *blitter,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ unsigned width, unsigned height,
+ unsigned value)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
+ struct pipe_surface *dstsurf;
struct pipe_framebuffer_state fb_state;
float rgba[4];
ubyte ub_rgba[4] = {0};
union util_color color;
int i;
- assert(dst->texture);
- if (!dst->texture)
+ assert(dst);
+ if (!dst)
return;
/* check if we can render to the surface */
if (util_format_is_depth_or_stencil(dst->format) || /* unlikely, but you never know */
- !screen->is_format_supported(screen, dst->format, dst->texture->target,
- dst->texture->nr_samples,
+ !screen->is_format_supported(screen, dst->format, dst->target,
+ dst->nr_samples,
PIPE_BIND_RENDER_TARGET, 0)) {
- struct pipe_subresource subdst;
- subdst.face = dst->face;
- subdst.level = dst->level;
- util_resource_fill_region(pipe, dst->texture, subdst, dstx, dsty,
- dst->zslice, width, height, value);
+ util_resource_fill_region(pipe, dst, subdst, dstx, dsty, dstz,
+ width, height, value);
return;
}
+ dstsurf = screen->get_tex_surface(screen, dst, subdst.face, subdst.level,
+ dstz, PIPE_BIND_RENDER_TARGET);
+
/* unpack the color */
color.ui = value;
util_unpack_color_ub(dst->format, &color,
@@ -827,15 +828,17 @@ void util_blitter_fill(struct blitter_context *blitter,
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
/* set a framebuffer state */
- fb_state.width = dst->width;
- fb_state.height = dst->height;
+ fb_state.width = dstsurf->width;
+ fb_state.height = dstsurf->height;
fb_state.nr_cbufs = 1;
- fb_state.cbufs[0] = dst;
+ fb_state.cbufs[0] = dstsurf;
fb_state.zsbuf = 0;
pipe->set_framebuffer_state(pipe, &fb_state);
blitter_set_clear_color(ctx, rgba);
- blitter_set_rectangle(ctx, 0, 0, width, height, dst->width, dst->height, 0);
+ blitter_set_rectangle(ctx, 0, 0, width, height, dstsurf->width, dstsurf->height, 0);
blitter_draw_quad(ctx);
blitter_restore_CSOs(ctx);
+
+ pipe_surface_reference(&dstsurf, NULL);
}
diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
index ab96ba2e738..fe4c3d483e2 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -130,11 +130,12 @@ void util_blitter_copy(struct blitter_context *blitter,
* already required to be saved:
* - framebuffer state
*/
-void util_blitter_fill(struct blitter_context *blitter,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height,
- unsigned value);
+void util_blitter_fill_region(struct blitter_context *blitter,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ unsigned width, unsigned height,
+ unsigned value);
/* The functions below should be used to save currently bound constant state