gallium: move clear paths from rgba to a pointer to a color union (v2)
authorDave Airlie <airlied@redhat.com>
Fri, 16 Sep 2011 08:39:34 +0000 (09:39 +0100)
committerDave Airlie <airlied@redhat.com>
Sun, 18 Sep 2011 14:12:47 +0000 (15:12 +0100)
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.

Notes:
1. the value is opaque.
2. only when the value is used should it be interpretered according to
the surface format it is going to be used with.
3. float clears on integer buffers and vice-versa are undefined.

v2: fixed up vega and graw, dropped hunks that shouldn't have been in
patch.

Signed-off-by: Dave Airlie <airlied@redhat.com>
57 files changed:
src/gallium/auxiliary/postprocess/pp_mlaa.c
src/gallium/auxiliary/postprocess/pp_program.h
src/gallium/auxiliary/postprocess/pp_run.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_blitter.h
src/gallium/auxiliary/util/u_clear.h
src/gallium/auxiliary/util/u_surface.c
src/gallium/auxiliary/util/u_surface.h
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/drivers/cell/ppu/cell_clear.c
src/gallium/drivers/cell/ppu/cell_clear.h
src/gallium/drivers/galahad/glhd_context.c
src/gallium/drivers/i915/i915_clear.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_surface.c
src/gallium/drivers/i965/brw_pipe_clear.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/llvmpipe/lp_clear.c
src/gallium/drivers/llvmpipe/lp_clear.h
src/gallium/drivers/noop/noop_pipe.c
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_surface.c
src/gallium/drivers/nvc0/nvc0_context.h
src/gallium/drivers/nvc0/nvc0_surface.c
src/gallium/drivers/nvfx/nvfx_clear.c
src/gallium/drivers/nvfx/nvfx_context.h
src/gallium/drivers/nvfx/nvfx_surface.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/drivers/softpipe/sp_clear.c
src/gallium/drivers/softpipe/sp_clear.h
src/gallium/drivers/svga/svga_context.h
src/gallium/drivers/svga/svga_pipe_clear.c
src/gallium/drivers/trace/tr_context.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
src/gallium/state_trackers/vdpau/presentation.c
src/gallium/state_trackers/vega/api_masks.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/tests/graw/clear.c
src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/gs-test.c
src/gallium/tests/graw/quad-sample.c
src/gallium/tests/graw/quad-tex.c
src/gallium/tests/graw/shader-leak.c
src/gallium/tests/graw/tri-gs.c
src/gallium/tests/graw/tri-instanced.c
src/gallium/tests/graw/tri.c
src/gallium/tests/graw/vs-test.c
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c
src/mesa/state_tracker/st_cb_clear.c

index 476502fca9322a7a3ec34d19abaf5fa2b0c95bfa..5708687a1c2d44313e06fe300af4427e92adf8b9 100644 (file)
@@ -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);
index 2749b35b37292da869100c57234d98a90a2fde25..a85ba6ea79737d8aeaadc147deef3c08cc5fbd5d 100644 (file)
@@ -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;
 
index ce671aea3604a88aa927be005ec416096be0a011..de1fe559e49c02cd12ef9eb96fe6e0948f128d73 100644 (file)
@@ -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);
 }
index d69fb1a11abf43c7a3c99ffab6b61721a546362d..58a52b3f2de2cbf5a96fa5011a3b3c7c4ce4b42a 100644 (file)
@@ -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);
 }
 
index df6f023a638bd05491a5c85deb4942b671671d77..a9ad023644cb5e5493a8ba6ba25604a0b9e82da3 100644 (file)
@@ -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);
 
index ad69df3f89889b8b28c619e13300551daeb3a74d..e9fd874b1fc892a60c8ef133d6673ad0a892023d 100644 (file)
 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);
       }
    }
 
