summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/nouveau
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-09-12 10:57:40 +0100
committerDave Airlie <[email protected]>2011-09-14 11:18:07 +0100
commit093dc9e548537e6c77e33064a584f849ad90dfa5 (patch)
tree4a3ecd84f123cd89a29fea6700603a5da53d62cb /src/mesa/drivers/dri/nouveau
parentb06613c6cc029c3ff200430b0706b5229c4508bd (diff)
mesa: introduce a clear color union to be used for int/unsigned buffers
This introduces a new gl_color_union union and moves the current ClearColorUnclamped to use it, it removes current ClearColor completely and renames CCU to CC, then all drivers are modified to expected unclamped floats instead. also fixes st to use translated color in one place it wasn't. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/nouveau')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_driver.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_util.h10
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_context.c2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index 8b6aa820434..d1e269af240 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -100,7 +100,7 @@ nouveau_clear(struct gl_context *ctx, GLbitfield buffers)
if (buf & BUFFER_BITS_COLOR) {
mask = pack_rgba_i(s->format, ctx->Color.ColorMask[0]);
- value = pack_rgba_f(s->format, ctx->Color.ClearColor);
+ value = pack_rgba_clamp_f(s->format, ctx->Color.ClearColor.f);
if (mask)
context_drv(ctx)->surface_fill(
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index 6d01934dade..8cfe26dfb44 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -79,6 +79,16 @@ pack_rgba_f(gl_format f, float c[])
}
static inline unsigned
+pack_rgba_clamp_f(gl_format f, float c[])
+{
+ return pack_rgba_i(f, (uint8_t []) {
+ UNCLAMPED_FLOAT_TO_UBYTE(c[RCOMP]),
+ UNCLAMPED_FLOAT_TO_UBYTE(c[GCOMP]),
+ UNCLAMPED_FLOAT_TO_UBYTE(c[BCOMP]),
+ UNCLAMPED_FLOAT_TO_UBYTE(c[ACOMP]) });
+}
+
+static inline unsigned
pack_zs_f(gl_format f, float z, uint8_t s)
{
return pack_zs_i(f, FLOAT_TO_UINT(z), s);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 27668516e6c..87a6db11967 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -59,7 +59,7 @@ nv20_clear(struct gl_context *ctx, GLbitfield buffers)
clear |= NV20_3D_CLEAR_BUFFERS_COLOR_A;
BEGIN_RING(chan, kelvin, NV20_3D_CLEAR_VALUE, 1);
- OUT_RING(chan, pack_rgba_f(s->format, ctx->Color.ClearColor));
+ OUT_RING(chan, pack_rgba_clamp_f(s->format, ctx->Color.ClearColor.f));
buffers &= ~BUFFER_BITS_COLOR;
}