FxU32 r, g, b, a;
GLint i;
- ASSERT(table->TableType == GL_UNSIGNED_BYTE);
+ ASSERT(!table->FloatTable);
switch (table->Format) {
case GL_INTENSITY:
-/* $Id: accum.c,v 1.27 2000/10/17 00:42:02 brianp Exp $ */
+/* $Id: accum.c,v 1.28 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
+#if CHAN_BITS == 8
#define USE_OPTIMIZED_ACCUM /* enable the optimization */
+#endif
GET_CURRENT_CONTEXT(ctx);
GLuint xpos, ypos, width, height, width4;
GLfloat acc_scale;
- GLubyte rgba[MAX_WIDTH][4];
+ GLchan rgba[MAX_WIDTH][4];
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
const GLint iChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
const GLfloat fChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
- (const GLubyte (*)[4])rgba, NULL );
+ (const GLchan (*)[4])rgba, NULL );
ypos++;
}
}
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
- (const GLubyte (*)[4])rgba, NULL );
+ (const GLchan (*)[4])rgba, NULL );
ypos++;
}
}
-/* $Id: attrib.c,v 1.28 2000/09/28 22:44:30 brianp Exp $ */
+/* $Id: attrib.c,v 1.29 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
{
GLenum oldDrawBuffer = ctx->Color.DrawBuffer;
GLenum oldAlphaFunc = ctx->Color.AlphaFunc;
- GLubyte oldAlphaRef = ctx->Color.AlphaRef;
+ GLchan oldAlphaRef = ctx->Color.AlphaRef;
GLenum oldBlendSrc = ctx->Color.BlendSrcRGB;
GLenum oldBlendDst = ctx->Color.BlendDstRGB;
GLenum oldLogicOp = ctx->Color.LogicOp;
ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
}
if (ctx->Visual.RGBAflag) {
- GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
- GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
- GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
- GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
+ 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 );
if ((ctx->Color.AlphaFunc != oldAlphaFunc ||
ctx->Color.AlphaRef != oldAlphaRef) &&
ctx->Driver.AlphaFunc)
(*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc,
- ctx->Color.AlphaRef / 255.0F);
+ ctx->Color.AlphaRef / CHAN_MAXF);
if (ctx->Driver.ColorMask) {
(*ctx->Driver.ColorMask)(ctx,
ctx->Color.ColorMask[0],
-/* $Id: blend.c,v 1.20 2000/10/23 00:16:28 gareth Exp $ */
+/* $Id: blend.c,v 1.21 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
static void _BLENDAPI
blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
- GLubyte rgba[][4], CONST GLubyte dest[][4] )
+ GLchan rgba[][4], CONST GLchan dest[][4] )
{
GLuint i;
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT);
for (i=0;i<n;i++) {
if (mask[i]) {
- const GLint t = rgba[i][ACOMP]; /* t in [0,255] */
+ const GLint t = rgba[i][ACOMP]; /* t in [0, CHAN_MAX] */
if (t == 0) {
/* 0% alpha */
rgba[i][RCOMP] = dest[i][RCOMP];
#else
/* This satisfies Glean and should be reasonably fast */
/* Contributed by Nathan Hand */
+#if CHAN_BITS == 8
#define DIV255(X) (((X) << 8) + (X) + 256) >> 16
+#else
+XXX todo
+#endif
const GLint s = CHAN_MAX - t;
const GLint r = DIV255(rgba[i][RCOMP] * t + dest[i][RCOMP] * s);
const GLint g = DIV255(rgba[i][GCOMP] * t + dest[i][GCOMP] * s);
ASSERT(g <= CHAN_MAX);
ASSERT(b <= CHAN_MAX);
ASSERT(a <= CHAN_MAX);
- rgba[i][RCOMP] = (GLubyte) r;
- rgba[i][GCOMP] = (GLubyte) g;
- rgba[i][BCOMP] = (GLubyte) b;
- rgba[i][ACOMP] = (GLubyte) a;
+ rgba[i][RCOMP] = (GLchan) r;
+ rgba[i][GCOMP] = (GLchan) g;
+ rgba[i][BCOMP] = (GLchan) b;
+ rgba[i][ACOMP] = (GLchan) a;
}
}
}
*/
static void _BLENDAPI
blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[],
- GLubyte rgba[][4], CONST GLubyte dest[][4] )
+ GLchan rgba[][4], CONST GLchan dest[][4] )
{
GLuint i;
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT);
GLint g = rgba[i][GCOMP] + dest[i][GCOMP];
GLint b = rgba[i][BCOMP] + dest[i][BCOMP];
GLint a = rgba[i][ACOMP] + dest[i][ACOMP];
- rgba[i][RCOMP] = (GLubyte) MIN2( r, CHAN_MAX );
- rgba[i][GCOMP] = (GLubyte) MIN2( g, CHAN_MAX );
- rgba[i][BCOMP] = (GLubyte) MIN2( b, CHAN_MAX );
- rgba[i][ACOMP] = (GLubyte) MIN2( a, CHAN_MAX );
+ rgba[i][RCOMP] = (GLchan) MIN2( r, CHAN_MAX );
+ rgba[i][GCOMP] = (GLchan) MIN2( g, CHAN_MAX );
+ rgba[i][BCOMP] = (GLchan) MIN2( b, CHAN_MAX );
+ rgba[i][ACOMP] = (GLchan) MIN2( a, CHAN_MAX );
}
}
}
*/
static void _BLENDAPI
blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[],
- GLubyte rgba[][4], CONST GLubyte dest[][4] )
+ GLchan rgba[][4], CONST GLchan dest[][4] )
{
GLuint i;
ASSERT(ctx->Color.BlendEquation==GL_MIN_EXT);
for (i=0;i<n;i++) {
if (mask[i]) {
- rgba[i][RCOMP] = (GLubyte) MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
- rgba[i][GCOMP] = (GLubyte) MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
- rgba[i][BCOMP] = (GLubyte) MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
- rgba[i][ACOMP] = (GLubyte) MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
+ rgba[i][RCOMP] = (GLchan) MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
+ rgba[i][GCOMP] = (GLchan) MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
+ rgba[i][BCOMP] = (GLchan) MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
+ rgba[i][ACOMP] = (GLchan) MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
}
}
}
*/
static void _BLENDAPI
blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[],
- GLubyte rgba[][4], CONST GLubyte dest[][4] )
+ GLchan rgba[][4], CONST GLchan dest[][4] )
{
GLuint i;
ASSERT(ctx->Color.BlendEquation==GL_MAX_EXT);
for (i=0;i<n;i++) {
if (mask[i]) {
- rgba[i][RCOMP] = (GLubyte) MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
- rgba[i][GCOMP] = (GLubyte) MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
- rgba[i][BCOMP] = (GLubyte) MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
- rgba[i][ACOMP] = (GLubyte) MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
+ rgba[i][RCOMP] = (GLchan) MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
+ rgba[i][GCOMP] = (GLchan) MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
+ rgba[i][BCOMP] = (GLchan) MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
+ rgba[i][ACOMP] = (GLchan) MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
}
}
}
*/
static void _BLENDAPI
blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[],
- GLubyte rgba[][4], CONST GLubyte dest[][4] )
+ GLchan rgba[][4], CONST GLchan dest[][4] )
{
GLuint i;
(void) ctx;
GLint g = (rgba[i][GCOMP] * dest[i][GCOMP]) >> 8;
GLint b = (rgba[i][BCOMP] * dest[i][BCOMP]) >> 8;
GLint a = (rgba[i][ACOMP] * dest[i][ACOMP]) >> 8;
- rgba[i][RCOMP] = (GLubyte) r;
- rgba[i][GCOMP] = (GLubyte) g;
- rgba[i][BCOMP] = (GLubyte) b;
- rgba[i][ACOMP] = (GLubyte) a;
+ rgba[i][RCOMP] = (GLchan) r;
+ rgba[i][GCOMP] = (GLchan) g;
+ rgba[i][BCOMP] = (GLchan) b;
+ rgba[i][ACOMP] = (GLchan) a;
}
}
}
*/
static void _BLENDAPI
blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[],
- GLubyte rgba[][4], CONST GLubyte dest[][4] )
+ GLchan rgba[][4], CONST GLchan dest[][4] )
{
GLfloat rscale = 1.0F / CHAN_MAXF;
GLfloat gscale = 1.0F / CHAN_MAXF;
}
/* final clamping */
- rgba[i][RCOMP] = (GLubyte) (GLint) CLAMP( r, 0.0F, CHAN_MAXF );
- rgba[i][GCOMP] = (GLubyte) (GLint) CLAMP( g, 0.0F, CHAN_MAXF );
- rgba[i][BCOMP] = (GLubyte) (GLint) CLAMP( b, 0.0F, CHAN_MAXF );
- rgba[i][ACOMP] = (GLubyte) (GLint) CLAMP( a, 0.0F, CHAN_MAXF );
+ rgba[i][RCOMP] = (GLchan) (GLint) CLAMP( r, 0.0F, CHAN_MAXF );
+ rgba[i][GCOMP] = (GLchan) (GLint) CLAMP( g, 0.0F, CHAN_MAXF );
+ rgba[i][BCOMP] = (GLchan) (GLint) CLAMP( b, 0.0F, CHAN_MAXF );
+ rgba[i][ACOMP] = (GLchan) (GLint) CLAMP( a, 0.0F, CHAN_MAXF );
}
}
}
*/
void
_mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4], const GLubyte mask[] )
+ GLchan rgba[][4], const GLubyte mask[] )
{
- GLubyte dest[MAX_WIDTH][4];
+ GLchan dest[MAX_WIDTH][4];
/* Check if device driver can do the work */
if (ctx->Color.BlendEquation==GL_LOGIC_OP &&
if (!ctx->Color.BlendFunc)
set_blend_function(ctx);
- (*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLubyte (*)[4])dest );
+ (*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLchan (*)[4])dest );
}
void
_mesa_blend_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
+ GLchan rgba[][4], const GLchan mask[] )
{
- GLubyte dest[PB_SIZE][4];
+ GLchan dest[PB_SIZE][4];
/* Check if device driver can do the work */
if (ctx->Color.BlendEquation==GL_LOGIC_OP &&
if (!ctx->Color.BlendFunc)
set_blend_function(ctx);
- (*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLubyte (*)[4])dest );
+ (*ctx->Color.BlendFunc)( ctx, n, mask, rgba, (const GLchan (*)[4])dest );
}
-/* $Id: blend.h,v 1.4 2000/02/24 22:04:03 brianp Exp $ */
+/* $Id: blend.h,v 1.5 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
- * Copyright (C) 2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 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"),
extern void
_mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4], const GLubyte mask[] );
+ GLchan rgba[][4], const GLubyte mask[] );
extern void
_mesa_blend_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] );
+ GLchan rgba[][4], const GLubyte mask[] );
extern void
-/* $Id: buffers.c,v 1.14 2000/10/19 18:17:19 brianp Exp $ */
+/* $Id: buffers.c,v 1.15 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );
if (ctx->Visual.RGBAflag) {
- GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
- GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
- GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
- GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
+ 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 );
}
}
if (ctx->Visual.RGBAflag) {
/* RGBA mode */
- const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
- const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
- const GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
- const GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
+ const GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
+ const GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
+ const GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
+ const GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
GLint i;
for (i = 0; i < height; i++) {
- GLubyte rgba[MAX_WIDTH][4];
+ GLchan rgba[MAX_WIDTH][4];
GLint j;
for (j=0; j<width; j++) {
rgba[j][RCOMP] = r;
}
_mesa_mask_rgba_span( ctx, width, x, y + i, rgba );
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
- (CONST GLubyte (*)[4])rgba, NULL );
+ (CONST GLchan (*)[4]) rgba, NULL );
}
}
else {
if (ctx->Visual.RGBAflag) {
/* RGBA mode */
- const GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F);
- const GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F);
- const GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F);
- const GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F);
- GLubyte span[MAX_WIDTH][4];
+ const GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
+ const GLchan g = (GLint) (ctx->Color.ClearColor[1] * CHAN_MAXF);
+ const GLchan b = (GLint) (ctx->Color.ClearColor[2] * CHAN_MAXF);
+ const GLchan a = (GLint) (ctx->Color.ClearColor[3] * CHAN_MAXF);
+ GLchan span[MAX_WIDTH][4];
GLint i;
ASSERT(colorMask == 0xffffffff);
}
for (i = 0; i < height; i++) {
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
- (CONST GLubyte (*)[4]) span, NULL );
+ (CONST GLchan (*)[4]) span, NULL );
}
}
else {
ASSERT(ctx->Color.IndexMask == ~0);
if (ctx->Visual.IndexBits == 8) {
/* 8-bit clear */
- GLubyte span[MAX_WIDTH];
+ GLchan span[MAX_WIDTH];
GLint i;
MEMSET(span, ctx->Color.ClearIndex, width);
for (i = 0; i < height; i++) {
-/* $Id: colortab.c,v 1.21 2000/08/21 14:23:09 brianp Exp $ */
+/* $Id: colortab.c,v 1.22 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
void
_mesa_init_colortable( struct gl_color_table *p )
{
- p->TableType = GL_UNSIGNED_BYTE;
+ p->FloatTable = GL_FALSE;
/* allocate a width=1 table by default */
- p->Table = CALLOC(4 * sizeof(GLubyte));
+ p->Table = CALLOC(4 * sizeof(GLchan));
if (p->Table) {
- GLubyte *t = (GLubyte *) p->Table;
- t[0] = 255;
- t[1] = 255;
- t[2] = 255;
- t[3] = 255;
+ GLchan *t = (GLchan *) p->Table;
+ t[0] = CHAN_MAX;
+ t[1] = CHAN_MAX;
+ t[2] = CHAN_MAX;
+ t[3] = CHAN_MAX;
}
p->Size = 1;
p->IntFormat = GL_RGBA;
p->Format = GL_RGBA;
- p->RedSize = 8;
- p->GreenSize = 8;
- p->BlueSize = 8;
- p->AlphaSize = 8;
+ p->RedSize = CHAN_BITS;
+ p->GreenSize = CHAN_BITS;
+ p->BlueSize = CHAN_BITS;
+ p->AlphaSize = CHAN_BITS;
p->IntensitySize = 0;
p->LuminanceSize = 0;
}
table->RedSize = 0;
table->GreenSize = 0;
table->BlueSize = 0;
- table->AlphaSize = 8;
+ table->AlphaSize = CHAN_BITS;
table->IntensitySize = 0;
table->LuminanceSize = 0;
break;
table->BlueSize = 0;
table->AlphaSize = 0;
table->IntensitySize = 0;
- table->LuminanceSize = 8;
+ table->LuminanceSize = CHAN_BITS;
break;
case GL_LUMINANCE_ALPHA:
table->RedSize = 0;
table->GreenSize = 0;
table->BlueSize = 0;
- table->AlphaSize = 8;
+ table->AlphaSize = CHAN_BITS;
table->IntensitySize = 0;
- table->LuminanceSize = 8;
+ table->LuminanceSize = CHAN_BITS;
break;
case GL_INTENSITY:
table->RedSize = 0;
table->GreenSize = 0;
table->BlueSize = 0;
table->AlphaSize = 0;
- table->IntensitySize = 8;
+ table->IntensitySize = CHAN_BITS;
table->LuminanceSize = 0;
break;
case GL_RGB:
- table->RedSize = 8;
- table->GreenSize = 8;
- table->BlueSize = 8;
+ table->RedSize = CHAN_BITS;
+ table->GreenSize = CHAN_BITS;
+ table->BlueSize = CHAN_BITS;
table->AlphaSize = 0;
table->IntensitySize = 0;
table->LuminanceSize = 0;
break;
case GL_RGBA:
- table->RedSize = 8;
- table->GreenSize = 8;
- table->BlueSize = 8;
- table->AlphaSize = 8;
+ table->RedSize = CHAN_BITS;
+ table->GreenSize = CHAN_BITS;
+ table->BlueSize = CHAN_BITS;
+ table->AlphaSize = CHAN_BITS;
table->IntensitySize = 0;
table->LuminanceSize = 0;
break;
format, type, data, &ctx->Unpack,
0, GL_FALSE);
- table->TableType = GL_FLOAT;
+ table->FloatTable = GL_TRUE;
table->Table = MALLOC(comps * width * sizeof(GLfloat));
if (!table->Table) {
gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
}
}
else {
- /* store GLubyte table */
- table->TableType = GL_UNSIGNED_BYTE;
- table->Table = MALLOC(comps * width * sizeof(GLubyte));
+ /* store GLchan table */
+ table->FloatTable = GL_FALSE;
+ table->Table = MALLOC(comps * width * sizeof(GLchan));
if (!table->Table) {
gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
return;
return;
}
- if (table->TableType == GL_UNSIGNED_BYTE) {
- GLubyte *dest = (GLubyte *) table->Table + start * comps * sizeof(GLubyte);
+ if (!table->FloatTable) {
+ GLchan *dest = (GLchan *) table->Table + start * comps * sizeof(GLchan);
_mesa_unpack_ubyte_color_span(ctx, count, table->Format, dest,
format, type, data, &ctx->Unpack, 0);
}
GLfloat *tableF;
GLuint i;
- ASSERT(table->TableType == GL_FLOAT);
+ ASSERT(table->FloatTable);
_mesa_unpack_float_color_span(ctx, count, table->Format,
tempTab, /* dest */
_mesa_CopyColorTable(GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width)
{
- GLubyte data[MAX_WIDTH][4];
+ GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable");
_mesa_CopyColorSubTable(GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width)
{
- GLubyte data[MAX_WIDTH][4];
+ GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable");
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_color_table *table = NULL;
- GLubyte rgba[MAX_COLOR_TABLE_SIZE][4];
+ GLchan rgba[MAX_COLOR_TABLE_SIZE][4];
GLint i;
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable");
switch (table->Format) {
case GL_ALPHA:
- if (table->TableType == GL_FLOAT) {
+ if (table->FloatTable) {
const GLfloat *tableF = (const GLfloat *) table->Table;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
rgba[i][BCOMP] = 0;
- rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F);
+ rgba[i][ACOMP] = (GLint) (tableF[i] * CHAN_MAXF);
}
}
else {
- const GLubyte *tableUB = (const GLubyte *) table->Table;
+ const GLchan *tableUB = (const GLchan *) table->Table;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
}
break;
case GL_LUMINANCE:
- if (table->TableType == GL_FLOAT) {
+ if (table->FloatTable) {
const GLfloat *tableF = (const GLfloat *) table->Table;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F);
- rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F);
- rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F);
- rgba[i][ACOMP] = 255;
+ rgba[i][RCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
+ rgba[i][GCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
+ rgba[i][BCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
+ rgba[i][ACOMP] = CHAN_MAX;
}
}
else {
- const GLubyte *tableUB = (const GLubyte *) table->Table;
+ const GLchan *tableUB = (const GLchan *) table->Table;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = tableUB[i];
rgba[i][GCOMP] = tableUB[i];
rgba[i][BCOMP] = tableUB[i];
- rgba[i][ACOMP] = 255;
+ rgba[i][ACOMP] = CHAN_MAX;
}
}
break;
case GL_LUMINANCE_ALPHA:
- if (table->TableType == GL_FLOAT) {
+ if (table->FloatTable) {
const GLfloat *tableF = (const GLfloat *) table->Table;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = (GLint) (tableF[i*2+0] * 255.0F);
- rgba[i][GCOMP] = (GLint) (tableF[i*2+0] * 255.0F);
- rgba[i][BCOMP] = (GLint) (tableF[i*2+0] * 255.0F);
- rgba[i][ACOMP] = (GLint) (tableF[i*2+1] * 255.0F);
+ rgba[i][RCOMP] = (GLint) (tableF[i*2+0] * CHAN_MAXF);
+ rgba[i][GCOMP] = (GLint) (tableF[i*2+0] * CHAN_MAXF);
+ rgba[i][BCOMP] = (GLint) (tableF[i*2+0] * CHAN_MAXF);
+ rgba[i][ACOMP] = (GLint) (tableF[i*2+1] * CHAN_MAXF);
}
}
else {
- const GLubyte *tableUB = (const GLubyte *) table->Table;
+ const GLchan *tableUB = (const GLchan *) table->Table;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = tableUB[i*2+0];
rgba[i][GCOMP] = tableUB[i*2+0];
}
break;
case GL_INTENSITY:
- if (table->TableType == GL_FLOAT) {
+ if (table->FloatTable) {
const GLfloat *tableF = (const GLfloat *) table->Table;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F);
- rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F);
- rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F);
- rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F);
+ rgba[i][RCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
+ rgba[i][GCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
+ rgba[i][BCOMP] = (GLint) (tableF[i] * CHAN_MAXF);
+ rgba[i][ACOMP] = (GLint) (tableF[i] * CHAN_MAXF);
}
}
else {
- const GLubyte *tableUB = (const GLubyte *) table->Table;
+ const GLchan *tableUB = (const GLchan *) table->Table;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = tableUB[i];
rgba[i][GCOMP] = tableUB[i];
}
break;
case GL_RGB:
- if (table->TableType == GL_FLOAT) {
+ if (table->FloatTable) {
const GLfloat *tableF = (const GLfloat *) table->Table;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = (GLint) (tableF[i*3+0] * 255.0F);
- rgba[i][GCOMP] = (GLint) (tableF[i*3+1] * 255.0F);
- rgba[i][BCOMP] = (GLint) (tableF[i*3+2] * 255.0F);
- rgba[i][ACOMP] = 255;
+ rgba[i][RCOMP] = (GLint) (tableF[i*3+0] * CHAN_MAXF);
+ rgba[i][GCOMP] = (GLint) (tableF[i*3+1] * CHAN_MAXF);
+ rgba[i][BCOMP] = (GLint) (tableF[i*3+2] * CHAN_MAXF);
+ rgba[i][ACOMP] = CHAN_MAX;
}
}
else {
- const GLubyte *tableUB = (const GLubyte *) table->Table;
+ const GLchan *tableUB = (const GLchan *) table->Table;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = tableUB[i*3+0];
rgba[i][GCOMP] = tableUB[i*3+1];
rgba[i][BCOMP] = tableUB[i*3+2];
- rgba[i][ACOMP] = 255;
+ rgba[i][ACOMP] = CHAN_MAX;
}
}
break;
case GL_RGBA:
- if (table->TableType == GL_FLOAT) {
+ if (table->FloatTable) {
const GLfloat *tableF = (const GLfloat *) table->Table;
for (i = 0; i < table->Size; i++) {
- rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * 255.0F + 0.5F);
- rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * 255.0F + 0.5F);
- rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * 255.0F + 0.5F);
- rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * 255.0F + 0.5F);
+ rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * CHAN_MAXF + 0.5F);
+ rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * CHAN_MAXF + 0.5F);
+ rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * CHAN_MAXF + 0.5F);
+ rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * CHAN_MAXF + 0.5F);
}
}
else {
- const GLubyte *tableUB = (const GLubyte *) table->Table;
+ const GLchan *tableUB = (const GLchan *) table->Table;
for (i = 0; i < table->Size; i++) {
rgba[i][RCOMP] = tableUB[i*4+0];
rgba[i][GCOMP] = tableUB[i*4+1];
return;
}
- _mesa_pack_rgba_span(ctx, table->Size, (const GLubyte (*)[]) rgba,
+ _mesa_pack_rgba_span(ctx, table->Size, (const GLchan (*)[]) rgba,
format, type, data, &ctx->Pack, GL_FALSE);
}
-/* $Id: config.h,v 1.19 2000/10/26 19:26:18 brianp Exp $ */
+/* $Id: config.h,v 1.20 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define CHAN_BITS 8
#define CHAN_MAX ((1 << CHAN_BITS) - 1)
#define CHAN_MAXF ((GLfloat) CHAN_MAX)
+#if CHAN_BITS == 8
+ typedef GLubyte GLchan;
+#elif CHAN_BITS == 16
+ typedef GLushort GLchan;
+#else
+#error illegal number of color channel bits
+#endif
+
+
+
/*
-/* $Id: context.c,v 1.96 2000/10/27 16:44:40 keithw Exp $ */
+/* $Id: context.c,v 1.97 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->Color.MultiDrawBuffer = GL_FALSE;
/* Current group */
- ASSIGN_4V( ctx->Current.ByteColor, 255, 255, 255, 255);
+ ASSIGN_4V( ctx->Current.ByteColor, CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX );
ctx->Current.Index = 1;
for (i=0; i<MAX_TEXTURE_UNITS; i++)
ASSIGN_4V( ctx->Current.Texcoord[i], 0.0, 0.0, 0.0, 1.0 );
-/* $Id: convolve.c,v 1.5 2000/09/05 20:28:56 brianp Exp $ */
+/* $Id: convolve.c,v 1.6 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
/* read pixels from framebuffer */
- gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLubyte (*)[4]) rgba);
+ gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLchan (*)[4]) rgba);
/* store as convolution filter */
_mesa_ConvolutionFilter1D(target, internalFormat, width,
/* read pixels from framebuffer */
for (i = 0; i < height; i++) {
gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y + i,
- (GLubyte (*)[4]) rgba[i]);
+ (GLchan (*)[4]) rgba[i]);
}
/*
-/* $Id: dd.h,v 1.33 2000/09/28 18:30:39 brianp Exp $ */
+/* $Id: dd.h,v 1.34 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
* the color buffer when in color index mode.
*/
- void (*ClearColor)( GLcontext *ctx, GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha );
+ 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.
*/
void (*Color)( GLcontext *ctx,
- GLubyte red, GLubyte green, GLubyte glue, GLubyte alpha );
+ GLchan red, GLchan green, GLchan glue, GLchan alpha );
/*
* Sets current color for drawing flat-shaded primitives.
* This color should also be used in the "mono" drawing functions.
void (*WriteRGBASpan)( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- CONST GLubyte rgba[][4], const GLubyte mask[] );
+ CONST GLchan rgba[][4], const GLubyte mask[] );
void (*WriteRGBSpan)( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- CONST GLubyte rgb[][3], const GLubyte mask[] );
+ CONST GLchan rgb[][3], const GLubyte mask[] );
/* Write a horizontal run of RGBA or RGB pixels.
* If mask is NULL, draw all pixels.
* If mask is not null, only draw pixel [i] when mask [i] is true.
void (*WriteRGBAPixels)( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- CONST GLubyte rgba[][4], const GLubyte mask[] );
+ CONST GLchan rgba[][4], const GLubyte mask[] );
/* Write array of RGBA pixels at random locations.
*/
*/
void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] );
+ GLchan rgba[][4] );
/* Read a horizontal run of RGBA pixels.
*/
void (*ReadRGBAPixels)( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] );
+ GLchan rgba[][4], const GLubyte mask[] );
/* Read a random array of RGBA pixels.
*/
-/* $Id: feedback.c,v 1.11 2000/09/26 20:53:53 brianp Exp $ */
+/* $Id: feedback.c,v 1.12 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->Light.ShadeModel == GL_SMOOTH)
pv = v;
- UBYTE_RGBA_TO_FLOAT_RGBA( color, VB->ColorPtr->data[pv] );
+ CHAN_RGBA_TO_FLOAT_RGBA( color, VB->ColorPtr->data[pv] );
if (VB->TexCoordPtr[texUnit]->size == 4 &&
VB->TexCoordPtr[texUnit]->data[v][3] != 0.0) {
-/* $Id: fog.c,v 1.23 2000/10/28 11:42:12 keithw Exp $ */
+/* $Id: fog.c,v 1.24 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
_mesa_fog_rgba_pixels( const GLcontext *ctx,
GLuint n,
const GLfixed fog[],
- GLubyte rgba[][4] )
+ GLchan rgba[][4] )
{
- GLfixed rFog = ctx->Fog.Color[0] * 255.0;
- GLfixed gFog = ctx->Fog.Color[1] * 255.0;
- GLfixed bFog = ctx->Fog.Color[2] * 255.0;
+ GLfixed rFog = ctx->Fog.Color[0] * CHAN_MAXF;
+ GLfixed gFog = ctx->Fog.Color[1] * CHAN_MAXF;
+ GLfixed bFog = ctx->Fog.Color[2] * CHAN_MAXF;
GLuint i;
for (i=0;i<n;i++) {
*/
void
_mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLdepth z[], GLubyte rgba[][4] )
+ GLuint n, const GLdepth z[], GLchan rgba[][4] )
{
GLfixed fog[MAX_WIDTH];
_mesa_win_fog_coords_from_z( ctx, n, z, fog );
-/* $Id: fog.h,v 1.6 2000/10/27 18:31:22 brianp Exp $ */
+/* $Id: fog.h,v 1.7 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
extern void
_mesa_fog_rgba_pixels( const GLcontext *ctx,
GLuint n, const GLfixed fog[],
- GLubyte rgba[][4] );
+ GLchan rgba[][4] );
extern void
_mesa_fog_ci_pixels( const GLcontext *ctx,
-/* $Id: get.c,v 1.35 2000/10/27 16:44:40 keithw Exp $ */
+/* $Id: get.c,v 1.36 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
*params = ENUM_TO_BOOL(ctx->Color.AlphaFunc);
break;
case GL_ALPHA_TEST_REF:
- *params = FLOAT_TO_BOOL((GLfloat) ctx->Color.AlphaRef / 255.0);
+ *params = FLOAT_TO_BOOL((GLfloat) ctx->Color.AlphaRef / CHAN_MAXF);
break;
case GL_ATTRIB_STACK_DEPTH:
*params = INT_TO_BOOL(ctx->AttribStackDepth);
*params = ENUM_TO_DOUBLE(ctx->Color.AlphaFunc);
break;
case GL_ALPHA_TEST_REF:
- *params = (GLdouble) ctx->Color.AlphaRef / 255.0;
+ *params = (GLdouble) ctx->Color.AlphaRef / CHAN_MAXF;
break;
case GL_ATTRIB_STACK_DEPTH:
*params = (GLdouble ) (ctx->AttribStackDepth);
*params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[0]);
- params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[1]);
- params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[2]);
- params[3] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[3]);
+ params[0] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[0]);
+ params[1] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[1]);
+ params[2] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[2]);
+ params[3] = CHAN_COLOR_TO_FLOAT_COLOR(ctx->Current.ByteColor[3]);
break;
case GL_CURRENT_INDEX:
*params = (GLdouble) ctx->Current.Index;
*params = ENUM_TO_FLOAT(ctx->Color.AlphaFunc);
break;
case GL_ALPHA_TEST_REF:
- *params = (GLfloat) ctx->Color.AlphaRef / 255.0;
+ *params = (GLfloat) ctx->Color.AlphaRef / CHAN_MAXF;
break;
case GL_ATTRIB_STACK_DEPTH:
*params = (GLfloat) (ctx->AttribStackDepth);
*params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- UBYTE_RGBA_TO_FLOAT_RGBA(params, ctx->Current.ByteColor);
+ CHAN_RGBA_TO_FLOAT_RGBA(params, ctx->Current.ByteColor);
break;
case GL_CURRENT_INDEX:
*params = (GLfloat) ctx->Current.Index;
*params = (GLint) ctx->Color.AlphaEnabled;
break;
case GL_ALPHA_TEST_REF:
- *params = FLOAT_TO_INT( (GLfloat) ctx->Color.AlphaRef / 255.0 );
+ *params = FLOAT_TO_INT( (GLfloat) ctx->Color.AlphaRef / CHAN_MAXF );
break;
case GL_ALPHA_TEST_FUNC:
*params = (GLint) ctx->Color.AlphaFunc;
*params = (GLint) ctx->Polygon.CullFaceMode;
break;
case GL_CURRENT_COLOR:
- params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[0] ) );
- params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[1] ) );
- params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[2] ) );
- params[3] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[3] ) );
+ params[0] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[0] ) );
+ params[1] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[1] ) );
+ params[2] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[2] ) );
+ params[3] = FLOAT_TO_INT( CHAN_COLOR_TO_FLOAT_COLOR( ctx->Current.ByteColor[3] ) );
break;
case GL_CURRENT_INDEX:
*params = (GLint) ctx->Current.Index;
-/* $Id: light.c,v 1.18 2000/10/27 16:44:40 keithw Exp $ */
+/* $Id: light.c,v 1.19 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* set by glColorMaterial().
*/
void gl_update_color_material( GLcontext *ctx,
- const GLubyte rgba[4] )
+ const GLchan rgba[4] )
{
struct gl_light *light, *list = &ctx->Light.EnabledList;
GLuint bitmask = ctx->Light.ColorMaterialBitmask;
-/* $Id: light.h,v 1.3 2000/06/26 23:37:46 brianp Exp $ */
+/* $Id: light.h,v 1.4 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
const struct gl_material src[2],
GLuint bitmask );
-extern void gl_update_color_material( GLcontext *ctx, const GLubyte rgba[4] );
+extern void gl_update_color_material( GLcontext *ctx, const GLchan rgba[4] );
#endif
-/* $Id: lines.c,v 1.17 2000/10/27 16:44:40 keithw Exp $ */
+/* $Id: lines.c,v 1.18 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void flat_rgba_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert )
{
- const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
+ const GLchan *color = ctx->VB->ColorPtr->data[pvert];
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
#define INTERP_XY 1
static void flat_rgba_z_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert )
{
- const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
+ const GLchan *color = ctx->VB->ColorPtr->data[pvert];
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
#define INTERP_XY 1
GLint count = ctx->PB->count;
GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y;
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
+ GLchan (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
ctx->PB->mono = GL_FALSE;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
GLfixed *pbfog = ctx->PB->fog;
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
+ GLchan (*pbrgba)[4] = ctx->PB->rgba;
+
(void) pvert;
ctx->PB->mono = GL_FALSE;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
GLfixed *pbfog = ctx->PB->fog;
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
+ GLchan (*pbrgba)[4] = ctx->PB->rgba;
+
(void) pvert;
ctx->PB->mono = GL_FALSE;
static void general_flat_rgba_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert )
{
- const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
+ const GLchan *color = ctx->VB->ColorPtr->data[pvert];
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
if (ctx->Line.StippleFlag) {
GLfloat *pbs = ctx->PB->s[0];
GLfloat *pbt = ctx->PB->t[0];
GLfloat *pbu = ctx->PB->u[0];
- GLubyte *color = ctx->VB->ColorPtr->data[pv];
+ GLchan *color = ctx->VB->ColorPtr->data[pv];
PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
count = ctx->PB->count;
GLfloat *pbs = ctx->PB->s[0];
GLfloat *pbt = ctx->PB->t[0];
GLfloat *pbu = ctx->PB->u[0];
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
+ GLchan (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert;
ctx->PB->mono = GL_FALSE;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
GLfixed *pbfog = ctx->PB->fog;
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
- GLubyte (*pbspec)[3] = ctx->PB->spec;
+ GLchan (*pbrgba)[4] = ctx->PB->rgba;
+ GLchan (*pbspec)[3] = ctx->PB->spec;
+
(void) pvert;
ctx->PB->mono = GL_FALSE;
GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z;
GLfixed *pbfog = ctx->PB->fog;
- GLubyte (*pbrgba)[4] = ctx->PB->rgba;
- GLubyte (*pbspec)[3] = ctx->PB->spec;
- GLubyte *color = ctx->VB->ColorPtr->data[pvert];
- GLubyte sRed = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0;
- GLubyte sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0;
- GLubyte sBlue = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0;
+ GLchan (*pbrgba)[4] = ctx->PB->rgba;
+ GLchan (*pbspec)[3] = ctx->PB->spec;
+ GLchan *color = ctx->VB->ColorPtr->data[pvert];
+ GLchan sRed = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0;
+ GLchan sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0;
+ GLchan sBlue = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0;
(void) pvert;
-/* $Id: macros.h,v 1.9 2000/09/17 21:56:07 brianp Exp $ */
+/* $Id: macros.h,v 1.10 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
} while (0)
+#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC)
+
+
/* Assign scalers to short vectors: */
#define ASSIGN_2V( V, V0, V1 ) \
do { \
#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) )
+/* XXX chan fix me */
+#define CHAN_TO_FLOAT(C) ( (GLfloat) ((C) * (1.0 / CHAN_MAXF)) )
+
#endif
-/* $Id: pixel.c,v 1.13 2000/10/19 20:09:47 brianp Exp $ */
+/* $Id: pixel.c,v 1.14 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
_mesa_lookup_rgba(const struct gl_color_table *table,
GLuint n, GLfloat rgba[][4])
{
- ASSERT(table->TableType == GL_FLOAT);
+ ASSERT(table->FloatTable);
if (!table->Table)
return;
switch (table->Format) {
case GL_INTENSITY:
/* replace RGBA with I */
- if (table->TableType == GL_UNSIGNED_BYTE) {
+ if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
const GLubyte *lut = (const GLubyte *) table->Table;
GLuint i;
break;
case GL_LUMINANCE:
/* replace RGB with L */
- if (table->TableType == GL_UNSIGNED_BYTE) {
+ if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
const GLubyte *lut = (const GLubyte *) table->Table;
GLuint i;
break;
case GL_ALPHA:
/* replace A with A */
- if (table->TableType == GL_UNSIGNED_BYTE) {
+ if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
const GLubyte *lut = (const GLubyte *) table->Table;
GLuint i;
break;
case GL_LUMINANCE_ALPHA:
/* replace RGBA with LLLA */
- if (table->TableType == GL_UNSIGNED_BYTE) {
+ if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
const GLubyte *lut = (const GLubyte *) table->Table;
GLuint i;
break;
case GL_RGB:
/* replace RGB with RGB */
- if (table->TableType == GL_UNSIGNED_BYTE) {
+ if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
const GLubyte *lut = (const GLubyte *) table->Table;
GLuint i;
break;
case GL_RGBA:
/* replace RGBA with RGBA */
- if (table->TableType == GL_UNSIGNED_BYTE) {
+ if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
const GLubyte *lut = (const GLubyte *) table->Table;
GLuint i;
-/* $Id: points.c,v 1.16 2000/10/27 16:44:41 keithw Exp $ */
+/* $Id: points.c,v 1.17 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint y = (GLint) VB->Win.data[i][1];
GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
GLfloat dsize=psize*dist[i];
- GLubyte alpha;
-
+ GLchan alpha;
GLfixed fog = FloatToFixed( VB->FogCoordPtr->data[i] );
if (dsize >= ctx->Point.Threshold) {
-/* $Id: rastpos.c,v 1.8 2000/09/30 18:42:29 brianp Exp $ */
+/* $Id: rastpos.c,v 1.9 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
else {
/* use current color or index */
if (ctx->Visual.RGBAflag) {
- UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
- ctx->Current.ByteColor);
+ CHAN_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
+ ctx->Current.ByteColor);
}
else {
ctx->Current.RasterIndex = ctx->Current.Index;
-/* $Id: teximage.c,v 1.52 2000/10/16 23:43:12 brianp Exp $ */
+/* $Id: teximage.c,v 1.53 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint srcRow = 7 - i % 8;
for (j = 0; j < texImage->Width; j++) {
GLint srcCol = j % 32;
- GLint texel = (message[srcRow][srcCol]=='X') ? 255 : 70;
+ GLint texel = (message[srcRow][srcCol]=='X') ? CHAN_MAX : 70;
for (k=0;k<components;k++) {
*imgPtr++ = (GLubyte) texel;
}
case GL_ALPHA:
src = texImage->Data + row * width * sizeof(GLubyte);
for (i = 0; i < width; i++) {
- rgba[i][RCOMP] = 255;
- rgba[i][GCOMP] = 255;
- rgba[i][BCOMP] = 255;
+ rgba[i][RCOMP] = CHAN_MAX;
+ rgba[i][GCOMP] = CHAN_MAX;
+ rgba[i][BCOMP] = CHAN_MAX;
rgba[i][ACOMP] = src[i];
}
break;
rgba[i][RCOMP] = src[i];
rgba[i][GCOMP] = src[i];
rgba[i][BCOMP] = src[i];
- rgba[i][ACOMP] = 255;
+ rgba[i][ACOMP] = CHAN_MAX;
}
break;
case GL_LUMINANCE_ALPHA:
rgba[i][RCOMP] = src[i];
rgba[i][GCOMP] = src[i];
rgba[i][BCOMP] = src[i];
- rgba[i][ACOMP] = 255;
+ rgba[i][ACOMP] = CHAN_MAX;
}
break;
case GL_RGB:
rgba[i][RCOMP] = src[i*3+0];
rgba[i][GCOMP] = src[i*3+1];
rgba[i][BCOMP] = src[i*3+2];
- rgba[i][ACOMP] = 255;
+ rgba[i][ACOMP] = CHAN_MAX;
}
break;
case GL_COLOR_INDEX:
-/* $Id: texstate.c,v 1.16 2000/08/01 17:33:53 brianp Exp $ */
+/* $Id: texstate.c,v 1.17 2000/10/28 18:34:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
break;
case GL_TEXTURE_BORDER_COLOR:
- texObj->BorderColor[0] = (GLubyte) CLAMP((GLint)(params[0]*255.0), 0, 255);
- texObj->BorderColor[1] = (GLubyte) CLAMP((GLint)(params[1]*255.0), 0, 255);
- texObj->BorderColor[2] = (GLubyte) CLAMP((GLint)(params[2]*255.0), 0, 255);
- texObj->BorderColor[3] = (GLubyte) CLAMP((GLint)(params[3]*255.0), 0, 255);
+ 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);
break;
case GL_TEXTURE_MIN_LOD:
texObj->MinLod = params[0];
*params = ENUM_TO_FLOAT(obj->WrapR);
break;
case GL_TEXTURE_BORDER_COLOR:
- params[0] = obj->BorderColor[0] / 255.0F;
- params[1] = obj->BorderColor[1] / 255.0F;
- params[2] = obj->BorderColor[2] / 255.0F;
- params[3] = obj->BorderColor[3] / 255.0F;
+ params[0] = obj->BorderColor[0] / CHAN_MAXF;
+ params[1] = obj->BorderColor[1] / CHAN_MAXF;
+ params[2] = obj->BorderColor[2] / CHAN_MAXF;
+ params[3] = obj->BorderColor[3] / CHAN_MAXF;
break;
case GL_TEXTURE_RESIDENT:
{
case GL_TEXTURE_BORDER_COLOR:
{
GLfloat color[4];
- color[0] = obj->BorderColor[0] / 255.0F;
- color[1] = obj->BorderColor[1] / 255.0F;
- color[2] = obj->BorderColor[2] / 255.0F;
- color[3] = obj->BorderColor[3] / 255.0F;
+ color[0] = obj->BorderColor[0] / CHAN_MAXF;
+ color[1] = obj->BorderColor[1] / CHAN_MAXF;
+ color[2] = obj->BorderColor[2] / CHAN_MAXF;
+ color[3] = obj->BorderColor[3] / CHAN_MAXF;
params[0] = FLOAT_TO_INT( color[0] );
params[1] = FLOAT_TO_INT( color[1] );
params[2] = FLOAT_TO_INT( color[2] );