index 8e123867da6ec2c3933793b429e35307aeb53ac9..308511b33c4ca5583015479f92ea126ae0460fa8 100644 (file)
@@ -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);
index 6a7cc82b0550710fc1dede3b7c686587b9d7b202..1117b78da7ad45ecf423a1963c64ad2df9b2928c 100644 (file)
@@ -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);
 
index ebe6d7ae45c0a512fa45b8b69693391e10687636..322ef8e995429c98ed5450ddafa82fc1eda86f3b 100644 (file)
@@ -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;
index 0b9b9939a8caff0cb45258f49bf3a93183248f4f..f60f7da3ec1394f8ef8a61130feaf9ae1618df2f 100644 (file)
@@ -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
index 246fe210542c53b2aa536b094a298dc50140de97..6a525ef4e41d5a157b018c4f1b33d178914eb03f 100644 (file)
@@ -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);
index 08e091adfdbee009e8cc94e54aa469fb1980bf94..a365feb0f00615f32090f2ac8f098dbc15dc28c6 100644 (file)
@@ -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);
 
 
index f73d8a5d32e6d8fc61fba8194aca0fa6e226f9be..a4afa813f898dd25820b1962ae53835d8fcb58ad 100644 (file)
@@ -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,
index 4f9aa2c312036053abb2c3e9740fdd6aecabce3b..c682c06cb58fb92b1eb09f336368c8797de671dd 100644 (file)
@@ -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);
 }
index fca8688a52607a3da4a9a8cd87de589ff34192aa..f16bb725a4bc0d0050db68aaf6594e1d67f2e1bd 100644 (file)
@@ -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);
 
index 41146be9311f807ce86b626b54db8843b0527b26..4ba99a33d70404fca7e74ff93ab92e4e45feb8b0 100644 (file)
@@ -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,
index 7bf3ea6994a8d694e7a96a592147e98ccb29c631..847b11565d4280718e754ab632964b56bf9b7874 100644 (file)
@@ -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 */
index 2a9d73601555f1520615aa4cb6956bad4921e71c..a9043c1590b008aba4b58a4fbe609c17ee2957ba 100644 (file)
@@ -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,
index b486b243eb5e0ba19c47e426ede5617d65177c29..be2fce1307ccaa159a169263228cbc5bcde545a8 100644 (file)
@@ -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 );
 }
index 6d4ffccdf452486c08eac9dc1544bb742fcac105..29ca0b796c37ec5a80f23be077df9b5348677c2d 100644 (file)
@@ -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);
 
 
index 7c133c5f15951a9eb406f7397a84148ff359da22..ead97df494cce60b652f4c2d58625afb088bc95a 100644 (file)
@@ -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)
 {
index ecffbbf86e608caa58d4c986d9837e12a17a43cf..edd79159e725b94b704115e91b8ef96ef00a75d0 100644 (file)
@@ -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 */
index b0a8497c1e74d3e803413e4312c0ebbe419a414d..83bb9434afa3e0c0864da9bf72d706b91803f7e0 100644 (file)
@@ -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;
index c11d1c32efe7bcd104e67da8a76e6bd9715a2070..c4e481c28cb157c91377c70189881537f101295a 100644 (file)
@@ -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 */
index 61aa1a17f1d89f2d99a820486027d5eabfc3dd4a..ff07aad00d00ffc5430acfc4e2d2b9463b046824 100644 (file)
@@ -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;
index 2be70fcee40a4cc6fb64bf43c65d564e67aa914a..46f23e382602f2a1b2e4f0acb5d86daed3c03eb9 100644 (file)
@@ -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);
 }
index cb40a521d1b8de999abe81bdf8f3926a3a2c08ec..3d05ecc78075fa701be9e62b4191baf5faa15c5b 100644 (file)
@@ -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);
index 91ca1c3750ec0c29890d1e1f3fdfb6867e74b21b..d489bbf9473360f9514fa248ef677a064ae3f58b 100644 (file)
@@ -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);
        }
 }
