diff options
Diffstat (limited to 'src/gallium/drivers')
27 files changed, 121 insertions, 103 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c index 246fe210542..6a525ef4e41 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.c +++ b/src/gallium/drivers/cell/ppu/cell_clear.c @@ -49,7 +49,8 @@ * Called via pipe->clear() */ void -cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, +cell_clear(struct pipe_context *pipe, unsigned buffers, + const pipe_color_union *color, double depth, unsigned stencil) { struct cell_context *cell = cell_context(pipe); @@ -61,7 +62,7 @@ cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, uint surfIndex = 0; union util_color uc; - util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &uc); + util_pack_color(color->f, cell->framebuffer.cbufs[0]->format, &uc); /* Build a CLEAR command and place it in the current batch buffer */ STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0); diff --git a/src/gallium/drivers/cell/ppu/cell_clear.h b/src/gallium/drivers/cell/ppu/cell_clear.h index 08e091adfdb..a365feb0f00 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.h +++ b/src/gallium/drivers/cell/ppu/cell_clear.h @@ -34,7 +34,8 @@ struct pipe_context; extern void -cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, +cell_clear(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil); diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index f73d8a5d32e..a4afa813f89 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -705,7 +705,7 @@ galahad_resource_copy_region(struct pipe_context *_pipe, static void galahad_clear(struct pipe_context *_pipe, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -714,7 +714,7 @@ galahad_clear(struct pipe_context *_pipe, pipe->clear(pipe, buffers, - rgba, + color, depth, stencil); } @@ -722,7 +722,7 @@ galahad_clear(struct pipe_context *_pipe, static void galahad_clear_render_target(struct pipe_context *_pipe, struct pipe_surface *_dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -733,7 +733,7 @@ galahad_clear_render_target(struct pipe_context *_pipe, pipe->clear_render_target(pipe, dst, - rgba, + color, dstx, dsty, width, diff --git a/src/gallium/drivers/i915/i915_clear.c b/src/gallium/drivers/i915/i915_clear.c index 4f9aa2c3120..c682c06cb58 100644 --- a/src/gallium/drivers/i915/i915_clear.c +++ b/src/gallium/drivers/i915/i915_clear.c @@ -41,7 +41,8 @@ #include "i915_state.h" void -i915_clear_emit(struct pipe_context *pipe, unsigned buffers, const float *rgba, +i915_clear_emit(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil, unsigned destx, unsigned desty, unsigned width, unsigned height) { @@ -60,13 +61,13 @@ i915_clear_emit(struct pipe_context *pipe, unsigned buffers, const float *rgba, clear_params |= CLEARPARAM_WRITE_COLOR; cbuf_tex = i915_texture(cbuf->texture); - util_pack_color(rgba, cbuf->format, &u_color); + util_pack_color(color->f, cbuf->format, &u_color); if (util_format_get_blocksize(cbuf_tex->b.b.format) == 4) clear_color = u_color.ui; else clear_color = (u_color.ui & 0xffff) | (u_color.ui << 16); - util_pack_color(rgba, cbuf->format, &u_color); + util_pack_color(color->f, cbuf->format, &u_color); clear_color8888 = u_color.ui; } else clear_color = clear_color8888 = 0; @@ -135,15 +136,17 @@ i915_clear_emit(struct pipe_context *pipe, unsigned buffers, const float *rgba, * No masking, no scissor (clear entire buffer). */ void -i915_clear_blitter(struct pipe_context *pipe, unsigned buffers, const float *rgba, +i915_clear_blitter(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil) { - util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, rgba, depth, + util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, color, depth, stencil); } void -i915_clear_render(struct pipe_context *pipe, unsigned buffers, const float *rgba, +i915_clear_render(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil) { struct i915_context *i915 = i915_context(pipe); @@ -151,6 +154,6 @@ i915_clear_render(struct pipe_context *pipe, unsigned buffers, const float *rgba if (i915->dirty) i915_update_derived(i915); - i915_clear_emit(pipe, buffers, rgba, depth, stencil, + i915_clear_emit(pipe, buffers, color, depth, stencil, 0, 0, i915->framebuffer.width, i915->framebuffer.height); } diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index fca8688a526..f16bb725a4b 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -368,11 +368,14 @@ void i915_emit_hardware_state(struct i915_context *i915 ); /*********************************************************************** * i915_clear.c: */ -void i915_clear_blitter(struct pipe_context *pipe, unsigned buffers, const float *rgba, +void i915_clear_blitter(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil); -void i915_clear_render(struct pipe_context *pipe, unsigned buffers, const float *rgba, +void i915_clear_render(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil); -void i915_clear_emit(struct pipe_context *pipe, unsigned buffers, const float *rgba, +void i915_clear_emit(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil, unsigned destx, unsigned desty, unsigned width, unsigned height); diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index 41146be9311..4ba99a33d70 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -87,7 +87,7 @@ i915_surface_copy_render(struct pipe_context *pipe, static void i915_clear_render_target_render(struct pipe_context *pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -106,7 +106,7 @@ i915_clear_render_target_render(struct pipe_context *pipe, if (i915->dirty) i915_update_derived(i915); - i915_clear_emit(pipe, PIPE_CLEAR_COLOR, rgba, 0.0, 0x0, + i915_clear_emit(pipe, PIPE_CLEAR_COLOR, color, 0.0, 0x0, dstx, dsty, width, height); pipe->set_framebuffer_state(pipe, &i915->blitter->saved_fb_state); @@ -202,7 +202,7 @@ i915_surface_copy_blitter(struct pipe_context *pipe, static void i915_clear_render_target_blitter(struct pipe_context *pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -214,7 +214,7 @@ i915_clear_render_target_blitter(struct pipe_context *pipe, assert(util_format_get_blockwidth(pt->format) == 1); assert(util_format_get_blockheight(pt->format) == 1); - util_pack_color(rgba, dst->format, &uc); + util_pack_color(color->f, dst->format, &uc); i915_fill_blit( i915_context(pipe), util_format_get_blocksize(pt->format), XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB, diff --git a/src/gallium/drivers/i965/brw_pipe_clear.c b/src/gallium/drivers/i965/brw_pipe_clear.c index 7bf3ea6994a..847b11565d4 100644 --- a/src/gallium/drivers/i965/brw_pipe_clear.c +++ b/src/gallium/drivers/i965/brw_pipe_clear.c @@ -201,7 +201,7 @@ static void zstencil_clear(struct brw_context *brw, */ static void brw_clear(struct pipe_context *pipe, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -212,7 +212,7 @@ static void brw_clear(struct pipe_context *pipe, for (i = 0; i < brw->curr.fb.nr_cbufs; i++) { color_clear( brw, brw_surface(brw->curr.fb.cbufs[i]), - rgba ); + color->f ); } } @@ -229,7 +229,7 @@ static void brw_clear(struct pipe_context *pipe, /* XXX should respect region */ static void brw_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -237,7 +237,7 @@ static void brw_clear_render_target(struct pipe_context *pipe, color_clear( brw, brw_surface(dst), - rgba ); + color->f ); } /* XXX should respect region */ diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 2a9d7360155..a9043c1590b 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -606,7 +606,7 @@ identity_resource_copy_region(struct pipe_context *_pipe, static void identity_clear(struct pipe_context *_pipe, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -615,7 +615,7 @@ identity_clear(struct pipe_context *_pipe, pipe->clear(pipe, buffers, - rgba, + color, depth, stencil); } @@ -623,7 +623,7 @@ identity_clear(struct pipe_context *_pipe, static void identity_clear_render_target(struct pipe_context *_pipe, struct pipe_surface *_dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -634,7 +634,7 @@ identity_clear_render_target(struct pipe_context *_pipe, pipe->clear_render_target(pipe, dst, - rgba, + color, dstx, dsty, width, diff --git a/src/gallium/drivers/llvmpipe/lp_clear.c b/src/gallium/drivers/llvmpipe/lp_clear.c index b486b243eb5..be2fce1307c 100644 --- a/src/gallium/drivers/llvmpipe/lp_clear.c +++ b/src/gallium/drivers/llvmpipe/lp_clear.c @@ -46,7 +46,7 @@ void llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -58,5 +58,5 @@ llvmpipe_clear(struct pipe_context *pipe, if (LP_PERF & PERF_NO_DEPTH) buffers &= ~PIPE_CLEAR_DEPTHSTENCIL; - lp_setup_clear( llvmpipe->setup, rgba, depth, stencil, buffers ); + lp_setup_clear( llvmpipe->setup, color->f, depth, stencil, buffers ); } diff --git a/src/gallium/drivers/llvmpipe/lp_clear.h b/src/gallium/drivers/llvmpipe/lp_clear.h index 6d4ffccdf45..29ca0b796c3 100644 --- a/src/gallium/drivers/llvmpipe/lp_clear.h +++ b/src/gallium/drivers/llvmpipe/lp_clear.h @@ -36,7 +36,8 @@ struct pipe_context; extern void -llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, +llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil); diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index 7c133c5f159..ead97df494c 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -224,13 +224,13 @@ static void noop_transfer_inline_write(struct pipe_context *pipe, * clear/copy */ static void noop_clear(struct pipe_context *ctx, unsigned buffers, - const float *rgba, double depth, unsigned stencil) + const union pipe_color_union *color, double depth, unsigned stencil) { } static void noop_clear_render_target(struct pipe_context *ctx, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index ecffbbf86e6..edd79159e72 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -178,7 +178,8 @@ extern boolean nv50_state_validate(struct nv50_context *, uint32_t state_mask, /* nv50_surface.c */ extern void nv50_clear(struct pipe_context *, unsigned buffers, - const float *rgba, double depth, unsigned stencil); + const union pipe_color_union *color, + double depth, unsigned stencil); extern void nv50_init_surface_functions(struct nv50_context *); /* nv50_tex.c */ diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index b0a8497c1e7..83bb9434afa 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -261,7 +261,7 @@ nv50_resource_copy_region(struct pipe_context *pipe, static void nv50_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -273,10 +273,10 @@ nv50_clear_render_target(struct pipe_context *pipe, struct nouveau_bo *bo = mt->base.bo; BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4); - OUT_RINGf (chan, rgba[0]); - OUT_RINGf (chan, rgba[1]); - OUT_RINGf (chan, rgba[2]); - OUT_RINGf (chan, rgba[3]); + OUT_RINGf (chan, color->f[0]); + OUT_RINGf (chan, color->f[1]); + OUT_RINGf (chan, color->f[2]); + OUT_RINGf (chan, color->f[3]); if (MARK_RING(chan, 18, 2)) return; @@ -374,7 +374,8 @@ nv50_clear_depth_stencil(struct pipe_context *pipe, void nv50_clear(struct pipe_context *pipe, unsigned buffers, - const float *rgba, double depth, unsigned stencil) + const union pipe_color_union *color, + double depth, unsigned stencil) { struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_channel *chan = nv50->screen->base.channel; @@ -388,10 +389,10 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) { BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4); - OUT_RINGf (chan, rgba[0]); - OUT_RINGf (chan, rgba[1]); - OUT_RINGf (chan, rgba[2]); - OUT_RINGf (chan, rgba[3]); + OUT_RINGf (chan, color->f[0]); + OUT_RINGf (chan, color->f[1]); + OUT_RINGf (chan, color->f[2]); + OUT_RINGf (chan, color->f[3]); mode = NV50_3D_CLEAR_BUFFERS_R | NV50_3D_CLEAR_BUFFERS_G | NV50_3D_CLEAR_BUFFERS_B | NV50_3D_CLEAR_BUFFERS_A; diff --git a/src/gallium/drivers/nvc0/nvc0_context.h b/src/gallium/drivers/nvc0/nvc0_context.h index c11d1c32efe..c4e481c28cb 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.h +++ b/src/gallium/drivers/nvc0/nvc0_context.h @@ -187,7 +187,8 @@ extern boolean nvc0_state_validate(struct nvc0_context *, uint32_t state_mask, /* nvc0_surface.c */ extern void nvc0_clear(struct pipe_context *, unsigned buffers, - const float *rgba, double depth, unsigned stencil); + const union pipe_color_union *color, + double depth, unsigned stencil); extern void nvc0_init_surface_functions(struct nvc0_context *); /* nvc0_tex.c */ diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c index 61aa1a17f1d..ff07aad00d0 100644 --- a/src/gallium/drivers/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nvc0/nvc0_surface.c @@ -267,7 +267,7 @@ nvc0_resource_copy_region(struct pipe_context *pipe, static void nvc0_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -279,10 +279,10 @@ nvc0_clear_render_target(struct pipe_context *pipe, struct nouveau_bo *bo = mt->base.bo; BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4); - OUT_RINGf (chan, rgba[0]); - OUT_RINGf (chan, rgba[1]); - OUT_RINGf (chan, rgba[2]); - OUT_RINGf (chan, rgba[3]); + OUT_RINGf (chan, color->f[0]); + OUT_RINGf (chan, color->f[1]); + OUT_RINGf (chan, color->f[2]); + OUT_RINGf (chan, color->f[3]); if (MARK_RING(chan, 18, 2)) return; @@ -377,7 +377,8 @@ nvc0_clear_depth_stencil(struct pipe_context *pipe, void nvc0_clear(struct pipe_context *pipe, unsigned buffers, - const float *rgba, double depth, unsigned stencil) + const union pipe_color_union *color, + double depth, unsigned stencil) { struct nvc0_context *nvc0 = nvc0_context(pipe); struct nouveau_channel *chan = nvc0->screen->base.channel; @@ -391,10 +392,10 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers, if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) { BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4); - OUT_RINGf (chan, rgba[0]); - OUT_RINGf (chan, rgba[1]); - OUT_RINGf (chan, rgba[2]); - OUT_RINGf (chan, rgba[3]); + OUT_RINGf (chan, color->f[0]); + OUT_RINGf (chan, color->f[1]); + OUT_RINGf (chan, color->f[2]); + OUT_RINGf (chan, color->f[3]); mode = NVC0_3D_CLEAR_BUFFERS_R | NVC0_3D_CLEAR_BUFFERS_G | NVC0_3D_CLEAR_BUFFERS_B | NVC0_3D_CLEAR_BUFFERS_A; diff --git a/src/gallium/drivers/nvfx/nvfx_clear.c b/src/gallium/drivers/nvfx/nvfx_clear.c index 2be70fcee40..46f23e38260 100644 --- a/src/gallium/drivers/nvfx/nvfx_clear.c +++ b/src/gallium/drivers/nvfx/nvfx_clear.c @@ -7,8 +7,8 @@ void nvfx_clear(struct pipe_context *pipe, unsigned buffers, - const float *rgba, double depth, unsigned stencil) + const union pipe_color_union *color, double depth, unsigned stencil) { - util_clear(pipe, &nvfx_context(pipe)->framebuffer, buffers, rgba, depth, + util_clear(pipe, &nvfx_context(pipe)->framebuffer, buffers, color, depth, stencil); } diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h index cb40a521d1b..3d05ecc7807 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.h +++ b/src/gallium/drivers/nvfx/nvfx_context.h @@ -238,7 +238,8 @@ nvfx_create(struct pipe_screen *pscreen, void *priv); /* nvfx_clear.c */ extern void nvfx_clear(struct pipe_context *pipe, unsigned buffers, - const float *rgba, double depth, unsigned stencil); + const union pipe_color_union *color, + double depth, unsigned stencil); /* nvfx_draw.c */ extern struct draw_stage *nvfx_draw_render_stage(struct nvfx_context *nvfx); diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index 91ca1c3750e..d489bbf9473 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -478,19 +478,19 @@ nvfx_surface_flush(struct pipe_context* pipe, struct pipe_surface* surf) static void nvfx_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { union util_color uc; - util_pack_color(rgba, dst->format, &uc); + util_pack_color(color->f, dst->format, &uc); if(util_format_get_blocksizebits(dst->format) > 32 || nvfx_surface_fill(pipe, dst, dstx, dsty, width, height, uc.ui)) { // TODO: probably should use hardware clear here instead if possible struct blitter_context* blitter = nvfx_get_blitter(pipe, 0); - util_blitter_clear_render_target(blitter, dst, rgba, dstx, dsty, width, height); + util_blitter_clear_render_target(blitter, dst, color, dstx, dsty, width, height); nvfx_put_blitter(pipe, blitter); } } diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index ddf5448a34b..3c1b3648a24 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -174,7 +174,7 @@ static uint32_t r300_hiz_clear_value(double depth) /* Clear currently bound buffers. */ static void r300_clear(struct pipe_context* pipe, unsigned buffers, - const float* rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -281,7 +281,7 @@ static void r300_clear(struct pipe_context* pipe, struct r300_surface *surf = r300_surface(fb->cbufs[0]); hyperz->zb_depthclearvalue = - r300_depth_clear_cb_value(surf->base.format, rgba); + r300_depth_clear_cb_value(surf->base.format, color->f); width = surf->cbzb_width; height = surf->cbzb_height; @@ -298,7 +298,7 @@ static void r300_clear(struct pipe_context* pipe, width, height, fb->nr_cbufs, - buffers, rgba, depth, stencil); + buffers, color, depth, stencil); r300_blitter_end(r300); } else if (r300->zmask_clear.dirty || r300->hiz_clear.dirty) { /* Just clear zmask and hiz now, this does not use the standard draw @@ -348,14 +348,14 @@ static void r300_clear(struct pipe_context* pipe, /* Clear a region of a color surface to a constant value. */ static void r300_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { struct r300_context *r300 = r300_context(pipe); r300_blitter_begin(r300, R300_CLEAR_SURFACE); - util_blitter_clear_render_target(r300->blitter, dst, rgba, + util_blitter_clear_render_target(r300->blitter, dst, color, dstx, dsty, width, height); r300_blitter_end(r300); } diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index d69b4cf4275..fc3ba335886 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -1186,7 +1186,7 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter, unsigned x2, unsigned y2, float depth, enum blitter_attrib_type type, - const float attrib[4]) + const union pipe_color_union *attrib) { struct r300_context *r300 = r300_context(util_blitter_get_pipe(blitter)); unsigned last_sprite_coord_enable = r300->sprite_coord_enable; @@ -1196,7 +1196,7 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter, type == UTIL_BLITTER_ATTRIB_COLOR || !r300->draw ? 8 : 4; unsigned dwords = 13 + vertex_size + (type == UTIL_BLITTER_ATTRIB_TEXCOORD ? 7 : 0); - const float zeros[4] = {0, 0, 0, 0}; + static const union pipe_color_union zeros; CS_LOCALS(r300); if (r300->skip_rendering) @@ -1227,10 +1227,10 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter, OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE | (R300_GB_TEX_STR << R300_GB_TEX0_SOURCE_SHIFT)); OUT_CS_REG_SEQ(R300_GA_POINT_S0, 4); - OUT_CS_32F(attrib[0]); - OUT_CS_32F(attrib[3]); - OUT_CS_32F(attrib[2]); - OUT_CS_32F(attrib[1]); + OUT_CS_32F(attrib->f[0]); + OUT_CS_32F(attrib->f[3]); + OUT_CS_32F(attrib->f[2]); + OUT_CS_32F(attrib->f[1]); } /* Set up VAP controls. */ @@ -1253,8 +1253,8 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter, if (vertex_size == 8) { if (!attrib) - attrib = zeros; - OUT_CS_TABLE(attrib, 4); + attrib = &zeros; + OUT_CS_TABLE(attrib->f, 4); } END_CS; @@ -1273,7 +1273,7 @@ static void r300_resource_resolve(struct pipe_context *pipe, struct r300_context *r300 = r300_context(pipe); struct pipe_surface *srcsurf, *dstsurf, surf_tmpl; struct r300_aa_state *aa = (struct r300_aa_state*)r300->aa_state.state; - float color[] = {0, 0, 0, 0}; + static const union pipe_color_union color; memset(&surf_tmpl, 0, sizeof(surf_tmpl)); surf_tmpl.format = info->src.res->format; @@ -1301,7 +1301,7 @@ static void r300_resource_resolve(struct pipe_context *pipe, /* Resolve the surface. */ /* XXX: y1 < 0 ==> Y flip */ r300->context.clear_render_target(pipe, - srcsurf, color, 0, 0, + srcsurf, &color, 0, 0, info->dst.x1 - info->dst.x0, info->dst.y1 - info->dst.y0); diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 9a71c8447c6..dfc43feb5d9 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -200,28 +200,29 @@ void r600_flush_depth_textures(struct r600_pipe_context *rctx) } static void r600_clear(struct pipe_context *ctx, unsigned buffers, - const float *rgba, double depth, unsigned stencil) + const union pipe_color_union *color, + double depth, unsigned stencil) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct pipe_framebuffer_state *fb = &rctx->framebuffer; r600_blitter_begin(ctx, R600_CLEAR); util_blitter_clear(rctx->blitter, fb->width, fb->height, - fb->nr_cbufs, buffers, rgba, depth, - stencil); + fb->nr_cbufs, buffers, color, depth, + stencil); r600_blitter_end(ctx); } static void r600_clear_render_target(struct pipe_context *ctx, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; r600_blitter_begin(ctx, R600_CLEAR_SURFACE); - util_blitter_clear_render_target(rctx->blitter, dst, rgba, + util_blitter_clear_render_target(rctx->blitter, dst, color, dstx, dsty, width, height); r600_blitter_end(ctx); } diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 6e2d6ba1efa..6690c0208bd 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -873,7 +873,7 @@ rbug_resource_copy_region(struct pipe_context *_pipe, static void rbug_clear(struct pipe_context *_pipe, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -883,7 +883,7 @@ rbug_clear(struct pipe_context *_pipe, pipe_mutex_lock(rb_pipe->call_mutex); pipe->clear(pipe, buffers, - rgba, + color, depth, stencil); pipe_mutex_unlock(rb_pipe->call_mutex); @@ -892,7 +892,7 @@ rbug_clear(struct pipe_context *_pipe, static void rbug_clear_render_target(struct pipe_context *_pipe, struct pipe_surface *_dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -904,7 +904,7 @@ rbug_clear_render_target(struct pipe_context *_pipe, pipe_mutex_lock(rb_pipe->call_mutex); pipe->clear_render_target(pipe, dst, - rgba, + color, dstx, dsty, width, diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c index 22e8a2e5817..bfb16be82ac 100644 --- a/src/gallium/drivers/softpipe/sp_clear.c +++ b/src/gallium/drivers/softpipe/sp_clear.c @@ -45,7 +45,8 @@ * No masking, no scissor (clear entire buffer). */ void -softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, +softpipe_clear(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -67,8 +68,8 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; - util_pack_color(rgba, ps->format, &uc); - sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, uc.ui); + util_pack_color(color->f, ps->format, &uc); + sp_tile_cache_clear(softpipe->cbuf_cache[i], color->f, uc.ui); } } diff --git a/src/gallium/drivers/softpipe/sp_clear.h b/src/gallium/drivers/softpipe/sp_clear.h index 9be3b86fe9f..6dd7d132fe8 100644 --- a/src/gallium/drivers/softpipe/sp_clear.h +++ b/src/gallium/drivers/softpipe/sp_clear.h @@ -35,7 +35,8 @@ struct pipe_context; extern void -softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, +softpipe_clear(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil); diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 34b9e85c1a3..f8c1ab40345 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -414,7 +414,7 @@ struct svga_context */ void svga_clear(struct pipe_context *pipe, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil); diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c index 2bba77769ad..d9ff79cc5ee 100644 --- a/src/gallium/drivers/svga/svga_pipe_clear.c +++ b/src/gallium/drivers/svga/svga_pipe_clear.c @@ -37,7 +37,7 @@ static enum pipe_error try_clear(struct svga_context *svga, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -61,7 +61,7 @@ try_clear(struct svga_context *svga, if ((buffers & PIPE_CLEAR_COLOR) && fb->cbufs[0]) { flags |= SVGA3D_CLEAR_COLOR; - util_pack_color(rgba, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); + util_pack_color(color->f, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); rect.w = fb->cbufs[0]->width; rect.h = fb->cbufs[0]->height; @@ -104,7 +104,8 @@ try_clear(struct svga_context *svga, * No masking, no scissor (clear entire buffer). */ void -svga_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, +svga_clear(struct pipe_context *pipe, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil) { struct svga_context *svga = svga_context( pipe ); @@ -114,14 +115,14 @@ svga_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, SVGA_DBG(DEBUG_DMA, "clear sid %p\n", svga_surface(svga->curr.framebuffer.cbufs[0])->handle); - ret = try_clear( svga, buffers, rgba, depth, stencil ); + ret = try_clear( svga, buffers, color, depth, stencil ); if (ret == PIPE_ERROR_OUT_OF_MEMORY) { /* Flush command buffer and retry: */ svga_context_flush( svga, NULL ); - ret = try_clear( svga, buffers, rgba, depth, stencil ); + ret = try_clear( svga, buffers, color, depth, stencil ); } /* diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 254976e099c..6021bb92ab6 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1105,7 +1105,7 @@ trace_context_resource_copy_region(struct pipe_context *_pipe, static INLINE void trace_context_clear(struct pipe_context *_pipe, unsigned buffers, - const float *rgba, + const union pipe_color_union *color, double depth, unsigned stencil) { @@ -1116,14 +1116,14 @@ trace_context_clear(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(uint, buffers); - if (rgba) - trace_dump_arg_array(float, rgba, 4); + if (color) + trace_dump_arg_array(float, color->f, 4); else trace_dump_null(); trace_dump_arg(float, depth); trace_dump_arg(uint, stencil); - pipe->clear(pipe, buffers, rgba, depth, stencil); + pipe->clear(pipe, buffers, color, depth, stencil); trace_dump_call_end(); } @@ -1132,7 +1132,7 @@ trace_context_clear(struct pipe_context *_pipe, static INLINE void trace_context_clear_render_target(struct pipe_context *_pipe, struct pipe_surface *dst, - const float *rgba, + const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { @@ -1145,13 +1145,13 @@ trace_context_clear_render_target(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, dst); - trace_dump_arg_array(float, rgba, 4); + trace_dump_arg_array(float, color->f, 4); trace_dump_arg(uint, dstx); trace_dump_arg(uint, dsty); trace_dump_arg(uint, width); trace_dump_arg(uint, height); - pipe->clear_render_target(pipe, dst, rgba, dstx, dsty, width, height); + pipe->clear_render_target(pipe, dst, color, dstx, dsty, width, height); trace_dump_call_end(); } |