aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c10
-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
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c11
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c11
6 files changed, 29 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index b18dd2922d9..a45b6e40ecc 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -320,12 +320,12 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
clear_val = clear_depth_value;
} else {
uint8_t clear[4];
- GLclampf *color = ctx->Color.ClearColor;
+ GLfloat *color = ctx->Color.ClearColor.f;
- CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
+ UNCLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
switch (irb->Base.Format) {
case MESA_FORMAT_ARGB8888:
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;
}
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 0a1e0b47577..ee13179c2be 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1724,7 +1724,8 @@ void r200UpdateViewportOffset( struct gl_context *ctx )
* Miscellaneous
*/
-static void r200ClearColor( struct gl_context *ctx, const GLfloat c[4] )
+static void r200ClearColor( struct gl_context *ctx,
+ const union gl_color_union c )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLubyte color[4];
@@ -1733,10 +1734,10 @@ static void r200ClearColor( struct gl_context *ctx, const GLfloat c[4] )
rrb = radeon_get_colorbuffer(&rmesa->radeon);
if (!rrb)
return;
- CLAMPED_FLOAT_TO_UBYTE(color[0], c[0]);
- CLAMPED_FLOAT_TO_UBYTE(color[1], c[1]);
- CLAMPED_FLOAT_TO_UBYTE(color[2], c[2]);
- CLAMPED_FLOAT_TO_UBYTE(color[3], c[3]);
+ UNCLAMPED_FLOAT_TO_UBYTE(color[0], c.f[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(color[1], c.f[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(color[2], c.f[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(color[3], c.f[3]);
rmesa->radeon.state.color.clear = radeonPackColor( rrb->cpp,
color[0], color[1],
color[2], color[3] );
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index a93e61870a5..2e716c56221 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1508,7 +1508,8 @@ void radeonUpdateViewportOffset( struct gl_context *ctx )
* Miscellaneous
*/
-static void radeonClearColor( struct gl_context *ctx, const GLfloat color[4] )
+static void radeonClearColor( struct gl_context *ctx,
+ const union gl_color_union color )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLubyte c[4];
@@ -1518,10 +1519,10 @@ static void radeonClearColor( struct gl_context *ctx, const GLfloat color[4] )
if (!rrb)
return;
- CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+ UNCLAMPED_FLOAT_TO_UBYTE(c[0], color.f[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(c[1], color.f[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(c[2], color.f[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(c[3], color.f[3]);
rmesa->radeon.state.color.clear = radeonPackColor( rrb->cpp,
c[0], c[1], c[2], c[3] );
}