summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-01-24 00:04:58 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-01-24 00:04:58 +0000
commit74b493a5e61237de081a438e774e5d8139d4c6b7 (patch)
treea8bc94a65bacc67b9b1473f91a2bd84cd2b25937 /src/mesa/main
parent125fddc31dc9959901d9f1ece693b09f04426d48 (diff)
Lots of GLchan datatype changes.
Added GLvector4us datatype in math/m_vector.[ch] Added _math_trans_4us() in math/m_translate.[ch] Choose GLvector4ub, GLvector4us, GLvector4f at compile time based on CHAN_BITS. Made Driver.ClearColor() and Driver.ClearIndex() optional driver functions. Changed args to Driver.ClearColor(), updated drivers. Reordered files in Makefile.X11
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/Makefile.X1164
-rw-r--r--src/mesa/main/api_noop.c126
-rw-r--r--src/mesa/main/attrib.c8
-rw-r--r--src/mesa/main/buffers.c37
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/dd.h17
-rw-r--r--src/mesa/main/get.c34
-rw-r--r--src/mesa/main/macros.h3
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/texstate.c10
-rw-r--r--src/mesa/main/texutil.h4
11 files changed, 162 insertions, 149 deletions
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11
index fbf8d20999..afcffbb6cc 100644
--- a/src/mesa/main/Makefile.X11
+++ b/src/mesa/main/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.39 2001/01/08 21:55:59 keithw Exp $
+# $Id: Makefile.X11,v 1.40 2001/01/24 00:04:58 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.5
@@ -86,6 +86,35 @@ CORE_SOURCES = \
X86/common_x86.c \
X86/3dnow.c \
X86/katmai.c \
+ swrast/s_aaline.c \
+ swrast/s_aatriangle.c \
+ swrast/s_accum.c \
+ swrast/s_alpha.c \
+ swrast/s_alphabuf.c \
+ swrast/s_bitmap.c \
+ swrast/s_blend.c \
+ swrast/s_buffers.c \
+ swrast/s_copypix.c \
+ swrast/s_context.c \
+ swrast/s_depth.c \
+ swrast/s_drawpix.c \
+ swrast/s_feedback.c \
+ swrast/s_fog.c \
+ swrast/s_histogram.c \
+ swrast/s_lines.c \
+ swrast/s_logic.c \
+ swrast/s_masking.c \
+ swrast/s_pb.c \
+ swrast/s_pixeltex.c \
+ swrast/s_points.c \
+ swrast/s_quads.c \
+ swrast/s_readpix.c \
+ swrast/s_scissor.c \
+ swrast/s_span.c \
+ swrast/s_stencil.c \
+ swrast/s_texture.c \
+ swrast/s_triangle.c \
+ swrast/s_zoom.c \
swrast_setup/ss_context.c \
swrast_setup/ss_triangle.c \
swrast_setup/ss_vb.c \
@@ -119,36 +148,7 @@ CORE_SOURCES = \
tnl/t_vb_render.c \
tnl/t_vb_texgen.c \
tnl/t_vb_texmat.c \
- tnl/t_vb_vertex.c \
- swrast/s_aaline.c \
- swrast/s_aatriangle.c \
- swrast/s_accum.c \
- swrast/s_alpha.c \
- swrast/s_alphabuf.c \
- swrast/s_bitmap.c \
- swrast/s_blend.c \
- swrast/s_buffers.c \
- swrast/s_copypix.c \
- swrast/s_context.c \
- swrast/s_depth.c \
- swrast/s_drawpix.c \
- swrast/s_feedback.c \
- swrast/s_fog.c \
- swrast/s_histogram.c \
- swrast/s_lines.c \
- swrast/s_logic.c \
- swrast/s_masking.c \
- swrast/s_pb.c \
- swrast/s_pixeltex.c \
- swrast/s_points.c \
- swrast/s_quads.c \
- swrast/s_readpix.c \
- swrast/s_scissor.c \
- swrast/s_span.c \
- swrast/s_stencil.c \
- swrast/s_texture.c \
- swrast/s_triangle.c \
- swrast/s_zoom.c
+ tnl/t_vb_vertex.c
DRIVER_SOURCES = \
@@ -188,8 +188,8 @@ ASM_SOURCES =
ADDITIONAL_OBJ =
OBJECTS = $(ASM_SOURCES:.S=.o) \
- $(DRIVER_SOURCES:.c=.o) \
$(CORE_SOURCES:.c=.o) \
+ $(DRIVER_SOURCES:.c=.o) \
$(ADDITIONAL_OBJ)
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index e8298186f5..8ee5b9fc6d 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -1,3 +1,30 @@
+/* $Id: api_noop.c,v 1.4 2001/01/24 00:04:58 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
#include "glheader.h"
#include "api_noop.h"
#include "api_validate.h"
@@ -133,34 +160,41 @@ void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
- color[0] = a;
- color[1] = b;
- color[2] = c;
- color[3] = d;
+ GLchan *color = ctx->Current.Color;
+ color[0] = UBYTE_TO_CHAN(a);
+ color[1] = UBYTE_TO_CHAN(b);
+ color[2] = UBYTE_TO_CHAN(c);
+ color[3] = UBYTE_TO_CHAN(d);
}
void _mesa_noop_Color4ubv( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
+ GLchan *color = ctx->Current.Color;
+#if CHAN_TYPE == GL_UNSIGNED_BYTE
COPY_4UBV( color, v );
+#else
+ color[0] = UBYTE_TO_CHAN(v[0]);
+ color[1] = UBYTE_TO_CHAN(v[1]);
+ color[2] = UBYTE_TO_CHAN(v[2]);
+ color[3] = UBYTE_TO_CHAN(v[3]);
+#endif
}
void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
- UNCLAMPED_FLOAT_TO_UBYTE(color[0], a);
- UNCLAMPED_FLOAT_TO_UBYTE(color[1], b);
- UNCLAMPED_FLOAT_TO_UBYTE(color[2], c);
- UNCLAMPED_FLOAT_TO_UBYTE(color[3], d);
+ GLchan *color = ctx->Current.Color;
+ UNCLAMPED_FLOAT_TO_CHAN(color[0], a);
+ UNCLAMPED_FLOAT_TO_CHAN(color[1], b);
+ UNCLAMPED_FLOAT_TO_CHAN(color[2], c);
+ UNCLAMPED_FLOAT_TO_CHAN(color[3], d);
}
void _mesa_noop_Color4fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
+ GLchan *color = ctx->Current.Color;
UNCLAMPED_FLOAT_TO_CHAN(color[0], v[0]);
UNCLAMPED_FLOAT_TO_CHAN(color[1], v[1]);
UNCLAMPED_FLOAT_TO_CHAN(color[2], v[2]);
@@ -169,41 +203,41 @@ void _mesa_noop_Color4fv( const GLfloat *v )
void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
- color[0] = a;
- color[1] = b;
- color[2] = c;
- color[3] = 255;
+ GLchan *color = ctx->Current.Color;
+ color[0] = UBYTE_TO_CHAN(a);
+ color[1] = UBYTE_TO_CHAN(b);
+ color[2] = UBYTE_TO_CHAN(c);
+ color[3] = CHAN_MAX;
}
void _mesa_noop_Color3ubv( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
- color[0] = v[0];
- color[1] = v[1];
- color[2] = v[2];
- color[3] = 255;
+ GLchan *color = ctx->Current.Color;
+ color[0] = UBYTE_TO_CHAN(v[0]);
+ color[1] = UBYTE_TO_CHAN(v[1]);
+ color[2] = UBYTE_TO_CHAN(v[2]);
+ color[3] = CHAN_MAX;
}
void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
- UNCLAMPED_FLOAT_TO_UBYTE(color[0], a);
- UNCLAMPED_FLOAT_TO_UBYTE(color[1], b);
- UNCLAMPED_FLOAT_TO_UBYTE(color[2], c);
- color[3] = 255;
+ GLchan *color = ctx->Current.Color;
+ UNCLAMPED_FLOAT_TO_CHAN(color[0], a);
+ UNCLAMPED_FLOAT_TO_CHAN(color[1], b);
+ UNCLAMPED_FLOAT_TO_CHAN(color[2], c);
+ color[3] = CHAN_MAX;
}
void _mesa_noop_Color3fv( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.Color;
+ GLchan *color = ctx->Current.Color;
UNCLAMPED_FLOAT_TO_CHAN(color[0], v[0]);
UNCLAMPED_FLOAT_TO_CHAN(color[1], v[1]);
UNCLAMPED_FLOAT_TO_CHAN(color[2], v[2]);
- color[3] = 255;
+ color[3] = CHAN_MAX;
}
void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
@@ -346,41 +380,41 @@ void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v )
void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.SecondaryColor;
- color[0] = a;
- color[1] = b;
- color[2] = c;
- color[3] = 255;
+ GLchan *color = ctx->Current.SecondaryColor;
+ color[0] = UBYTE_TO_CHAN(a);
+ color[1] = UBYTE_TO_CHAN(b);
+ color[2] = UBYTE_TO_CHAN(c);
+ color[3] = CHAN_MAX;
}
void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.SecondaryColor;
- color[0] = v[0];
- color[1] = v[1];
- color[2] = v[2];
- color[3] = 255;
+ GLchan *color = ctx->Current.SecondaryColor;
+ color[0] = UBYTE_TO_CHAN(v[0]);
+ color[1] = UBYTE_TO_CHAN(v[1]);
+ color[2] = UBYTE_TO_CHAN(v[2]);
+ color[3] = CHAN_MAX;
}
void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.SecondaryColor;
- UNCLAMPED_FLOAT_TO_UBYTE(color[0], a);
- UNCLAMPED_FLOAT_TO_UBYTE(color[1], b);
- UNCLAMPED_FLOAT_TO_UBYTE(color[2], c);
- color[3] = 255;
+ GLchan *color = ctx->Current.SecondaryColor;
+ UNCLAMPED_FLOAT_TO_CHAN(color[0], a);
+ UNCLAMPED_FLOAT_TO_CHAN(color[1], b);
+ UNCLAMPED_FLOAT_TO_CHAN(color[2], c);
+ color[3] = CHAN_MAX;
}
void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
{
GET_CURRENT_CONTEXT(ctx);
- GLubyte *color = ctx->Current.SecondaryColor;
+ GLchan *color = ctx->Current.SecondaryColor;
UNCLAMPED_FLOAT_TO_CHAN(color[0], v[0]);
UNCLAMPED_FLOAT_TO_CHAN(color[1], v[1]);
UNCLAMPED_FLOAT_TO_CHAN(color[2], v[2]);
- color[3] = 255;
+ color[3] = CHAN_MAX;
}
void _mesa_noop_TexCoord1f( GLfloat a )
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index e669ff11d5..2a335625a4 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.40 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: attrib.c,v 1.41 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -589,11 +589,7 @@ _mesa_PopAttrib(void)
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
}
if (ctx->Visual.rgbMode) {
- GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
- GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
- GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
- GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
- (*ctx->Driver.ClearColor)( ctx, r, g, b, a );
+ (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
if ((ctx->Color.AlphaFunc != oldAlphaFunc ||
ctx->Color.AlphaRef != oldAlphaRef) &&
ctx->Driver.AlphaFunc)
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 410524e335..0699e74b90 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,4 +1,4 @@
-/* $Id: buffers.c,v 1.23 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: buffers.c,v 1.24 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,6 +31,7 @@
#include "glheader.h"
#include "accum.h"
#include "buffers.h"
+#include "colormac.h"
#include "context.h"
#include "depth.h"
#include "enums.h"
@@ -51,14 +52,13 @@ _mesa_ClearIndex( GLfloat c )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (ctx->Color.ClearIndex == (GLuint)c)
+ if (ctx->Color.ClearIndex == (GLuint) c)
return;
-
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClearIndex = (GLuint) c;
- if (!ctx->Visual.rgbMode) {
+ if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) {
/* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
(*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
}
@@ -67,38 +67,31 @@ _mesa_ClearIndex( GLfloat c )
void
-_mesa_ClearColor( GLclampf red, GLclampf green,
- GLclampf blue, GLclampf alpha )
+_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
{
- GLfloat tmp[4];
+ GLchan tmp[4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- tmp[0] = CLAMP( red, 0.0, 1.0 );
- tmp[1] = CLAMP( green, 0.0, 1.0 );
- tmp[2] = CLAMP( blue, 0.0, 1.0 );
- tmp[3] = CLAMP( alpha, 0.0, 1.0 );
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[0], red);
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[1], green);
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[2], blue);
+ UNCLAMPED_FLOAT_TO_CHAN(tmp[3], alpha);
if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
- COPY_4FV( ctx->Color.ClearColor, tmp );
-
- if (ctx->Visual.rgbMode) {
- GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
- GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
- GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
- GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
- (*ctx->Driver.ClearColor)( ctx, r, g, b, a );
+ COPY_CHAN4(ctx->Color.ClearColor, tmp);
+
+ if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) {
+ /* it's OK to call glClearColor in CI mode but it should be a NOP */
+ (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
}
}
-
-
-
void
_mesa_Clear( GLbitfield mask )
{
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 736d13a2e9..64ac160c35 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.117 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: context.c,v 1.118 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -792,7 +792,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Color.ColorMask[2] = 0xff;
ctx->Color.ColorMask[3] = 0xff;
ctx->Color.ClearIndex = 0;
- ASSIGN_4V( ctx->Color.ClearColor, 0.0, 0.0, 0.0, 0.0 );
+ ASSIGN_4V( ctx->Color.ClearColor, 0, 0, 0, 0 );
ctx->Color.DrawBuffer = GL_FRONT;
ctx->Color.AlphaEnabled = GL_FALSE;
ctx->Color.AlphaFunc = GL_ALWAYS;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 86220bdf4a..e529cdde2b 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.47 2001/01/09 00:02:55 brianp Exp $ */
+/* $Id: dd.h,v 1.48 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -161,19 +161,6 @@ struct dd_function_table {
* LineFunc, or TriangleFunc).
*/
- void (*ClearIndex)( GLcontext *ctx, GLuint index );
- /*
- * Called whenever glClearIndex() is called. Set the index for clearing
- * the color buffer when in color index mode.
- */
-
- void (*ClearColor)( GLcontext *ctx, GLchan red, GLchan green,
- GLchan blue, GLchan alpha );
- /*
- * Called whenever glClearColor() is called. Set the color for clearing
- * the color buffer when in RGBA mode.
- */
-
GLbitfield (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height );
/* Clear the color/depth/stencil/accum buffer(s).
@@ -754,7 +741,9 @@ struct dd_function_table {
void (*BlendFuncSeparate)(GLcontext *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA);
+ void (*ClearColor)(GLcontext *ctx, const GLchan color[4]);
void (*ClearDepth)(GLcontext *ctx, GLclampd d);
+ void (*ClearIndex)(GLcontext *ctx, GLuint index);
void (*ClearStencil)(GLcontext *ctx, GLint s);
void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
GLboolean bmask, GLboolean amask );
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index ecbb16f043..d9b046556f 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.50 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: get.c,v 1.51 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -200,10 +200,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
break;
case GL_COLOR_CLEAR_VALUE:
- params[0] = FLOAT_TO_BOOL(ctx->Color.ClearColor[0]);
- params[1] = FLOAT_TO_BOOL(ctx->Color.ClearColor[1]);
- params[2] = FLOAT_TO_BOOL(ctx->Color.ClearColor[2]);
- params[3] = FLOAT_TO_BOOL(ctx->Color.ClearColor[3]);
+ params[0] = ctx->Color.ClearColor[0] ? GL_TRUE : GL_FALSE;
+ params[1] = ctx->Color.ClearColor[1] ? GL_TRUE : GL_FALSE;
+ params[2] = ctx->Color.ClearColor[2] ? GL_TRUE : GL_FALSE;
+ params[3] = ctx->Color.ClearColor[3] ? GL_TRUE : GL_FALSE;
break;
case GL_COLOR_MATERIAL:
*params = ctx->Light.ColorMaterialEnabled;
@@ -1438,10 +1438,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
break;
case GL_COLOR_CLEAR_VALUE:
- params[0] = (GLdouble) ctx->Color.ClearColor[0];
- params[1] = (GLdouble) ctx->Color.ClearColor[1];
- params[2] = (GLdouble) ctx->Color.ClearColor[2];
- params[3] = (GLdouble) ctx->Color.ClearColor[3];
+ params[0] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[0]);
+ params[1] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[1]);
+ params[2] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[2]);
+ params[3] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[3]);
break;
case GL_COLOR_MATERIAL:
*params = (GLdouble) ctx->Light.ColorMaterialEnabled;
@@ -2676,10 +2676,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
break;
case GL_COLOR_CLEAR_VALUE:
- params[0] = (GLfloat) ctx->Color.ClearColor[0];
- params[1] = (GLfloat) ctx->Color.ClearColor[1];
- params[2] = (GLfloat) ctx->Color.ClearColor[2];
- params[3] = (GLfloat) ctx->Color.ClearColor[3];
+ params[0] = CHAN_TO_FLOAT(ctx->Color.ClearColor[0]);
+ params[1] = CHAN_TO_FLOAT(ctx->Color.ClearColor[1]);
+ params[2] = CHAN_TO_FLOAT(ctx->Color.ClearColor[2]);
+ params[3] = CHAN_TO_FLOAT(ctx->Color.ClearColor[3]);
break;
case GL_COLOR_MATERIAL:
*params = (GLfloat) ctx->Light.ColorMaterialEnabled;
@@ -3890,10 +3890,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Transform.ClipEnabled[i];
break;
case GL_COLOR_CLEAR_VALUE:
- params[0] = FLOAT_TO_INT( ctx->Color.ClearColor[0] );
- params[1] = FLOAT_TO_INT( ctx->Color.ClearColor[1] );
- params[2] = FLOAT_TO_INT( ctx->Color.ClearColor[2] );
- params[3] = FLOAT_TO_INT( ctx->Color.ClearColor[3] );
+ params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[0]) );
+ params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[1]) );
+ params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[2]) );
+ params[3] = FLOAT_TO_INT( CHAN_TO_FLOAT(ctx->Color.ClearColor[3]) );
break;
case GL_COLOR_MATERIAL:
*params = (GLint) ctx->Light.ColorMaterialEnabled;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index a8694a96c3..9a3f227758 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -1,4 +1,4 @@
-/* $Id: macros.h,v 1.17 2001/01/08 04:09:41 keithw Exp $ */
+/* $Id: macros.h,v 1.18 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -73,6 +73,7 @@
#define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i))
#define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i))
#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i))
+#define STRIDE_4CHAN(p, i) (p = (GLchan (*)[4])((GLchan *)p + i))
#define STRIDE_T(p, t, i) (p = (t)((GLubyte *)p + i))
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 66d085ba81..80721c50a9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.14 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: mtypes.h,v 1.15 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -265,7 +265,7 @@ struct gl_accum_attrib {
struct gl_colorbuffer_attrib {
GLuint ClearIndex; /* Index to use for glClear */
- GLfloat ClearColor[4]; /* Color to use for glClear */
+ GLchan ClearColor[4]; /* Color to use for glClear */
GLuint IndexMask; /* Color index write mask */
GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 9bf4bbb3c8..ced3940b65 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.27 2001/01/06 22:46:13 gareth Exp $ */
+/* $Id: texstate.c,v 1.28 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -743,10 +743,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
}
break;
case GL_TEXTURE_BORDER_COLOR:
- texObj->BorderColor[0] = (GLchan) CLAMP((GLint)(params[0]*CHAN_MAXF), 0, CHAN_MAX);
- texObj->BorderColor[1] = (GLchan) CLAMP((GLint)(params[1]*CHAN_MAXF), 0, CHAN_MAX);
- texObj->BorderColor[2] = (GLchan) CLAMP((GLint)(params[2]*CHAN_MAXF), 0, CHAN_MAX);
- texObj->BorderColor[3] = (GLchan) CLAMP((GLint)(params[3]*CHAN_MAXF), 0, CHAN_MAX);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[0], params[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[1], params[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[2], params[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[3], params[3]);
break;
case GL_TEXTURE_MIN_LOD:
texObj->MinLod = params[0];
diff --git a/src/mesa/main/texutil.h b/src/mesa/main/texutil.h
index 6790d9b335..3cdd554550 100644
--- a/src/mesa/main/texutil.h
+++ b/src/mesa/main/texutil.h
@@ -1,4 +1,4 @@
-/* $Id: texutil.h,v 1.6 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: texutil.h,v 1.7 2001/01/24 00:04:58 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -81,7 +81,7 @@ _mesa_unconvert_teximage(MesaIntTexFormat srcFormat,
GLint srcWidth, GLint srcHeight,
const GLvoid *srcImage, GLint srcRowStride,
GLint dstWidth, GLint dstHeight,
- GLenum dstFormat, GLchan *dstImage);
+ GLenum dstFormat, GLubyte *dstImage);
extern void