index ddf5448a34b482940dd13124d8a8014659f9e9df..3c1b3648a24e91ea5d190ded3c7c568a1baa4ec6 100644 (file)
@@ -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);
 }
index d69b4cf42754bee6ed792ffe3f6cf9abaeb69724..fc3ba33588676b736f99d5f61774b512c790660b 100644 (file)
@@ -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);
 
index 9a71c8447c6ca2ba3c7cd6eb9562a202a0225510..dfc43feb5d9e7a0021b873e36979f5e96521008b 100644 (file)
@@ -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);
 }
index 6e2d6ba1efaafc078a649ba58ea2932d70dc263a..6690c0208bd4cdb4cf078beec3db881e83595280 100644 (file)
@@ -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,
index 22e8a2e58170dbc641158ca62c652606d93fb7b2..bfb16be82ac1cee677f62753598a67aebc62876e 100644 (file)
@@ -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);
       }
    }
 
index 9be3b86fe9f5c9f98a0d40dea1fdc8e46d26acdf..6dd7d132fe88ea7f949aa6832e97a7ec186503c8 100644 (file)
@@ -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);
 
 
index 34b9e85c1a3d51b57164e2be921b7c427b489f6e..f8c1ab403459ec0a3b80c9ab1ac4d4662782c15d 100644 (file)
@@ -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);
 
index 2bba77769ad7603bcc3b2195487aa6f8b2a37fa7..d9ff79cc5ee7d2c70f702c076b960449ed318386 100644 (file)
@@ -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 );
    }
 
    /*
index 254976e099c9235e8eb0218db4e274209f56f5f6..6021bb92ab61201a1f5ea570947a3c23c411148f 100644 (file)
@@ -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();
 }
index 49c12ec64fb0656a6ea5d5f45bec4d44f8f45f43..b2d5f9543e6ea750e688b1e194a1676aeb124461 100644 (file)
@@ -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);
 
index 777a177a90fd216ed0d1928048d8083c84c14b7e..1773d9d3175bc23de39ddaebbfa9297190481461 100644 (file)
@@ -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
 }
index 2bf001261eb80e0e90d7eea1a0cacbac60aca984..e3329e4d5d3236ee0ec3f151b0c0d2830eeb05dc 100644 (file)
@@ -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)
index d43fdeab96320c65471926202dc899b550350a1e..fcb82a19624bc9db0cfed8c37175d1192388f407 100644 (file)
@@ -1594,7 +1594,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(
index b30b778aa1994508b219c23e1ab46bec9fb3a60f..888cf31d5afc744d0622b5481e52307cc64c59d8 100644 (file)
@@ -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;
 }
index cdbf0026e8977b0569de298da886f2dabeb3df18..0ddcdfb75c13c83167fba85b5ad258b8fcd1eb0b 100644 (file)
@@ -92,8 +92,13 @@ void vegaClear(VGint x, VGint y,
    /* check for a whole surface clear */
    if (!ctx->state.vg.scissoring &&
        (x == 0 && y == 0 && width == stfb->width && height == stfb->height)) {
+      union pipe_color_union clear_color;
+      clear_color.f[0] = ctx->state.vg.clear_color[0];
+      clear_color.f[1] = ctx->state.vg.clear_color[1];
+      clear_color.f[2] = ctx->state.vg.clear_color[2];
+      clear_color.f[3] = ctx->state.vg.clear_color[3];
       ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
-                       ctx->state.vg.clear_color, 1., 0);
+                       &clear_color, 1., 0);
    } else if (renderer_clear_begin(ctx->renderer)) {
       /* XXX verify coord round-off */
       renderer_clear(ctx->renderer, x, y, width, height, ctx->state.vg.clear_color);
index b072f53aa91ff0b9361c45142f35dcab36dda2ee..db0167ba4c45efca94d0068862640b1f42c4ec47 100644 (file)
@@ -386,7 +386,12 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1)
 
     if (x0 == 0 && y0 == 0 &&
         x1 == pPixmap->drawable.width && y1 == pPixmap->drawable.height) {
-       exa->pipe->clear(exa->pipe, PIPE_CLEAR_COLOR, exa->solid_color, 0.0, 0);
+       union pipe_color_union solid_color;
+       solid_color.f[0] = exa->solid_color[0];
+       solid_color.f[1] = exa->solid_color[1];
+       solid_color.f[2] = exa->solid_color[2];
+       solid_color.f[3] = exa->solid_color[3];
+       exa->pipe->clear(exa->pipe, PIPE_CLEAR_COLOR, &solid_color, 0.0, 0);
        return;
     }
 
