summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-09-16 09:39:34 +0100
committerDave Airlie <[email protected]>2011-09-18 15:12:47 +0100
commit6dd284f7c8fac22f64c13fdf9909094f5ec59086 (patch)
tree8fe6c89638f05d1638b3a5d0395e011d68eda336 /src/gallium/drivers/r300
parent78026b8acef9d6eea4f37d9c5435447944d1befd (diff)
gallium: move clear paths from rgba to a pointer to a color union (v2)
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/r300_blit.c10
-rw-r--r--src/gallium/drivers/r300/r300_render.c20
2 files changed, 15 insertions, 15 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index ddf5448a34b..3c1b3648a24 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -174,7 +174,7 @@ static uint32_t r300_hiz_clear_value(double depth)
/* Clear currently bound buffers. */
static void r300_clear(struct pipe_context* pipe,
unsigned buffers,
- const float* rgba,
+ const union pipe_color_union *color,
double depth,
unsigned stencil)
{
@@ -281,7 +281,7 @@ static void r300_clear(struct pipe_context* pipe,
struct r300_surface *surf = r300_surface(fb->cbufs[0]);
hyperz->zb_depthclearvalue =
- r300_depth_clear_cb_value(surf->base.format, rgba);
+ r300_depth_clear_cb_value(surf->base.format, color->f);
width = surf->cbzb_width;
height = surf->cbzb_height;
@@ -298,7 +298,7 @@ static void r300_clear(struct pipe_context* pipe,
width,
height,
fb->nr_cbufs,
- buffers, rgba, depth, stencil);
+ buffers, color, depth, stencil);
r300_blitter_end(r300);
} else if (r300->zmask_clear.dirty || r300->hiz_clear.dirty) {
/* Just clear zmask and hiz now, this does not use the standard draw
@@ -348,14 +348,14 @@ static void r300_clear(struct pipe_context* pipe,
/* Clear a region of a color surface to a constant value. */
static void r300_clear_render_target(struct pipe_context *pipe,
struct pipe_surface *dst,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
struct r300_context *r300 = r300_context(pipe);
r300_blitter_begin(r300, R300_CLEAR_SURFACE);
- util_blitter_clear_render_target(r300->blitter, dst, rgba,
+ util_blitter_clear_render_target(r300->blitter, dst, color,
dstx, dsty, width, height);
r300_blitter_end(r300);
}
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index d69b4cf4275..fc3ba335886 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1186,7 +1186,7 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
- const float attrib[4])
+ const union pipe_color_union *attrib)
{
struct r300_context *r300 = r300_context(util_blitter_get_pipe(blitter));
unsigned last_sprite_coord_enable = r300->sprite_coord_enable;
@@ -1196,7 +1196,7 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
type == UTIL_BLITTER_ATTRIB_COLOR || !r300->draw ? 8 : 4;
unsigned dwords = 13 + vertex_size +
(type == UTIL_BLITTER_ATTRIB_TEXCOORD ? 7 : 0);
- const float zeros[4] = {0, 0, 0, 0};
+ static const union pipe_color_union zeros;
CS_LOCALS(r300);
if (r300->skip_rendering)
@@ -1227,10 +1227,10 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
(R300_GB_TEX_STR << R300_GB_TEX0_SOURCE_SHIFT));
OUT_CS_REG_SEQ(R300_GA_POINT_S0, 4);
- OUT_CS_32F(attrib[0]);
- OUT_CS_32F(attrib[3]);
- OUT_CS_32F(attrib[2]);
- OUT_CS_32F(attrib[1]);
+ OUT_CS_32F(attrib->f[0]);
+ OUT_CS_32F(attrib->f[3]);
+ OUT_CS_32F(attrib->f[2]);
+ OUT_CS_32F(attrib->f[1]);
}
/* Set up VAP controls. */
@@ -1253,8 +1253,8 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
if (vertex_size == 8) {
if (!attrib)
- attrib = zeros;
- OUT_CS_TABLE(attrib, 4);
+ attrib = &zeros;
+ OUT_CS_TABLE(attrib->f, 4);
}
END_CS;
@@ -1273,7 +1273,7 @@ static void r300_resource_resolve(struct pipe_context *pipe,
struct r300_context *r300 = r300_context(pipe);
struct pipe_surface *srcsurf, *dstsurf, surf_tmpl;
struct r300_aa_state *aa = (struct r300_aa_state*)r300->aa_state.state;
- float color[] = {0, 0, 0, 0};
+ static const union pipe_color_union color;
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
surf_tmpl.format = info->src.res->format;
@@ -1301,7 +1301,7 @@ static void r300_resource_resolve(struct pipe_context *pipe,
/* Resolve the surface. */
/* XXX: y1 < 0 ==> Y flip */
r300->context.clear_render_target(pipe,
- srcsurf, color, 0, 0,
+ srcsurf, &color, 0, 0,
info->dst.x1 - info->dst.x0,
info->dst.y1 - info->dst.y0);