summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50
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/nv50
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/nv50')
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h3
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c21
2 files changed, 13 insertions, 11 deletions
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index ecffbbf86e6..edd79159e72 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -178,7 +178,8 @@ extern boolean nv50_state_validate(struct nv50_context *, uint32_t state_mask,
/* nv50_surface.c */
extern void nv50_clear(struct pipe_context *, unsigned buffers,
- const float *rgba, double depth, unsigned stencil);
+ const union pipe_color_union *color,
+ double depth, unsigned stencil);
extern void nv50_init_surface_functions(struct nv50_context *);
/* nv50_tex.c */
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index b0a8497c1e7..83bb9434afa 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -261,7 +261,7 @@ nv50_resource_copy_region(struct pipe_context *pipe,
static void
nv50_clear_render_target(struct pipe_context *pipe,
struct pipe_surface *dst,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
@@ -273,10 +273,10 @@ nv50_clear_render_target(struct pipe_context *pipe,
struct nouveau_bo *bo = mt->base.bo;
BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4);
- OUT_RINGf (chan, rgba[0]);
- OUT_RINGf (chan, rgba[1]);
- OUT_RINGf (chan, rgba[2]);
- OUT_RINGf (chan, rgba[3]);
+ OUT_RINGf (chan, color->f[0]);
+ OUT_RINGf (chan, color->f[1]);
+ OUT_RINGf (chan, color->f[2]);
+ OUT_RINGf (chan, color->f[3]);
if (MARK_RING(chan, 18, 2))
return;
@@ -374,7 +374,8 @@ nv50_clear_depth_stencil(struct pipe_context *pipe,
void
nv50_clear(struct pipe_context *pipe, unsigned buffers,
- const float *rgba, double depth, unsigned stencil)
+ const union pipe_color_union *color,
+ double depth, unsigned stencil)
{
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_channel *chan = nv50->screen->base.channel;
@@ -388,10 +389,10 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4);
- OUT_RINGf (chan, rgba[0]);
- OUT_RINGf (chan, rgba[1]);
- OUT_RINGf (chan, rgba[2]);
- OUT_RINGf (chan, rgba[3]);
+ OUT_RINGf (chan, color->f[0]);
+ OUT_RINGf (chan, color->f[1]);
+ OUT_RINGf (chan, color->f[2]);
+ OUT_RINGf (chan, color->f[3]);
mode =
NV50_3D_CLEAR_BUFFERS_R | NV50_3D_CLEAR_BUFFERS_G |
NV50_3D_CLEAR_BUFFERS_B | NV50_3D_CLEAR_BUFFERS_A;