More minor GLchan changes.
Silence some compiler warnings in cva.[ch]
-/* $Id: osmesa.c,v 1.23 2000/10/29 18:23:28 brianp Exp $ */
+/* $Id: osmesa.c,v 1.24 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void clear_color( GLcontext *ctx,
- GLubyte r, GLubyte g, GLubyte b, GLubyte a )
+ GLchan r, GLchan g, GLchan b, GLchan a )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
osmesa->clearpixel = PACK_RGBA( r, g, b, a );
static void set_color( GLcontext *ctx,
- GLubyte r, GLubyte g, GLubyte b, GLubyte a )
+ GLchan r, GLchan g, GLchan b, GLchan a )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
osmesa->pixel = PACK_RGBA( r, g, b, a );
/* Write RGBA pixels to an RGBA (or permuted) buffer. */
static void write_rgba_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- CONST GLubyte rgba[][4], const GLubyte mask[] )
+ CONST GLchan rgba[][4], const GLubyte mask[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint *ptr4 = PIXELADDR4( x, y );
/* Write RGBA pixels to an RGBA buffer. This is the fastest span-writer. */
static void write_rgba_span_rgba( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- CONST GLubyte rgba[][4],
+ CONST GLchan rgba[][4],
const GLubyte mask[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
/* Write RGB pixels to an RGBA (or permuted) buffer. */
static void write_rgb_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- CONST GLubyte rgb[][3], const GLubyte mask[] )
+ CONST GLchan rgb[][3], const GLubyte mask[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint *ptr4 = PIXELADDR4( x, y );
static void write_rgba_pixels( 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[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint i;
static void read_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
+ GLchan rgba[][4] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint i;
/* Read RGBA pixels from an RGBA buffer */
static void read_rgba_span_rgba( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
+ GLchan rgba[][4] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint *ptr4 = PIXELADDR4(x,y);
- MEMCPY( rgba, ptr4, n * 4 * sizeof(GLubyte) );
+ MEMCPY( rgba, ptr4, n * 4 * sizeof(GLchan) );
}
static void read_rgba_pixels( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
+ GLchan rgba[][4], const GLubyte mask[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint i;
/* Write RGBA pixels to an RGB or BGR buffer. */
static void write_rgba_span3( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- CONST GLubyte rgba[][4], const GLubyte mask[] )
+ CONST GLchan rgba[][4], const GLubyte mask[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLubyte *ptr3 = PIXELADDR3( x, y);
/* Write RGB pixels to an RGB or BGR buffer. */
static void write_rgb_span3( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- CONST GLubyte rgb[][3], const GLubyte mask[] )
+ CONST GLchan rgb[][3], const GLubyte mask[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLubyte *ptr3 = PIXELADDR3( x, y);
static void write_rgba_pixels3( 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[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint i;
static void read_rgba_span3( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
+ GLchan rgba[][4] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint i;
static void read_rgba_pixels3( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
+ GLchan rgba[][4], const GLubyte mask[] )
{
OSMesaContext osmesa = (OSMesaContext) ctx;
GLuint i;
-/* $Id: attrib.c,v 1.31 2000/10/30 13:31:59 keithw Exp $ */
+/* $Id: attrib.c,v 1.32 2000/10/30 16:32:42 brianp Exp $ */
/*
* Mesa 3-D graphics library
FREE( attr );
attr = next;
}
-
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
}
-/* $Id: blend.c,v 1.22 2000/10/30 13:31:59 keithw Exp $ */
+/* $Id: blend.c,v 1.23 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s) / 255;
const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s) / 255;
#else
+#if CHAN_BITS == 8
/* 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);
const GLint b = DIV255(rgba[i][BCOMP] * t + dest[i][BCOMP] * s);
const GLint a = DIV255(rgba[i][ACOMP] * t + dest[i][ACOMP] * s);
#undef DIV255
+#else
+ const GLint s = CHAN_MAX - t;
+ const GLint r = (rgba[i][RCOMP] * t + dest[i][RCOMP] * s) / CHAN_MAX;
+ const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s) / CHAN_MAX;
+ const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s) / CHAN_MAX;
+ const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s) / CHAN_MAX;
+#endif
#endif
ASSERT(r <= CHAN_MAX);
ASSERT(g <= CHAN_MAX);
void
_mesa_blend_pixels( GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLchan mask[] )
+ GLchan rgba[][4], const GLubyte mask[] )
{
GLchan dest[PB_SIZE][4];
-/* $Id: buffers.c,v 1.16 2000/10/30 13:31:59 keithw Exp $ */
+/* $Id: buffers.c,v 1.17 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT(ctx->Color.IndexMask == ~0);
if (ctx->Visual.IndexBits == 8) {
/* 8-bit clear */
- GLchan span[MAX_WIDTH];
+ GLubyte span[MAX_WIDTH];
GLint i;
MEMSET(span, ctx->Color.ClearIndex, width);
for (i = 0; i < height; i++) {
-/* $Id: context.c,v 1.99 2000/10/30 13:32:00 keithw Exp $ */
+/* $Id: context.c,v 1.100 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->StippleCounter = 0;
ctx->NeedNormals = GL_FALSE;
ctx->DoViewportMapping = GL_TRUE;
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
+ ctx->ImageTransferState = 0;
ctx->NeedEyeCoords = GL_FALSE;
ctx->NeedEyeNormals = GL_FALSE;
-/* $Id: drawpix.c,v 1.42 2000/10/29 19:02:23 brianp Exp $ */
+/* $Id: drawpix.c,v 1.43 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
gl_update_state(ctx);
}
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
-
x = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
-/* $Id: enable.c,v 1.29 2000/10/30 13:32:00 keithw Exp $ */
+/* $Id: enable.c,v 1.30 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
case GL_COLOR_TABLE_SGI:
/* XXX check for extension */
ctx->Pixel.ColorTableEnabled = state;
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NewState |= _NEW_PIXEL;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
ctx->Pixel.PostConvolutionColorTableEnabled = state;
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NewState |= _NEW_PIXEL;
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
ctx->Pixel.PostColorMatrixColorTableEnabled = state;
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NewState |= _NEW_PIXEL;
break;
case GL_CONVOLUTION_1D:
/* XXX check for extension */
ctx->Pixel.Convolution1DEnabled = state;
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NewState |= _NEW_PIXEL;
break;
case GL_CONVOLUTION_2D:
ctx->Pixel.Convolution2DEnabled = state;
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NewState |= _NEW_PIXEL;
break;
case GL_SEPARABLE_2D:
ctx->Pixel.Separable2DEnabled = state;
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NewState |= _NEW_PIXEL;
break;
-/* $Id: fog.h,v 1.7 2000/10/28 18:34:48 brianp Exp $ */
+/* $Id: fog.h,v 1.8 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
extern 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] );
extern void
_mesa_depth_fog_ci_pixels( const GLcontext *ctx,
-/* $Id: image.c,v 1.45 2000/10/29 18:12:15 brianp Exp $ */
+/* $Id: image.c,v 1.46 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
const struct gl_pixelstore_attrib *dstPacking,
GLuint transferOps)
{
- ASSERT(ctx->ImageTransferState != UPDATE_IMAGE_TRANSFER_STATE);
+ ASSERT((ctx->NewState & _NEW_PIXEL) == 0);
/* Test for optimized case first */
if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) {
-/* $Id: pixel.c,v 1.17 2000/10/30 13:32:01 keithw Exp $ */
+/* $Id: pixel.c,v 1.18 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
/* signal to recompute the bitmask */
- ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NewState |= _NEW_PIXEL;
}
GLuint gmask = ctx->Pixel.MapItoGsize - 1;
GLuint bmask = ctx->Pixel.MapItoBsize - 1;
GLuint amask = ctx->Pixel.MapItoAsize - 1;
- const GLfloat *rMap = ctx->Pixel.MapItoR8;
- const GLfloat *gMap = ctx->Pixel.MapItoG8;
- const GLfloat *bMap = ctx->Pixel.MapItoB8;
- const GLfloat *aMap = ctx->Pixel.MapItoA8;
+ const GLfloat *rMap = ctx->Pixel.MapItoR;
+ const GLfloat *gMap = ctx->Pixel.MapItoG;
+ const GLfloat *bMap = ctx->Pixel.MapItoB;
+ const GLfloat *aMap = ctx->Pixel.MapItoA;
GLuint i;
for (i=0;i<n;i++) {
rgba[i][RCOMP] = FLOAT_TO_CHAN(rMap[index[i] & rmask]);
-/* $Id: state.c,v 1.37 2000/10/30 13:32:01 keithw Exp $ */
+/* $Id: state.c,v 1.38 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (MESA_VERBOSE & VERBOSE_STATE)
gl_print_state("", ctx->NewState);
+ if (ctx->NewState & _NEW_PIXEL)
+ _mesa_update_image_transfer_state(ctx);
+
if (ctx->NewState & _NEW_ARRAY)
gl_update_client_state( ctx );
-/* $Id: teximage.c,v 1.56 2000/10/30 13:32:01 keithw Exp $ */
+/* $Id: teximage.c,v 1.57 2000/10/30 16:32:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLint components = components_in_intformat(internalFormat);
GLint convWidth = width, convHeight = height;
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE) {
- _mesa_update_image_transfer_state(ctx);
- }
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (ctx->ImageTransferState & IMAGE_CONVOLUTION_BIT) {
adjust_texture_size_for_convolution(ctx, dimensions,
/* setup the teximage struct's fields */
init_texture_image(ctx, texImage, postConvWidth, 1, 1, border, internalFormat);
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
/* process the texture image */
if (pixels) {
init_texture_image(ctx, texImage, postConvWidth, postConvHeight,
1, border, internalFormat);
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
/* process the texture image */
if (pixels) {
init_texture_image(ctx, texImage, width, height, depth,
border, internalFormat);
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
/* process the texture image */
if (pixels) {
GLint depth = texImage->Depth;
GLint img, row;
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (ctx->ImageTransferState & IMAGE_CONVOLUTION_BIT) {
/* convert texture image to GL_RGBA, GL_FLOAT */
if (width == 0 || !pixels)
return; /* no-op, not an error */
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (!ctx->ImageTransferState && ctx->Driver.TexSubImage1D) {
success = (*ctx->Driver.TexSubImage1D)( ctx, target, level, xoffset,
if (width == 0 || height == 0 || !pixels)
return; /* no-op, not an error */
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (!ctx->ImageTransferState && ctx->Driver.TexSubImage2D) {
success = (*ctx->Driver.TexSubImage2D)( ctx, target, level, xoffset,
if (width == 0 || height == 0 || height == 0 || !pixels)
return; /* no-op, not an error */
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (!ctx->ImageTransferState && ctx->Driver.TexSubImage3D) {
success = (*ctx->Driver.TexSubImage3D)( ctx, target, level, xoffset,
width, 1, border))
return;
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (ctx->ImageTransferState || !ctx->Driver.CopyTexImage1D
|| !(*ctx->Driver.CopyTexImage1D)(ctx, target, level,
width, height, border))
return;
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (ctx->ImageTransferState || !ctx->Driver.CopyTexImage2D
|| !(*ctx->Driver.CopyTexImage2D)(ctx, target, level,
xoffset, 0, 0, width, 1))
return;
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage1D
|| !(*ctx->Driver.CopyTexSubImage1D)(ctx, target, level,
xoffset, yoffset, 0, width, height))
return;
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage2D
|| !(*ctx->Driver.CopyTexSubImage2D)(ctx, target, level,
xoffset, yoffset, zoffset, width, height))
return;
- if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
- _mesa_update_image_transfer_state(ctx);
+ if (ctx->NewState & _NEW_PIXEL)
+ gl_update_state(ctx);
if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage3D
|| !(*ctx->Driver.CopyTexSubImage3D)(ctx, target, level,