index 392d1503f19b20047e076a556094c95c243be544..9c9eeebe0af3956e0239fb5ca3c749df1a0804ef 100644 (file)
@@ -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);
index fda23bd7c9ffc622bd3aa37250237ae5b15c3872..47bc101846fa62dbb15f7072da332aebeaa7335c 100644 (file)
@@ -272,9 +272,9 @@ static void set_fragment_shader( const char *filename )
 
 static void draw( void )
 {
-   float clear_color[4] = {.1,.3,.5,0};
+   union pipe_color_union clear_color = { .f = {.1,.3,.5,0} };
 
-   ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+   ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
    util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
    ctx->flush(ctx, NULL);
 
index ebb26d2f3f4a767266784988753c7a6472b08ba3..511f5d53438f7a1d321933690a40ff2e200756ab 100644 (file)
@@ -331,9 +331,9 @@ static void set_geometry_shader( void )
 
 static void draw( void )
 {
-   float clear_color[4] = {.1,.3,.5,0};
+   union pipe_color_union clear_color = { .f = {.1,.3,.5,0} };
 
-   ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+   ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
    if (draw_strip)
       util_draw_arrays(ctx, PIPE_PRIM_TRIANGLE_STRIP, 0, 4);
    else
index 6903046cf0e774514215540523db9e0c73ef461a..152e1edb3fd11afcd3b0d12ce26c082f1152f3eb 100644 (file)
@@ -146,9 +146,9 @@ static void set_fragment_shader( void )
 
 static void draw( void )
 {
-   float clear_color[4] = {.5,.5,.5,1};
+   union pipe_color_union clear_color = { .f = {.5,.5,.5,1} };
 
-   ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+   ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
    util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
    ctx->flush(ctx, NULL);
 
index fd01cb3f84fc387f2e2b18d5a6d9dd9084076033..ca742a699d4625ca665d33252181f82b2971b252 100644 (file)
@@ -143,9 +143,9 @@ static void set_fragment_shader( void )
 
 static void draw( void )
 {
-   float clear_color[4] = {.5,.5,.5,1};
+   union pipe_color_union clear_color = { .f = {.5,.5,.5,1} };
 
-   ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+   ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
    util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
    ctx->flush(ctx, NULL);
 
index 004b1691b6bb8aabf05d3c66664627555f6cb2f9..098faec5896cac17bba11d971f0cd712fbe8b495 100644 (file)
@@ -137,7 +137,7 @@ set_fragment_shader( void )
 
 static void draw( void )
 {
-   float clear_color[4] = {0, 0, 0, 1};
+   union pipe_color_union clear_color = { .f = {0,0,0,1} };
    int i;
 
    printf("Creating %d shaders\n", num_iters);
@@ -147,7 +147,7 @@ static void draw( void )
 
       ctx->bind_fs_state(ctx, fs);
 
-      ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+      ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
       util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, 1);
       ctx->flush(ctx, NULL);
 
index ab0116bed731a8794ca4b4e56f9c19177cb72d68..3c9e56882e5bc1d2be969aa2263344710430ea30 100644 (file)
@@ -159,9 +159,9 @@ static void set_geometry_shader( void )
 
 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);
    util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
    ctx->flush(ctx, NULL);
 
index bed3437466644bb8030c3b8f9600d4080a998c29..50389e087258c21f467ce51e3b4af1c11c1e775f 100644 (file)
@@ -196,10 +196,10 @@ static void set_fragment_shader( void )
 
 static void draw( void )
 {
-   float clear_color[4] = {1,0,1,1};
+   union pipe_color_union clear_color = { .f = {1,0,1,1} };
    struct pipe_draw_info info;
 
-   ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+   ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
 
    util_draw_init_info(&info);
    info.indexed = (draw_elements != 0);
index 30ead999a479f42a10c67ef396b30e76adc28185..2b779ff87048493797ca5bce9244a3606c0afa51 100644 (file)
@@ -136,9 +136,9 @@ static void set_fragment_shader( void )
 
 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);
    util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
    ctx->flush(ctx, NULL);
 
index 18e056dcb358b8641591b2c537150d4e6e1029bf..b98c8f5356287352e28f960a2252105bee4ff614 100644 (file)
@@ -223,9 +223,9 @@ static void set_fragment_shader( void )
 
 static void draw( void )
 {
-   float clear_color[4] = {.1,.3,.5,0};
+   union pipe_color_union clear_color = { .f = {.1,.3,.5,0} };
 
-   ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+   ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
    util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, Elements(vertices));
    ctx->flush(ctx, NULL);
 
index 6c38b1096c189ec0e6650092df97c77a1dba4a7d..79c66e0e67e4c0246312bc4295963aa082274f21 100644 (file)
@@ -82,7 +82,7 @@ struct program
        void *vs;
        void *fs;
 
-       float clear_color[4];
+       union pipe_color_union clear_color;
 
        struct pipe_resource *vbuf;
        struct pipe_resource *target;
@@ -103,10 +103,10 @@ static void init_prog(struct program *p)
        p->cso = cso_create_context(p->pipe);
 
        /* set clear color */
-       p->clear_color[0] = 0.3;
-       p->clear_color[1] = 0.1;
-       p->clear_color[2] = 0.3;
-       p->clear_color[3] = 1.0;
+       p->clear_color.f[0] = 0.3;
+       p->clear_color.f[1] = 0.1;
+       p->clear_color.f[2] = 0.3;
+       p->clear_color.f[3] = 1.0;
 
        /* vertex buffer */
        {
@@ -307,7 +307,7 @@ static void draw(struct program *p)
        cso_set_framebuffer(p->cso, &p->framebuffer);
 
        /* clear the render target */
-       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);
 
        /* set misc state we care about */
        cso_set_blend(p->cso, &p->blend);
index 656e92ee8861abaa7fe150938777d83e22dcbd66..d036db8003909cb89f5d4eee9c5b83cd273a4462 100644 (file)
@@ -79,7 +79,7 @@ struct program
        void *vs;
        void *fs;
 
-       float clear_color[4];
+       union pipe_color_union clear_color;
 
        struct pipe_resource *vbuf;
        struct pipe_resource *target;
@@ -98,10 +98,10 @@ static void init_prog(struct program *p)
        p->cso = cso_create_context(p->pipe);
 
        /* set clear color */
-       p->clear_color[0] = 0.3;
-       p->clear_color[1] = 0.1;
-       p->clear_color[2] = 0.3;
-       p->clear_color[3] = 1.0;
+       p->clear_color.f[0] = 0.3;
+       p->clear_color.f[1] = 0.1;
+       p->clear_color.f[2] = 0.3;
+       p->clear_color.f[3] = 1.0;
 
        /* vertex buffer */
        {
@@ -243,7 +243,7 @@ static void draw(struct program *p)
        cso_set_framebuffer(p->cso, &p->framebuffer);
 
        /* clear the render target */
-       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);
 
        /* set misc state we care about */
        cso_set_blend(p->cso, &p->blend);
index a4799e3cc927119fe07b4f8914f4ce5126513b5d..83802a5ea6773bb85ac558f23766b936a896a7b1 100644 (file)
@@ -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)