[Mesa-dev] [PATCH] gallium: move clear paths from rgba to a pointer to a color union
Jose Fonseca
jfonseca at vmware.com
Thu Sep 15 07:17:44 PDT 2011
The interpretation of pipe_color_union depends on state which is not readily available (IIUC, it depends on the pipe format of the respective color rendertarget). I think this is recipe for a lot of bugs.
It might be worthwhile either to:
a) pass the used type as new argument clear
b) pass the type in pipe_color_union itself
struct pipe_color_union
{
enum {
PIPE_COLOR_TYPE_FLOAT = 0,
PIPE_COLOR_TYPE_INT,
PIPE_COLOR_TYPE_UINT
} type;
union {
float f[4];
int i[4];
unsigned int ui[4];
} u;
};
c) simply use double[4] for colors (and when int64 comes along, just use long double double).
Either a) or b) allow one to easily sprinkle asserts to ensure that things match up. c) seems the easiest of all, at least for clears.
Jose
----- Original Message -----
> From: Dave Airlie <airlied at redhat.com>
>
> This moves the gallium interface for clears from using a pointer to 4
> floats
> to a pointer to a union of float/unsigned/int values. This is step
> one
> in allowing integer clears. I've tried to build as many
> drivers/pieces
> as I could, but I think I missed a couple, (vega for instance seems
> to
> need a bit more work).
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/auxiliary/postprocess/pp_mlaa.c | 2 +-
> src/gallium/auxiliary/postprocess/pp_program.h | 2 +-
> src/gallium/auxiliary/postprocess/pp_run.c | 2 +-
> src/gallium/auxiliary/util/u_blitter.c | 44
> ++++++++++---------
> src/gallium/auxiliary/util/u_blitter.h | 6 +-
> src/gallium/auxiliary/util/u_clear.h | 4 +-
> src/gallium/auxiliary/util/u_surface.c | 4 +-
> src/gallium/auxiliary/util/u_surface.h | 2 +-
> src/gallium/auxiliary/vl/vl_compositor.c | 22 ++++------
> src/gallium/auxiliary/vl/vl_compositor.h | 6 +-
> src/gallium/drivers/cell/ppu/cell_clear.c | 5 +-
> src/gallium/drivers/cell/ppu/cell_clear.h | 3 +-
> src/gallium/drivers/galahad/glhd_context.c | 8 ++--
> src/gallium/drivers/i915/i915_clear.c | 17 ++++---
> src/gallium/drivers/i915/i915_context.h | 9 +++-
> src/gallium/drivers/i915/i915_surface.c | 8 ++--
> src/gallium/drivers/i965/brw_pipe_clear.c | 8 ++--
> src/gallium/drivers/identity/id_context.c | 8 ++--
> src/gallium/drivers/llvmpipe/lp_clear.c | 4 +-
> src/gallium/drivers/llvmpipe/lp_clear.h | 3 +-
> src/gallium/drivers/noop/noop_pipe.c | 4 +-
> src/gallium/drivers/nv50/nv50_context.h | 3 +-
> src/gallium/drivers/nv50/nv50_surface.c | 21 +++++----
> src/gallium/drivers/nvc0/nvc0_context.h | 3 +-
> src/gallium/drivers/nvc0/nvc0_surface.c | 21 +++++----
> src/gallium/drivers/nvfx/nvfx_clear.c | 4 +-
> src/gallium/drivers/nvfx/nvfx_context.h | 3 +-
> src/gallium/drivers/nvfx/nvfx_surface.c | 6 +-
> src/gallium/drivers/r300/r300_blit.c | 10 ++--
> src/gallium/drivers/r300/r300_render.c | 20 ++++----
> src/gallium/drivers/r600/r600_blit.c | 11 +++--
> src/gallium/drivers/rbug/rbug_context.c | 8 ++--
> src/gallium/drivers/softpipe/sp_clear.c | 7 ++-
> src/gallium/drivers/softpipe/sp_clear.h | 3 +-
> src/gallium/drivers/svga/svga_context.h | 2 +-
> src/gallium/drivers/svga/svga_pipe_clear.c | 11 +++--
> src/gallium/drivers/trace/tr_context.c | 14 +++---
> src/gallium/include/pipe/p_context.h | 10 ++--
> src/gallium/include/pipe/p_defines.h | 6 +++
> .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 10 ++--
> .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 7 +++-
> src/gallium/state_trackers/vdpau/presentation.c | 16 ++++++-
> src/gallium/tests/graw/clear.c | 4 +-
> src/mesa/state_tracker/st_cb_clear.c | 22 +++++-----
> src/mesa/state_tracker/st_extensions.c | 4 +-
> 45 files changed, 218 insertions(+), 179 deletions(-)
>
> diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c
> b/src/gallium/auxiliary/postprocess/pp_mlaa.c
> index 476502f..5708687 100644
> --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
> +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
> @@ -121,7 +121,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct
> pipe_resource *in,
> pp_filter_misc_state(p);
> cso_set_depth_stencil_alpha(p->cso, &mstencil);
> p->pipe->clear(p->pipe, PIPE_CLEAR_STENCIL | PIPE_CLEAR_COLOR,
> - p->clear_color, 0, 0);
> + &p->clear_color, 0, 0);
>
> cso_single_sampler(p->cso, 0, &p->sampler_point);
> cso_single_sampler_done(p->cso);
> diff --git a/src/gallium/auxiliary/postprocess/pp_program.h
> b/src/gallium/auxiliary/postprocess/pp_program.h
> index 2749b35..a85ba6e 100644
> --- a/src/gallium/auxiliary/postprocess/pp_program.h
> +++ b/src/gallium/auxiliary/postprocess/pp_program.h
> @@ -49,7 +49,7 @@ struct program
> struct pipe_framebuffer_state framebuffer;
> struct pipe_vertex_element velem[2];
>
> - float clear_color[4];
> + union pipe_color_union clear_color;
>
> void *passvs;
>
> diff --git a/src/gallium/auxiliary/postprocess/pp_run.c
> b/src/gallium/auxiliary/postprocess/pp_run.c
> index ce671ae..de1fe55 100644
> --- a/src/gallium/auxiliary/postprocess/pp_run.c
> +++ b/src/gallium/auxiliary/postprocess/pp_run.c
> @@ -184,5 +184,5 @@ void
> pp_filter_set_clear_fb(struct program *p)
> {
> cso_set_framebuffer(p->cso, &p->framebuffer);
> - p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, p->clear_color, 0, 0);
> + p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, &p->clear_color, 0, 0);
> }
> diff --git a/src/gallium/auxiliary/util/u_blitter.c
> b/src/gallium/auxiliary/util/u_blitter.c
> index d69fb1a..58a52b3 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -111,7 +111,7 @@ static void blitter_draw_rectangle(struct
> blitter_context *blitter,
> unsigned width, unsigned height,
> float depth,
> enum blitter_attrib_type type,
> - const float attrib[4]);
> + const union pipe_color_union
> *attrib);
>
>
> struct blitter_context *util_blitter_create(struct pipe_context
> *pipe)
> @@ -398,16 +398,16 @@ static void blitter_set_rectangle(struct
> blitter_context_priv *ctx,
> }
>
> static void blitter_set_clear_color(struct blitter_context_priv
> *ctx,
> - const float *rgba)
> + const union pipe_color_union
> *color)
> {
> int i;
>
> - if (rgba) {
> + if (color) {
> for (i = 0; i < 4; i++) {
> - ctx->vertices[i][1][0] = rgba[0];
> - ctx->vertices[i][1][1] = rgba[1];
> - ctx->vertices[i][1][2] = rgba[2];
> - ctx->vertices[i][1][3] = rgba[3];
> + ctx->vertices[i][1][0] = color->f[0];
> + ctx->vertices[i][1][1] = color->f[1];
> + ctx->vertices[i][1][2] = color->f[2];
> + ctx->vertices[i][1][3] = color->f[3];
> }
> } else {
> for (i = 0; i < 4; i++) {
> @@ -647,7 +647,7 @@ static void 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 blitter_context_priv *ctx = (struct
> blitter_context_priv*)blitter;
>
> @@ -657,7 +657,7 @@ static void blitter_draw_rectangle(struct
> blitter_context *blitter,
> break;
>
> case UTIL_BLITTER_ATTRIB_TEXCOORD:
> - set_texcoords_in_vertices(attrib, &ctx->vertices[0][1][0],
> 8);
> + set_texcoords_in_vertices(attrib->f,
> &ctx->vertices[0][1][0], 8);
> break;
>
> default:;
> @@ -674,7 +674,7 @@ static void util_blitter_clear_custom(struct
> blitter_context *blitter,
> unsigned width, unsigned
> height,
> unsigned num_cbufs,
> unsigned clear_buffers,
> - const float *rgba,
> + const union pipe_color_union
> *color,
> double depth, unsigned
> stencil,
> void *custom_blend, void
> *custom_dsa)
> {
> @@ -717,7 +717,7 @@ static void util_blitter_clear_custom(struct
> blitter_context *blitter,
>
> blitter_set_dst_dimensions(ctx, width, height);
> blitter->draw_rectangle(blitter, 0, 0, width, height, depth,
> - UTIL_BLITTER_ATTRIB_COLOR, rgba);
> + UTIL_BLITTER_ATTRIB_COLOR, color);
> blitter_restore_CSOs(ctx);
> }
>
> @@ -725,11 +725,11 @@ void util_blitter_clear(struct blitter_context
> *blitter,
> unsigned width, unsigned height,
> unsigned num_cbufs,
> unsigned clear_buffers,
> - const float *rgba,
> + const union pipe_color_union *color,
> double depth, unsigned stencil)
> {
> util_blitter_clear_custom(blitter, width, height, num_cbufs,
> - clear_buffers, rgba, depth, stencil,
> + clear_buffers, color, depth, stencil,
> NULL, NULL);
> }
>
> @@ -737,9 +737,9 @@ void util_blitter_clear_depth_custom(struct
> blitter_context *blitter,
> unsigned width, unsigned
> height,
> double depth, void *custom_dsa)
> {
> - const float rgba[4] = {0, 0, 0, 0};
> + static const union pipe_color_union color;
> util_blitter_clear_custom(blitter, width, height, 0,
> - 0, rgba, depth, 0, NULL, custom_dsa);
> + 0, &color, depth, 0, NULL,
> custom_dsa);
> }
>
> static
> @@ -869,14 +869,16 @@ void util_blitter_copy_texture(struct
> blitter_context *blitter,
> case PIPE_TEXTURE_2D:
> case PIPE_TEXTURE_RECT:
> {
> - /* Set texture coordinates. */
> - float coord[4];
> + /* Set texture coordinates. - use a pipe color union
> + * for interface purposes
> + */
> + union pipe_color_union coord;
> get_texcoords(src, srclevel, srcbox->x, srcbox->y,
> - srcbox->x+width, srcbox->y+height,
> normalized, coord);
> + srcbox->x+width, srcbox->y+height,
> normalized, coord.f);
>
> /* Draw. */
> blitter->draw_rectangle(blitter, dstx, dsty, dstx+width,
> dsty+height, 0,
> - UTIL_BLITTER_ATTRIB_TEXCOORD,
> coord);
> + UTIL_BLITTER_ATTRIB_TEXCOORD,
> &coord);
> }
> break;
>
> @@ -925,7 +927,7 @@ void util_blitter_copy_texture(struct
> blitter_context *blitter,
> /* Clear a region of a color surface to a constant value. */
> void util_blitter_clear_render_target(struct blitter_context
> *blitter,
> struct pipe_surface *dstsurf,
> - const float *rgba,
> + const union pipe_color_union
> *color,
> unsigned dstx, unsigned dsty,
> unsigned width, unsigned
> height)
> {
> @@ -959,7 +961,7 @@ void util_blitter_clear_render_target(struct
> blitter_context *blitter,
>
> blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
> blitter->draw_rectangle(blitter, dstx, dsty, dstx+width,
> dsty+height, 0,
> - UTIL_BLITTER_ATTRIB_COLOR, rgba);
> + UTIL_BLITTER_ATTRIB_COLOR, color);
> blitter_restore_CSOs(ctx);
> }
>
> diff --git a/src/gallium/auxiliary/util/u_blitter.h
> b/src/gallium/auxiliary/util/u_blitter.h
> index df6f023..a9ad023 100644
> --- a/src/gallium/auxiliary/util/u_blitter.h
> +++ b/src/gallium/auxiliary/util/u_blitter.h
> @@ -77,7 +77,7 @@ struct blitter_context
> unsigned x1, unsigned y1, unsigned x2,
> unsigned y2,
> float depth,
> enum blitter_attrib_type type,
> - const float attrib[4]);
> + const union pipe_color_union *color);
>
> /* Whether the blitter is running. */
> boolean running;
> @@ -144,7 +144,7 @@ void util_blitter_clear(struct blitter_context
> *blitter,
> unsigned width, unsigned height,
> unsigned num_cbufs,
> unsigned clear_buffers,
> - const float *rgba,
> + const union pipe_color_union *color,
> double depth, unsigned stencil);
>
> void util_blitter_clear_depth_custom(struct blitter_context
> *blitter,
> @@ -190,7 +190,7 @@ void util_blitter_copy_texture(struct
> blitter_context *blitter,
> */
> void util_blitter_clear_render_target(struct blitter_context
> *blitter,
> 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/auxiliary/util/u_clear.h
> b/src/gallium/auxiliary/util/u_clear.h
> index ad69df3..e9fd874 100644
> --- a/src/gallium/auxiliary/util/u_clear.h
> +++ b/src/gallium/auxiliary/util/u_clear.h
> @@ -40,13 +40,13 @@
> static INLINE void
> util_clear(struct pipe_context *pipe,
> struct pipe_framebuffer_state *framebuffer, unsigned
> buffers,
> - const float *rgba, double depth, unsigned stencil)
> + const union pipe_color_union *color, double depth,
> unsigned stencil)
> {
> if (buffers & PIPE_CLEAR_COLOR) {
> unsigned i;
> for (i = 0; i < framebuffer->nr_cbufs; i++) {
> struct pipe_surface *ps = framebuffer->cbufs[i];
> - pipe->clear_render_target(pipe, ps, rgba, 0, 0, ps->width,
> ps->height);
> + pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width,
> ps->height);
> }
> }
>
> diff --git a/src/gallium/auxiliary/util/u_surface.c
> b/src/gallium/auxiliary/util/u_surface.c
> index 8e12386..308511b 100644
> --- a/src/gallium/auxiliary/util/u_surface.c
> +++ b/src/gallium/auxiliary/util/u_surface.c
> @@ -228,7 +228,7 @@ util_resource_copy_region(struct pipe_context
> *pipe,
> void
> util_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)
> {
> @@ -254,7 +254,7 @@ util_clear_render_target(struct pipe_context
> *pipe,
> if (dst_map) {
> assert(dst_trans->stride > 0);
>
> - util_pack_color(rgba, dst->texture->format, &uc);
> + util_pack_color(color->f, dst->texture->format, &uc);
> util_fill_rect(dst_map, dst->texture->format,
> dst_trans->stride,
> 0, 0, width, height, &uc);
> diff --git a/src/gallium/auxiliary/util/u_surface.h
> b/src/gallium/auxiliary/util/u_surface.h
> index 6a7cc82..1117b78 100644
> --- a/src/gallium/auxiliary/util/u_surface.h
> +++ b/src/gallium/auxiliary/util/u_surface.h
> @@ -68,7 +68,7 @@ util_resource_copy_region(struct pipe_context
> *pipe,
> extern void
> util_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);
>
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c
> b/src/gallium/auxiliary/vl/vl_compositor.c
> index ebe6d7a..422adf8 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.c
> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
> @@ -502,7 +502,7 @@ gen_vertex_data(struct vl_compositor *c)
> c->dirty_tl.y >= layer->dst.tl.y &&
> c->dirty_br.x <= layer->dst.br.x &&
> c->dirty_br.y <= layer->dst.br.y) {
> -
> +
> // We clear the dirty area anyway, no need for
> clear_render_target
> c->dirty_tl.x = c->dirty_tl.y = 1.0f;
> c->dirty_br.x = c->dirty_br.y = 0.0f;
> @@ -552,26 +552,20 @@ vl_compositor_reset_dirty_area(struct
> vl_compositor *c)
> }
>
> void
> -vl_compositor_set_clear_color(struct vl_compositor *c, float
> color[4])
> +vl_compositor_set_clear_color(struct vl_compositor *c, union
> pipe_color_union *color)
> {
> - unsigned i;
> -
> assert(c);
>
> - for (i = 0; i < 4; ++i)
> - c->clear_color[i] = color[i];
> + c->clear_color = *color;
> }
>
> void
> -vl_compositor_get_clear_color(struct vl_compositor *c, float
> color[4])
> +vl_compositor_get_clear_color(struct vl_compositor *c, union
> pipe_color_union *color)
> {
> - unsigned i;
> -
> assert(c);
> assert(color);
>
> - for (i = 0; i < 4; ++i)
> - color[i] = c->clear_color[i];
> + *color = c->clear_color;
> }
>
> void
> @@ -760,7 +754,7 @@ vl_compositor_render(struct vl_compositor *c,
>
> if (clear_dirty_area && (c->dirty_tl.x < c->dirty_br.x ||
> c->dirty_tl.y < c->dirty_br.y)) {
> - util_clear_render_target(c->pipe, dst_surface, c->clear_color,
> + util_clear_render_target(c->pipe, dst_surface,
> &c->clear_color,
> 0, 0, dst_surface->width,
> dst_surface->height);
> c->dirty_tl.x = c->dirty_tl.y = 1.0f;
> c->dirty_br.x = c->dirty_br.y = 0.0f;
> @@ -804,8 +798,8 @@ vl_compositor_init(struct vl_compositor *c,
> struct pipe_context *pipe)
> vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_IDENTITY, NULL, true,
> csc_matrix);
> vl_compositor_set_csc_matrix(c, csc_matrix);
>
> - c->clear_color[0] = c->clear_color[1] = 0.0f;
> - c->clear_color[2] = c->clear_color[3] = 0.0f;
> + c->clear_color.f[0] = c->clear_color.f[1] = 0.0f;
> + c->clear_color.f[2] = c->clear_color.f[3] = 0.0f;
> vl_compositor_reset_dirty_area(c);
>
> return true;
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.h
> b/src/gallium/auxiliary/vl/vl_compositor.h
> index 0b9b993..f60f7da 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.h
> +++ b/src/gallium/auxiliary/vl/vl_compositor.h
> @@ -81,7 +81,7 @@ struct vl_compositor
> void *yuv;
> } fs_palette;
>
> - float clear_color[4];
> + union pipe_color_union clear_color;
> struct vertex2f dirty_tl, dirty_br;
>
> unsigned used_layers:VL_COMPOSITOR_MAX_LAYERS;
> @@ -110,13 +110,13 @@ vl_compositor_reset_dirty_area(struct
> vl_compositor *compositor);
> * set the clear color
> */
> void
> -vl_compositor_set_clear_color(struct vl_compositor *compositor,
> float color[4]);
> +vl_compositor_set_clear_color(struct vl_compositor *compositor,
> union pipe_color_union *color);
>
> /**
> * get the clear color
> */
> void
> -vl_compositor_get_clear_color(struct vl_compositor *compositor,
> float color[4]);
> +vl_compositor_get_clear_color(struct vl_compositor *compositor,
> union pipe_color_union *color);
>
> /**
> * set overlay samplers
> diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c
> b/src/gallium/drivers/cell/ppu/cell_clear.c
> index 246fe21..6a525ef 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 08e091a..a365feb 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 f73d8a5..a4afa81 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 4f9aa2c..c682c06 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 fca8688..f16bb72 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 41146be..4ba99a3 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 7bf3ea6..96a04dc 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 2a9d736..a9043c1 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 b486b24..be2fce1 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 6d4ffcc..29ca0b7 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 7c133c5..ead97df 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 ecffbbf..edd7915 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 b0a8497..83bb943 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 c11d1c3..c4e481c 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 61aa1a1..ff07aad 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 2be70fc..46f23e3 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 cb40a52..3d05ecc 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 91ca1c3..d489bbf 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 ddf5448..60ba588 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 d69b4cf..d1334cc 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 9a71c84..dfc43fe 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 6e2d6ba..6690c02 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 22e8a2e..bfb16be 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 9be3b86..6dd7d13 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 34b9e85..f8c1ab4 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 2bba777..d9ff79c 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 254976e..6021bb9 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();
> }
> diff --git a/src/gallium/include/pipe/p_context.h
> b/src/gallium/include/pipe/p_context.h
> index 49c12ec..b2d5f95 100644
> --- a/src/gallium/include/pipe/p_context.h
> +++ b/src/gallium/include/pipe/p_context.h
> @@ -63,7 +63,7 @@ struct pipe_vertex_element;
> struct pipe_video_buffer;
> struct pipe_video_decoder;
> struct pipe_viewport_state;
> -
> +union pipe_color_union;
>
> /**
> * Gallium rendering context. Basically:
> @@ -281,23 +281,23 @@ struct pipe_context {
> * The entire buffers are cleared (no scissor, no colormask,
> etc).
> *
> * \param buffers bitfield of PIPE_CLEAR_* values.
> - * \param rgba pointer to an array of one float for each of r,
> g, b, a.
> + * \param color pointer to a union of fiu array for each of r,
> g, b, a.
> * \param depth depth clear value in [0,1].
> * \param stencil stencil clear value
> */
> void (*clear)(struct pipe_context *pipe,
> unsigned buffers,
> - const float *rgba,
> + const union pipe_color_union *color,
> double depth,
> unsigned stencil);
>
> /**
> * Clear a color rendertarget surface.
> - * \param rgba pointer to an array of one float for each of r,
> g, b, a.
> + * \param color pointer to an union of fiu array for each of r,
> g, b, a.
> */
> void (*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);
>
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index 777a177..1773d9d 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -515,6 +515,12 @@ struct pipe_query_data_timestamp_disjoint
> boolean disjoint;
> };
>
> +union pipe_color_union
> +{
> + float f[4];
> + int i[4];
> + unsigned int ui[4];
> +};
>
> #ifdef __cplusplus
> }
> diff --git
> a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
> b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
> index 2bf0012..e3329e4 100644
> --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
> +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
> @@ -1162,7 +1162,7 @@ struct GalliumDXGISwapChain : public
> GalliumDXGIObject<IDXGISwapChain, GalliumDX
> if(1)
> {
> unsigned blit_x, blit_y, blit_w, blit_h;
> - float black[4] = {0, 0, 0, 0};
> + static const union pipe_color_union black;
>
> if(!formats_compatible || src->width0 != dst_w || src->height0 !=
> dst_h) {
> struct pipe_surface templat;
> @@ -1205,9 +1205,9 @@ struct GalliumDXGISwapChain : public
> GalliumDXGIObject<IDXGISwapChain, GalliumDX
> }
>
> if(blit_x)
> - pipe->clear_render_target(pipe, dst_surface, black, rect.left,
> rect.top, blit_x, dst_h);
> + pipe->clear_render_target(pipe, dst_surface, &black, rect.left,
> rect.top, blit_x, dst_h);
> if(blit_y)
> - pipe->clear_render_target(pipe, dst_surface, black, rect.left,
> rect.top, dst_w, blit_y);
> + pipe->clear_render_target(pipe, dst_surface, &black, rect.left,
> rect.top, dst_w, blit_y);
>
> if(formats_compatible && blit_w == src->width0 && blit_h ==
> src->height0)
> {
> @@ -1226,9 +1226,9 @@ struct GalliumDXGISwapChain : public
> GalliumDXGIObject<IDXGISwapChain, GalliumDX
> }
>
> if(blit_w != dst_w)
> - pipe->clear_render_target(pipe, dst_surface, black, rect.left +
> blit_x + blit_w, rect.top, dst_w - blit_x - blit_w, dst_h);
> + pipe->clear_render_target(pipe, dst_surface, &black, rect.left +
> blit_x + blit_w, rect.top, dst_w - blit_x - blit_w, dst_h);
> if(blit_h != dst_h)
> - pipe->clear_render_target(pipe, dst_surface, black, rect.left,
> rect.top + blit_y + blit_h, dst_w, dst_h - blit_y - blit_h);
> + pipe->clear_render_target(pipe, dst_surface, &black, rect.left,
> rect.top + blit_y + blit_h, dst_w, dst_h - blit_y - blit_h);
> }
>
> if(dst_surface)
> diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
> b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
> index 0a31cf1..e502508 100644
> --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
> +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
> @@ -1591,7 +1591,12 @@ changed:
> {
> SYNCHRONIZED;
> GalliumD3D11RenderTargetView* view =
> ((GalliumD3D11RenderTargetView*)render_target_view);
> - pipe->clear_render_target(pipe, view->object, color, 0, 0,
> view->object->width, view->object->height);
> + union pipe_color_union cc;
> + cc.f[0] = color[0];
> + cc.f[1] = color[1];
> + cc.f[2] = color[2];
> + cc.f[3] = color[3];
> + pipe->clear_render_target(pipe, view->object, &cc, 0, 0,
> view->object->width, view->object->height);
> }
>
> virtual void STDMETHODCALLTYPE ClearDepthStencilView(
> diff --git a/src/gallium/state_trackers/vdpau/presentation.c
> b/src/gallium/state_trackers/vdpau/presentation.c
> index b30b778..888cf31 100644
> --- a/src/gallium/state_trackers/vdpau/presentation.c
> +++ b/src/gallium/state_trackers/vdpau/presentation.c
> @@ -119,6 +119,7 @@
> vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue
> presentation_queue
> VdpColor *const
> background_color)
> {
> vlVdpPresentationQueue *pq;
> + union pipe_color_union color;
>
> VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Setting background color\n");
>
> @@ -129,7 +130,12 @@
> vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue
> presentation_queue
> if (!pq)
> return VDP_STATUS_INVALID_HANDLE;
>
> - vl_compositor_set_clear_color(&pq->compositor,
> (float*)background_color);
> + color.f[0] = background_color->red;
> + color.f[1] = background_color->green;
> + color.f[2] = background_color->blue;
> + color.f[3] = background_color->alpha;
> +
> + vl_compositor_set_clear_color(&pq->compositor, &color);
>
> return VDP_STATUS_OK;
> }
> @@ -142,6 +148,7 @@
> vlVdpPresentationQueueGetBackgroundColor(VdpPresentationQueue
> presentation_queue
> VdpColor *const
> background_color)
> {
> vlVdpPresentationQueue *pq;
> + union pipe_color_union color;
>
> VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Getting background color\n");
>
> @@ -152,7 +159,12 @@
> vlVdpPresentationQueueGetBackgroundColor(VdpPresentationQueue
> presentation_queue
> if (!pq)
> return VDP_STATUS_INVALID_HANDLE;
>
> - vl_compositor_get_clear_color(&pq->compositor,
> (float*)background_color);
> + vl_compositor_get_clear_color(&pq->compositor, &color);
> +
> + background_color->red = color.f[0];
> + background_color->green = color.f[1];
> + background_color->blue = color.f[2];
> + background_color->alpha = color.f[3];
>
> return VDP_STATUS_OK;
> }
> diff --git a/src/gallium/tests/graw/clear.c
> b/src/gallium/tests/graw/clear.c
> index 392d150..9c9eeeb 100644
> --- a/src/gallium/tests/graw/clear.c
> +++ b/src/gallium/tests/graw/clear.c
> @@ -26,9 +26,9 @@ static void *window = NULL;
>
> static void draw( void )
> {
> - float clear_color[4] = {1,0,1,1};
> + union pipe_color_union clear_color = { .f = {1, 0, 1, 1} };
>
> - ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
> + ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
> ctx->flush(ctx, NULL);
>
> graw_save_surface_to_file(ctx, surf, NULL);
> diff --git a/src/mesa/state_tracker/st_cb_clear.c
> b/src/mesa/state_tracker/st_cb_clear.c
> index a4799e3..438d8f7 100644
> --- a/src/mesa/state_tracker/st_cb_clear.c
> +++ b/src/mesa/state_tracker/st_cb_clear.c
> @@ -136,7 +136,7 @@ set_vertex_shader(struct st_context *st)
> static void
> draw_quad(struct st_context *st,
> float x0, float y0, float x1, float y1, GLfloat z,
> - const GLfloat color[4])
> + const union pipe_color_union *color)
> {
> struct pipe_context *pipe = st->pipe;
>
> @@ -182,10 +182,10 @@ draw_quad(struct st_context *st,
> for (i = 0; i < 4; i++) {
> st->clear.vertices[i][0][2] = z;
> st->clear.vertices[i][0][3] = 1.0;
> - st->clear.vertices[i][1][0] = color[0];
> - st->clear.vertices[i][1][1] = color[1];
> - st->clear.vertices[i][1][2] = color[2];
> - st->clear.vertices[i][1][3] = color[3];
> + st->clear.vertices[i][1][0] = color->f[0];
> + st->clear.vertices[i][1][1] = color->f[1];
> + st->clear.vertices[i][1][2] = color->f[2];
> + st->clear.vertices[i][1][3] = color->f[3];
> }
>
> /* put vertex data into vbuf */
> @@ -227,7 +227,7 @@ clear_with_quad(struct gl_context *ctx,
> const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax / fb_width *
> 2.0f - 1.0f;
> const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin / fb_height *
> 2.0f - 1.0f;
> const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax / fb_height *
> 2.0f - 1.0f;
> - float clearColor[4];
> + union pipe_color_union clearColor;
>
> /*
> printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__,
> @@ -325,11 +325,11 @@ clear_with_quad(struct gl_context *ctx,
> if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
> st_translate_color(ctx->Color.ClearColor.f,
> ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
> - clearColor);
> + clearColor.f);
> }
>
> /* draw quad matching scissor rect */
> - draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear,
> clearColor);
> + draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear,
> &clearColor);
>
> /* Restore pipe state */
> cso_restore_blend(st->cso_context);
> @@ -572,7 +572,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
> * required from the visual. Hence fix this up to avoid
> potential
> * read-modify-write in the driver.
> */
> - float clearColor[4];
> + union pipe_color_union clearColor;
>
> if ((clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) &&
> ((clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) !=
> PIPE_CLEAR_DEPTHSTENCIL) &&
> @@ -584,10 +584,10 @@ st_Clear(struct gl_context *ctx, GLbitfield
> mask)
> if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
> st_translate_color(ctx->Color.ClearColor.f,
> ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
> - clearColor);
> + clearColor.f);
> }
>
> - st->pipe->clear(st->pipe, clear_buffers, clearColor,
> + st->pipe->clear(st->pipe, clear_buffers, &clearColor,
> ctx->Depth.Clear, ctx->Stencil.Clear);
> }
> if (mask & BUFFER_BIT_ACCUM)
> diff --git a/src/mesa/state_tracker/st_extensions.c
> b/src/mesa/state_tracker/st_extensions.c
> index 722db8d..f36994a 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -215,7 +215,7 @@ void st_init_limits(struct st_context *st)
> c->MinProgramTexelOffset = screen->get_param(screen,
> PIPE_CAP_MIN_TEXEL_OFFSET);
> c->MaxProgramTexelOffset = screen->get_param(screen,
> PIPE_CAP_MAX_TEXEL_OFFSET);
>
> - c->GLSLVersion = 120;
> + c->GLSLVersion = 130;
> c->UniformBooleanTrue = ~0;
> }
> }
> @@ -678,4 +678,6 @@ void st_init_extensions(struct st_context *st)
> PIPE_BIND_SAMPLER_VIEW)) {
> ctx->Extensions.ARB_depth_buffer_float = GL_TRUE;
> }
> + ctx->Extensions.EXT_texture_integer = GL_TRUE;
> + ctx->Extensions.EXT_gpu_shader4 = GL_TRUE;
> }
> --
> 1.7.6
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list