summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/common/meta.c10
-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
-rw-r--r--src/mesa/drivers/windows/gdi/wmesa.c9
-rw-r--r--src/mesa/drivers/x11/xm_dd.c37
9 files changed, 59 insertions, 43 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 2ebcd35bd11..482bd98a254 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1569,10 +1569,10 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
/* vertex colors */
for (i = 0; i < 4; i++) {
- verts[i].r = ctx->Color.ClearColorUnclamped[0];
- verts[i].g = ctx->Color.ClearColorUnclamped[1];
- verts[i].b = ctx->Color.ClearColorUnclamped[2];
- verts[i].a = ctx->Color.ClearColorUnclamped[3];
+ verts[i].r = ctx->Color.ClearColor.f[0];
+ verts[i].g = ctx->Color.ClearColor.f[1];
+ verts[i].b = ctx->Color.ClearColor.f[2];
+ verts[i].a = ctx->Color.ClearColor.f[3];
}
/* upload new vertex data */
@@ -1679,7 +1679,7 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
_mesa_UseProgramObjectARB(clear->ShaderProg);
_mesa_Uniform4fvARB(clear->ColorLocation, 1,
- ctx->Color.ClearColorUnclamped);
+ ctx->Color.ClearColor.f);
_mesa_BindVertexArray(clear->ArrayObj);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO);
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] );
}
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 35a150d0687..14d15ed6c02 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -249,14 +249,15 @@ static void wmesa_flush(struct gl_context *ctx)
/*
* Set the color used to clear the color buffer.
*/
-static void clear_color(struct gl_context *ctx, const GLfloat color[4])
+static void clear_color(struct gl_context *ctx,
+ const union gl_color_union color)
{
WMesaContext pwc = wmesa_context(ctx);
GLubyte col[3];
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(col[0], color.f[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(col[1], color.f[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(col[2], color.f[2]);
pwc->clearColorRef = RGB(col[0], col[1], col[2]);
DeleteObject(pwc->clearPen);
DeleteObject(pwc->clearBrush);
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 81d000b3952..52964ddd047 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -104,16 +104,17 @@ finish_or_flush( struct gl_context *ctx )
static void
-clear_color( struct gl_context *ctx, const GLfloat color[4] )
+clear_color( struct gl_context *ctx,
+ const union gl_color_union color )
{
if (ctx->DrawBuffer->Name == 0) {
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color.f[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color.f[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color.f[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color.f[3]);
xmesa->clearpixel = xmesa_color_to_pixel( ctx,
xmesa->clearcolor[0],
xmesa->clearcolor[1],
@@ -770,17 +771,18 @@ enable( struct gl_context *ctx, GLenum pname, GLboolean state )
static void
-clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] )
+clear_color_HPCR_ximage( struct gl_context *ctx,
+ const union gl_color_union color )
{
int i;
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color.f[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color.f[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color.f[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color.f[3]);
- if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) {
+ if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) {
/* black is black */
memset( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 ,
sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern));
@@ -804,17 +806,18 @@ clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] )
static void
-clear_color_HPCR_pixmap( struct gl_context *ctx, const GLfloat color[4] )
+clear_color_HPCR_pixmap( struct gl_context *ctx,
+ const union gl_color_union color )
{
int i;
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color.f[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color.f[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color.f[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color.f[3]);
- if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) {
+ if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) {
/* black is black */
for (i=0; i<16; i++) {
XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, 0);