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>
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);
struct pipe_framebuffer_state framebuffer;
struct pipe_vertex_element velem[2];
- float clear_color[4];
+ union pipe_color_union clear_color;
void *passvs;
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);
}
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)
}
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++) {
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;
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:;
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)
{
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);
}
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);
}
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
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;
/* 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)
{
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);
}
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;
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,
*/
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);
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);
}
}
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)
{
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);
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);
}
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
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;
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;
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;
* 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
* 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);
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);
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);
static void
galahad_clear(struct pipe_context *_pipe,
unsigned buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth,
unsigned stencil)
{
pipe->clear(pipe,
buffers,
- rgba,
+ color,
depth,
stencil);
}
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)
{
pipe->clear_render_target(pipe,
dst,
- rgba,
+ color,
dstx,
dsty,
width,
#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)
{
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;
* 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);
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);
}
/***********************************************************************
* 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);
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)
{
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);
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)
{
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,
*/
static void brw_clear(struct pipe_context *pipe,
unsigned buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth,
unsigned stencil)
{
for (i = 0; i < brw->curr.fb.nr_cbufs; i++) {
color_clear( brw,
brw_surface(brw->curr.fb.cbufs[i]),
- rgba );
+ color->f );
}
}
/* 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)
{
color_clear( brw,
brw_surface(dst),
- rgba );
+ color->f );
}
/* XXX should respect region */
static void
identity_clear(struct pipe_context *_pipe,
unsigned buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth,
unsigned stencil)
{
pipe->clear(pipe,
buffers,
- rgba,
+ color,
depth,
stencil);
}
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)
{
pipe->clear_render_target(pipe,
dst,
- rgba,
+ color,
dstx,
dsty,
width,
void
llvmpipe_clear(struct pipe_context *pipe,
unsigned buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth,
unsigned stencil)
{
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 );
}
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);
* 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)
{
/* 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 */
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)
{
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;
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;
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;
/* 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 */
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)
{
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;
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;
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;
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);
}
/* 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);
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);
}
}
/* 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)
{
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;
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
/* 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);
}
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;
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)
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. */
if (vertex_size == 8) {
if (!attrib)
- attrib = zeros;
- OUT_CS_TABLE(attrib, 4);
+ attrib = &zeros;
+ OUT_CS_TABLE(attrib->f, 4);
}
END_CS;
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;
/* 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);
}
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);
}
static void
rbug_clear(struct pipe_context *_pipe,
unsigned buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth,
unsigned stencil)
{
pipe_mutex_lock(rb_pipe->call_mutex);
pipe->clear(pipe,
buffers,
- rgba,
+ color,
depth,
stencil);
pipe_mutex_unlock(rb_pipe->call_mutex);
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)
{
pipe_mutex_lock(rb_pipe->call_mutex);
pipe->clear_render_target(pipe,
dst,
- rgba,
+ color,
dstx,
dsty,
width,
* 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);
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);
}
}
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);
*/
void svga_clear(struct pipe_context *pipe,
unsigned buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth,
unsigned stencil);
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)
{
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;
* 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 );
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 );
}
/*
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)
{
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();
}
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)
{
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();
}
struct pipe_video_buffer;
struct pipe_video_decoder;
struct pipe_viewport_state;
-
+union pipe_color_union;
/**
* Gallium rendering context. Basically:
* 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);
boolean disjoint;
};
+union pipe_color_union
+{
+ float f[4];
+ int i[4];
+ unsigned int ui[4];
+};
#ifdef __cplusplus
}
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;
}
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)
{
}
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)
{
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(
VdpColor *const background_color)
{
vlVdpPresentationQueue *pq;
+ union pipe_color_union color;
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Setting background color\n");
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;
}
VdpColor *const background_color)
{
vlVdpPresentationQueue *pq;
+ union pipe_color_union color;
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Getting background color\n");
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;
}
/* 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);
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;
}
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);
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);
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
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);
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);
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);
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);
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);
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);
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);
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);
void *vs;
void *fs;
- float clear_color[4];
+ union pipe_color_union clear_color;
struct pipe_resource *vbuf;
struct pipe_resource *target;
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 */
{
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);
void *vs;
void *fs;
- float clear_color[4];
+ union pipe_color_union clear_color;
struct pipe_resource *vbuf;
struct pipe_resource *target;
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 */
{
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);
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;
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 */
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__,
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);
* 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) &&
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)