-/* $Id: attrib.c,v 1.25 2000/07/19 18:34:00 brianp Exp $ */
+/* $Id: attrib.c,v 1.26 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
ctx->NewState = NEW_ALL;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
}
-/* $Id: context.c,v 1.79 2000/07/19 20:58:59 brianp Exp $ */
+/* $Id: context.c,v 1.80 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
ctx->Pixel.BlueScale = 1.0;
ctx->Pixel.AlphaBias = 0.0;
ctx->Pixel.AlphaScale = 1.0;
- ctx->Pixel.ScaleOrBiasRGBA = GL_FALSE;
ctx->Pixel.DepthBias = 0.0;
ctx->Pixel.DepthScale = 1.0;
ctx->Pixel.IndexOffset = 0;
ctx->StippleCounter = 0;
ctx->NeedNormals = GL_FALSE;
ctx->DoViewportMapping = GL_TRUE;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
ctx->NeedEyeCoords = GL_FALSE;
ctx->NeedEyeNormals = GL_FALSE;
-/* $Id: enable.c,v 1.21 2000/05/23 15:17:12 brianp Exp $ */
+/* $Id: enable.c,v 1.22 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* GL_SGIS_pixel_texture */
case GL_PIXEL_TEXTURE_SGIS:
+ /* XXX check for extension */
ctx->Pixel.PixelTextureEnabled = state;
break;
/* GL_SGIX_pixel_texture */
case GL_PIXEL_TEX_GEN_SGIX:
+ /* XXX check for extension */
ctx->Pixel.PixelTextureEnabled = state;
break;
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
+ /* XXX check for extension */
ctx->Pixel.ColorTableEnabled = state;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
ctx->Pixel.PostConvolutionColorTableEnabled = state;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
break;
/* GL_EXT_convolution */
case GL_CONVOLUTION_1D:
+ /* XXX check for extension */
ctx->Pixel.Convolution1DEnabled = state;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
break;
case GL_CONVOLUTION_2D:
ctx->Pixel.Convolution2DEnabled = state;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
break;
case GL_SEPARABLE_2D:
ctx->Pixel.Separable2DEnabled = state;
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
break;
/* GL_ARB_texture_cube_map */
-/* $Id: image.c,v 1.35 2000/06/30 22:12:00 brianp Exp $ */
+/* $Id: image.c,v 1.36 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* type - dest packing datatype
* destination - destination packing address
* packing - pixel packing parameters
- * applyTransferOps - apply scale/bias/lookup-table ops?
+ * transferOps - bitmask of IMAGE_*_BIT operations to apply
*/
void
_mesa_pack_rgba_span( GLcontext *ctx,
GLuint n, CONST GLubyte srcRgba[][4],
GLenum format, GLenum type, GLvoid *destination,
const struct gl_pixelstore_attrib *packing,
- GLboolean applyTransferOps )
+ GLuint transferOps)
{
- applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA ||
- ctx->Pixel.MapColorFlag ||
- ctx->ColorMatrix.type != MATRIX_IDENTITY ||
- ctx->Pixel.ScaleOrBiasRGBApcm ||
- ctx->Pixel.ColorTableEnabled ||
- ctx->Pixel.PostColorMatrixColorTableEnabled ||
- ctx->Pixel.PostConvolutionColorTableEnabled ||
- ctx->Pixel.MinMaxEnabled ||
- ctx->Pixel.HistogramEnabled);
+ ASSERT(ctx->ImageTransferState != UPDATE_IMAGE_TRANSFER_STATE);
/* Test for optimized case first */
- if (!applyTransferOps && format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
+ if (transferOps == 0 && format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
/* common simple case */
MEMCPY( destination, srcRgba, n * 4 * sizeof(GLubyte) );
}
- else if (!applyTransferOps && format == GL_RGB && type == GL_UNSIGNED_BYTE) {
+ else if (transferOps == 0 && format == GL_RGB && type == GL_UNSIGNED_BYTE) {
/* common simple case */
GLint i;
GLubyte *dest = (GLubyte *) destination;
/*
* Apply scale, bias and lookup-tables if enabled.
*/
- if (applyTransferOps) {
+ if (transferOps) {
/* scale & bias */
- if (ctx->Pixel.ScaleOrBiasRGBA) {
+ if (transferOps & IMAGE_SCALE_BIAS_BIT) {
_mesa_scale_and_bias_rgba( ctx, n, rgba );
}
/* color map lookup */
- if (ctx->Pixel.MapColorFlag) {
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
_mesa_map_rgba( ctx, n, rgba );
}
/* GL_COLOR_TABLE lookup */
- if (ctx->Pixel.ColorTableEnabled) {
+ if (transferOps & IMAGE_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba);
}
- /* XXX convolution here */
+ /* convolution */
+ if (transferOps & IMAGE_CONVOLUTION_BIT) {
+ /* XXX to do */
+ }
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
- if (ctx->Pixel.PostConvolutionColorTableEnabled) {
+ if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba);
}
/* color matrix transform */
- if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
- ctx->Pixel.ScaleOrBiasRGBApcm) {
+ if (transferOps & IMAGE_COLOR_MATRIX_BIT) {
_mesa_transform_rgba(ctx, n, rgba);
}
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */
- if (ctx->Pixel.PostColorMatrixColorTableEnabled) {
+ if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba);
}
/* update histogram count */
- if (ctx->Pixel.HistogramEnabled) {
+ if (transferOps & IMAGE_HISTOGRAM_BIT) {
_mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba);
}
- /* XXX min/max here */
- if (ctx->Pixel.MinMaxEnabled) {
+ /* min/max here */
+ if (transferOps & IMAGE_MIN_MAX_BIT) {
_mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba);
if (ctx->MinMax.Sink)
return;
}
}
- if (format==GL_LUMINANCE || format==GL_LUMINANCE_ALPHA) {
- for (i=0;i<n;i++) {
+ if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) {
+ for (i = 0; i < n; i++) {
GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
- luminance[i] = CLAMP( sum, 0.0F, 1.0F );
+ luminance[i] = CLAMP(sum, 0.0F, 1.0F);
}
}
/*
* Unpack a row of color image data from a client buffer according to
- * the pixel unpacking parameters. Apply any enabled pixel transfer
- * ops (PixelMap, scale/bias) if the applyTransferOps flag is enabled.
+ * the pixel unpacking parameters.
* Return GLubyte values in the specified dest image format.
* This is (or will be) used by glDrawPixels and glTexImage?D().
* Input: ctx - the context
* srcType - source image datatype
* source - source image pointer
* unpacking - pixel unpacking parameters
- * applyTransferOps - apply scale/bias/lookup-table ops?
+ * transferOps - bitmask of IMAGE_*_BIT values of operations to apply
*
* XXX perhaps expand this to process whole images someday.
*/
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps )
+ GLuint transferOps )
{
ASSERT(dstFormat == GL_ALPHA ||
dstFormat == GL_LUMINANCE ||
/* this is intended for RGBA mode only */
assert(ctx->Visual->RGBAflag);
- applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA ||
- ctx->Pixel.MapColorFlag ||
- ctx->ColorMatrix.type != MATRIX_IDENTITY ||
- ctx->Pixel.ScaleOrBiasRGBApcm ||
- ctx->Pixel.ColorTableEnabled ||
- ctx->Pixel.PostColorMatrixColorTableEnabled ||
- ctx->Pixel.PostConvolutionColorTableEnabled ||
- ctx->Pixel.MinMaxEnabled ||
- ctx->Pixel.HistogramEnabled);
-
/* Try simple cases first */
- if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE) {
+ if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE) {
if (dstFormat == GL_RGBA) {
if (srcFormat == GL_RGBA) {
MEMCPY( dest, source, n * 4 * sizeof(GLubyte) );
extract_uint_indexes(n, indexes, srcFormat, srcType, source,
unpacking);
- if (applyTransferOps) {
- if (ctx->Pixel.MapColorFlag) {
- _mesa_map_ci(ctx, n, indexes);
- }
- if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) {
- _mesa_shift_and_offset_ci(ctx, n, indexes);
- }
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ _mesa_map_ci(ctx, n, indexes);
+ }
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ _mesa_shift_and_offset_ci(ctx, n, indexes);
}
if (dstFormat == GL_COLOR_INDEX) {
extract_float_rgba(n, rgba, srcFormat, srcType, source,
unpacking->SwapBytes);
- if (applyTransferOps) {
- /* scale and bias colors */
- if (ctx->Pixel.ScaleOrBiasRGBA) {
- _mesa_scale_and_bias_rgba(ctx, n, rgba);
- }
- /* color map lookup */
- if (ctx->Pixel.MapColorFlag) {
- _mesa_map_rgba(ctx, n, rgba);
- }
+ /* scale and bias colors */
+ if (transferOps & IMAGE_SCALE_BIAS_BIT) {
+ _mesa_scale_and_bias_rgba(ctx, n, rgba);
+ }
+ /* color map lookup */
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ _mesa_map_rgba(ctx, n, rgba);
}
}
- if (applyTransferOps) {
+ if (transferOps) {
/* GL_COLOR_TABLE lookup */
- if (ctx->Pixel.ColorTableEnabled) {
+ if (transferOps & IMAGE_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba);
}
- /* XXX convolution here */
+ /* convolution */
+ if (transferOps & IMAGE_CONVOLUTION_BIT) {
+ /* XXX to do */
+ }
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
- if (ctx->Pixel.PostConvolutionColorTableEnabled) {
+ if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba);
}
/* color matrix transform */
- if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
- ctx->Pixel.ScaleOrBiasRGBApcm) {
+ if (transferOps & IMAGE_COLOR_MATRIX_BIT) {
_mesa_transform_rgba(ctx, n, rgba);
}
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */
- if (ctx->Pixel.PostColorMatrixColorTableEnabled) {
+ if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba);
}
/* update histogram count */
- if (ctx->Pixel.HistogramEnabled) {
+ if (transferOps & IMAGE_HISTOGRAM_BIT) {
_mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba);
}
- /* XXX min/max here */
- if (ctx->Pixel.MinMaxEnabled) {
+ /* min/max here */
+ if (transferOps & IMAGE_MIN_MAX_BIT) {
_mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba);
}
}
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps, GLboolean clamp )
+ GLuint transferOps, GLboolean clamp )
{
ASSERT(dstFormat == GL_ALPHA ||
dstFormat == GL_LUMINANCE ||
/* this is intended for RGBA mode only */
assert(ctx->Visual->RGBAflag);
- applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA ||
- ctx->Pixel.MapColorFlag ||
- ctx->ColorMatrix.type != MATRIX_IDENTITY ||
- ctx->Pixel.ScaleOrBiasRGBApcm ||
- ctx->Pixel.ColorTableEnabled ||
- ctx->Pixel.PostColorMatrixColorTableEnabled ||
- ctx->Pixel.PostConvolutionColorTableEnabled ||
- ctx->Pixel.MinMaxEnabled ||
- ctx->Pixel.HistogramEnabled);
-
/* general solution, no special cases, yet */
{
GLfloat rgba[MAX_WIDTH][4];
extract_uint_indexes(n, indexes, srcFormat, srcType, source,
unpacking);
- if (applyTransferOps) {
- if (ctx->Pixel.MapColorFlag) {
- _mesa_map_ci(ctx, n, indexes);
- }
- if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) {
- _mesa_shift_and_offset_ci(ctx, n, indexes);
- }
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ _mesa_map_ci(ctx, n, indexes);
+ }
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ _mesa_shift_and_offset_ci(ctx, n, indexes);
}
if (dstFormat == GL_COLOR_INDEX) {
extract_float_rgba(n, rgba, srcFormat, srcType, source,
unpacking->SwapBytes);
- if (applyTransferOps) {
- /* scale and bias colors */
- if (ctx->Pixel.ScaleOrBiasRGBA) {
- _mesa_scale_and_bias_rgba(ctx, n, rgba);
- }
- /* color map lookup */
- if (ctx->Pixel.MapColorFlag) {
- _mesa_map_rgba(ctx, n, rgba);
- }
+ /* scale and bias colors */
+ if (transferOps & IMAGE_SCALE_BIAS_BIT) {
+ _mesa_scale_and_bias_rgba(ctx, n, rgba);
+ }
+ /* color map lookup */
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ _mesa_map_rgba(ctx, n, rgba);
}
}
- if (applyTransferOps) {
+ if (transferOps) {
/* GL_COLOR_TABLE lookup */
- if (ctx->Pixel.ColorTableEnabled) {
+ if (transferOps & IMAGE_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba);
}
- /* XXX convolution here */
+ /* convolution */
+ if (transferOps & IMAGE_CONVOLUTION_BIT) {
+ /* XXX to do */
+ }
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
- if (ctx->Pixel.PostConvolutionColorTableEnabled) {
+ if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba);
}
/* color matrix transform */
- if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
- ctx->Pixel.ScaleOrBiasRGBApcm) {
+ if (transferOps & IMAGE_COLOR_MATRIX_BIT) {
_mesa_transform_rgba(ctx, n, rgba);
}
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */
- if (ctx->Pixel.PostColorMatrixColorTableEnabled) {
+ if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) {
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba);
}
/* update histogram count */
- if (ctx->Pixel.HistogramEnabled) {
+ if (transferOps & IMAGE_HISTOGRAM_BIT) {
_mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba);
}
- /* XXX min/max here */
- if (ctx->Pixel.MinMaxEnabled) {
+ /* min/max here */
+ if (transferOps & IMAGE_MIN_MAX_BIT) {
_mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba);
}
}
dstLuminanceIndex = dstIntensityIndex = -1;
break;
default:
- gl_problem(ctx, "bad dstFormat in _mesa_unpack_float_span()");
+ gl_problem(ctx, "bad dstFormat in _mesa_unpack_float_color_span()");
return;
}
- /* Now pack results in teh requested dstFormat */
+ /* Now pack results in the requested dstFormat */
if (dstRedIndex >= 0) {
GLfloat *dst = dest;
GLuint i;
/*
* Unpack a row of color index data from a client buffer according to
- * the pixel unpacking parameters. Apply pixel transfer ops if enabled
- * and applyTransferOps is true.
+ * the pixel unpacking parameters.
* This is (or will be) used by glDrawPixels, glTexImage[123]D, etc.
*
* Args: ctx - the context
* srcType - source pixel type
* source - source data pointer
* unpacking - pixel unpacking parameters
- * applyTransferOps - apply offset/bias/lookup ops?
+ * transferOps - the pixel transfer operations to apply
*/
void
_mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps )
+ GLuint transferOps )
{
ASSERT(srcType == GL_BITMAP ||
srcType == GL_UNSIGNED_BYTE ||
dstType == GL_UNSIGNED_SHORT ||
dstType == GL_UNSIGNED_INT);
- applyTransferOps &= (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset || ctx->Pixel.MapColorFlag);
+
+ transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT);
/*
* Try simple cases first
*/
- if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE
+ if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE
&& dstType == GL_UNSIGNED_BYTE) {
MEMCPY(dest, source, n * sizeof(GLubyte));
}
- else if (!applyTransferOps && srcType == GL_UNSIGNED_INT
+ else if (transferOps == 0 && srcType == GL_UNSIGNED_INT
&& dstType == GL_UNSIGNED_INT && !unpacking->SwapBytes) {
MEMCPY(dest, source, n * sizeof(GLuint));
}
extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source,
unpacking);
- if (applyTransferOps) {
- if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) {
- /* shift and offset indexes */
- _mesa_shift_and_offset_ci(ctx, n, indexes);
- }
- if (ctx->Pixel.MapColorFlag) {
- /* Apply lookup table */
- _mesa_map_ci(ctx, n, indexes);
- }
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
+ /* shift and offset indexes */
+ _mesa_shift_and_offset_ci(ctx, n, indexes);
+ }
+ if (transferOps & IMAGE_MAP_COLOR_BIT) {
+ /* Apply lookup table */
+ _mesa_map_ci(ctx, n, indexes);
}
/* convert to dest type */
/*
* Unpack a row of stencil data from a client buffer according to
- * the pixel unpacking parameters. Apply pixel transfer ops if enabled
- * and applyTransferOps is true.
+ * the pixel unpacking parameters.
* This is (or will be) used by glDrawPixels
*
* Args: ctx - the context
* srcType - source pixel type
* source - source data pointer
* unpacking - pixel unpacking parameters
- * applyTransferOps - apply offset/bias/lookup ops?
+ * transferOps - apply offset/bias/lookup ops?
*/
void
_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps )
+ GLuint transferOps )
{
ASSERT(srcType == GL_BITMAP ||
srcType == GL_UNSIGNED_BYTE ||
dstType == GL_UNSIGNED_SHORT ||
dstType == GL_UNSIGNED_INT);
- applyTransferOps &= (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset || ctx->Pixel.MapColorFlag);
+ /* only shift and offset apply to stencil */
+ transferOps &= IMAGE_SHIFT_OFFSET_BIT;
/*
* Try simple cases first
*/
- if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE
- && dstType == GL_UNSIGNED_BYTE) {
+ if (transferOps == 0 &&
+ srcType == GL_UNSIGNED_BYTE &&
+ dstType == GL_UNSIGNED_BYTE) {
MEMCPY(dest, source, n * sizeof(GLubyte));
}
- else if (!applyTransferOps && srcType == GL_UNSIGNED_INT
- && dstType == GL_UNSIGNED_INT && !unpacking->SwapBytes) {
+ else if (transferOps == 0 &&
+ srcType == GL_UNSIGNED_INT &&
+ dstType == GL_UNSIGNED_INT &&
+ !unpacking->SwapBytes) {
MEMCPY(dest, source, n * sizeof(GLuint));
}
else {
extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source,
unpacking);
- if (applyTransferOps) {
- if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) {
+ if (transferOps) {
+ if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
/* shift and offset indexes */
_mesa_shift_and_offset_ci(ctx, n, indexes);
}
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps )
+ GLuint transferOps )
{
GLfloat *depth = MALLOC(n * sizeof(GLfloat));
if (!depth)
-/* $Id: image.h,v 1.9 2000/05/10 14:39:53 brianp Exp $ */
+/* $Id: image.h,v 1.10 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
GLuint n, CONST GLubyte rgba[][4],
GLenum format, GLenum type, GLvoid *dest,
const struct gl_pixelstore_attrib *packing,
- GLboolean applyTransferOps );
+ GLuint transferOps );
extern void
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps );
+ GLuint transferOps );
extern void
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps, GLboolean clamp );
+ GLuint transferOps, GLboolean clamp );
extern void
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps );
+ GLuint transferOps );
extern void
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps );
+ GLuint transferOps );
extern void
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *unpacking,
- GLboolean applyTransferOps );
+ GLuint transferOps );
extern void *
-/* $Id: pixel.c,v 1.11 2000/05/07 20:41:30 brianp Exp $ */
+/* $Id: pixel.c,v 1.12 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
return;
}
- if (ctx->Pixel.RedScale!=1.0F || ctx->Pixel.RedBias!=0.0F ||
- ctx->Pixel.GreenScale!=1.0F || ctx->Pixel.GreenBias!=0.0F ||
- ctx->Pixel.BlueScale!=1.0F || ctx->Pixel.BlueBias!=0.0F ||
- ctx->Pixel.AlphaScale!=1.0F || ctx->Pixel.AlphaBias!=0.0F) {
- ctx->Pixel.ScaleOrBiasRGBA = GL_TRUE;
- }
- else {
- ctx->Pixel.ScaleOrBiasRGBA = GL_FALSE;
- }
-
- if (ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[0] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[1] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[2] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[3] != 0.0F) {
- ctx->Pixel.ScaleOrBiasRGBApcm = GL_TRUE;
- }
- else {
- ctx->Pixel.ScaleOrBiasRGBApcm = GL_FALSE;
- }
+ /* signal to recompute the bitmask */
+ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE;
}
-/* $Id: state.c,v 1.21 2000/06/30 14:14:37 brianp Exp $ */
+/* $Id: state.c,v 1.22 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
gl_update_pipelines(ctx);
ctx->NewState = 0;
}
+
+
+
+
+/*
+ * Return a bitmask of IMAGE_*_BIT flags which to indicate which
+ * pixel transfer operations are enabled.
+ */
+void
+_mesa_update_image_transfer_state(GLcontext *ctx)
+{
+ GLuint mask = 0;
+
+ if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F ||
+ ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
+ ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F ||
+ ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
+ mask |= IMAGE_SCALE_BIAS_BIT;
+
+ if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
+ mask |= IMAGE_SHIFT_OFFSET_BIT;
+
+ if (ctx->Pixel.MapColorFlag)
+ mask |= IMAGE_MAP_COLOR_BIT;
+
+ if (ctx->Pixel.ColorTableEnabled)
+ mask |= IMAGE_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.Convolution1DEnabled ||
+ ctx->Pixel.Convolution2DEnabled ||
+ ctx->Pixel.Separable2DEnabled)
+ mask |= IMAGE_CONVOLUTION_BIT;
+
+ if (ctx->Pixel.PostConvolutionColorTableEnabled)
+ mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
+
+ if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
+ ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[0] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[1] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[2] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
+ mask |= IMAGE_COLOR_MATRIX_BIT;
+
+ if (ctx->Pixel.PostColorMatrixColorTableEnabled)
+ mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.HistogramEnabled)
+ mask |= IMAGE_HISTOGRAM_BIT;
+
+ if (ctx->Pixel.MinMaxEnabled)
+ mask |= IMAGE_MIN_MAX_BIT;
+
+ ctx->ImageTransferState = mask;
+}
-/* $Id: state.h,v 1.2 2000/05/24 15:04:45 brianp Exp $ */
+/* $Id: state.h,v 1.3 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
extern void
_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize);
+extern void
+gl_update_state( GLcontext *ctx );
-extern void gl_update_state( GLcontext *ctx );
-
+extern void
+gl_print_state( const char *msg, GLuint state );
-/* for debugging */
-extern void gl_print_state( const char *msg, GLuint state );
+extern void
+gl_print_enable_flags( const char *msg, GLuint flags );
-/* for debugging */
-extern void gl_print_enable_flags( const char *msg, GLuint flags );
+extern void
+_mesa_update_image_transfer_state(GLcontext *ctx);
#endif
+/* $Id: teximage.c,v 1.40 2000/08/21 14:22:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
#include "mem.h"
#include "mmath.h"
#include "span.h"
+#include "state.h"
#include "teximage.h"
#include "texstate.h"
#include "types.h"
* NOTE: All texture image parameters should have already been error checked.
*/
static void
-make_texture_image( GLcontext *ctx,
+make_texture_image( GLcontext *ctx, GLint dimensions,
struct gl_texture_image *texImage,
GLenum srcFormat, GLenum srcType, const GLvoid *pixels,
const struct gl_pixelstore_attrib *unpacking)
* This includes applying the pixel transfer operations.
*/
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
/* try common 2D texture cases first */
- if (!ctx->Pixel.ScaleOrBiasRGBA && !ctx->Pixel.MapColorFlag
- && !ctx->Pixel.IndexOffset && !ctx->Pixel.IndexShift
- && srcType == GL_UNSIGNED_BYTE && depth == 1) {
+ if (!ctx->ImageTransferState && srcType == GL_UNSIGNED_BYTE && depth == 1) {
if (srcFormat == internalFormat ||
(srcFormat == GL_LUMINANCE && internalFormat == 1) ||
const GLvoid *source = _mesa_image_address(unpacking,
pixels, width, height, srcFormat, srcType, img, row, 0);
_mesa_unpack_index_span(ctx, width, dstType, dest,
- srcType, source, unpacking, GL_TRUE);
+ srcType, source, unpacking,
+ ctx->ImageTransferState);
dest += destBytesPerRow;
}
}
const GLenum dstFormat = texImage->Format;
GLubyte *dest = texImage->Data;
GLint img, row;
+ /* XXX convolution */
for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) {
const GLvoid *source = _mesa_image_address(unpacking,
pixels, width, height, srcFormat, srcType, img, row, 0);
_mesa_unpack_ubyte_color_span(ctx, width, dstFormat, dest,
- srcFormat, srcType, source, unpacking, GL_TRUE);
+ srcFormat, srcType, source,
+ unpacking, ctx->ImageTransferState);
dest += destBytesPerRow;
}
}
/* setup the teximage struct's fields */
init_texture_image(texImage, width, 1, 1, border, internalFormat);
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
/* process the texture image */
if (pixels) {
GLboolean retain = GL_TRUE;
GLboolean success = GL_FALSE;
- if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA
- && ctx->Driver.TexImage1D) {
+ if (!ctx->ImageTransferState && ctx->Driver.TexImage1D) {
/* let device driver try to use raw image */
success = (*ctx->Driver.TexImage1D)( ctx, target, level, format,
type, pixels, &ctx->Unpack,
}
if (retain || !success) {
/* make internal copy of the texture image */
- make_texture_image(ctx, texImage, format, type,
+ make_texture_image(ctx, 1, texImage, format, type,
pixels, &ctx->Unpack);
if (!success && ctx->Driver.TexImage1D) {
/* let device driver try to use unpacked image */
/* setup the teximage struct's fields */
init_texture_image(texImage, width, height, 1, border, internalFormat);
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
/* process the texture image */
if (pixels) {
GLboolean retain = GL_TRUE;
GLboolean success = GL_FALSE;
- if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA
- && ctx->Driver.TexImage2D) {
+ if (!ctx->ImageTransferState && ctx->Driver.TexImage2D) {
/* let device driver try to use raw image */
success = (*ctx->Driver.TexImage2D)( ctx, target, level, format,
type, pixels, &ctx->Unpack,
}
if (retain || !success) {
/* make internal copy of the texture image */
- make_texture_image(ctx, texImage, format, type,
+ make_texture_image(ctx, 2, texImage, format, type,
pixels, &ctx->Unpack);
if (!success && ctx->Driver.TexImage2D) {
/* let device driver try to use unpacked image */
init_texture_image(texImage, width, height, depth,
border, internalFormat);
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
/* process the texture image */
if (pixels) {
GLboolean retain = GL_TRUE;
GLboolean success = GL_FALSE;
- if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA
- && ctx->Driver.TexImage3D) {
+ if (!ctx->ImageTransferState && ctx->Driver.TexImage3D) {
/* let device driver try to use raw image */
success = (*ctx->Driver.TexImage3D)( ctx, target, level, format,
type, pixels, &ctx->Unpack,
}
if (retain || !success) {
/* make internal copy of the texture image */
- make_texture_image(ctx, texImage, format, type,
+ make_texture_image(ctx, 3, texImage, format, type,
pixels, &ctx->Unpack);
if (!success && ctx->Driver.TexImage3D) {
/* let device driver try to use unpacked image */
for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) {
_mesa_unpack_index_span(ctx, width, dstType, destPtr,
- imgType, srcPtr, &_mesa_native_packing, GL_FALSE);
+ imgType, srcPtr, &_mesa_native_packing, 0);
destPtr += destBytesPerRow;
srcPtr += srcBytesPerRow;
}
for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) {
_mesa_unpack_ubyte_color_span(ctx, width, dstFormat, destPtr,
- imgFormat, imgType, srcPtr, &_mesa_native_packing, GL_FALSE);
+ imgFormat, imgType, srcPtr, &_mesa_native_packing, 0);
destPtr += destBytesPerRow;
srcPtr += srcBytesPerRow;
}
GLint height = texImage->Height;
GLint row;
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
for (row = 0; row < height; row++) {
/* compute destination address in client memory */
GLvoid *dest = _mesa_image_address( &ctx->Unpack, pixels,
if (texImage->Format == GL_RGBA) {
const GLubyte *src = texImage->Data + row * width * 4 * sizeof(GLubyte);
_mesa_pack_rgba_span( ctx, width, (CONST GLubyte (*)[4]) src,
- format, type, dest, &ctx->Pack, GL_TRUE );
+ format, type, dest, &ctx->Pack,
+ ctx->ImageTransferState );
}
else {
/* fetch RGBA row from texture image then pack it in client mem */
gl_problem( ctx, "bad format in gl_GetTexImage" );
}
_mesa_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba,
- format, type, dest, &ctx->Pack, GL_TRUE );
+ format, type, dest, &ctx->Pack,
+ ctx->ImageTransferState );
}
}
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->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA
- && ctx->Driver.TexSubImage1D) {
+ if (!ctx->ImageTransferState && ctx->Driver.TexSubImage1D) {
success = (*ctx->Driver.TexSubImage1D)( ctx, target, level, xoffset,
width, format, type, pixels,
&ctx->Unpack, texObj, texImage );
const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width,
1, format, type, 0, 0, 0);
_mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst,
- type, src, &ctx->Unpack, GL_TRUE);
+ type, src, &ctx->Unpack,
+ ctx->ImageTransferState);
}
else {
/* color texture */
GLubyte *dst = texImage->Data + xoffsetb * texComponents;
const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width,
1, format, type, 0, 0, 0);
+ /* XXX change for convolution */
_mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, format,
- type, src, &ctx->Unpack, GL_TRUE);
+ type, src, &ctx->Unpack,
+ ctx->ImageTransferState);
}
if (ctx->Driver.TexImage1D) {
if (width == 0 || height == 0 || !pixels)
return; /* no-op, not an error */
- if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA
- && ctx->Driver.TexSubImage2D) {
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
+ if (!ctx->ImageTransferState && ctx->Driver.TexSubImage2D) {
success = (*ctx->Driver.TexSubImage2D)( ctx, target, level, xoffset,
yoffset, width, height, format, type,
pixels, &ctx->Unpack, texObj, texImage );
GLint row;
for (row = 0; row < height; row++) {
_mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, type,
- (const GLvoid *) src, &ctx->Unpack, GL_TRUE);
+ (const GLvoid *) src, &ctx->Unpack,
+ ctx->ImageTransferState);
src += srcStride;
dst += dstStride;
}
const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels,
width, height, format, type, 0, 0, 0);
GLint row;
+ /* XXX change for convolution */
for (row = 0; row < height; row++) {
_mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, format,
- type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE);
+ type, (const GLvoid *) src,
+ &ctx->Unpack,
+ ctx->ImageTransferState);
src += srcStride;
dst += dstStride;
}
if (width == 0 || height == 0 || height == 0 || !pixels)
return; /* no-op, not an error */
- if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA
- && ctx->Driver.TexSubImage3D) {
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
+ if (!ctx->ImageTransferState && ctx->Driver.TexSubImage3D) {
success = (*ctx->Driver.TexSubImage3D)( ctx, target, level, xoffset,
yoffset, zoffset, width, height, depth, format,
type, pixels, &ctx->Unpack, texObj, texImage );
+ yoffsetb * texWidth + xoffsetb) * texComponents;
for (row = 0; row < height; row++) {
_mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst,
- type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE);
+ type, (const GLvoid *) src,
+ &ctx->Unpack, ctx->ImageTransferState);
src += srcStride;
dst += dstStride;
}
+ yoffsetb * texWidth + xoffsetb) * texComponents;
for (row = 0; row < height; row++) {
_mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst,
- format, type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE);
+ format, type,
+ (const GLvoid *) src,
+ &ctx->Unpack,
+ ctx->ImageTransferState);
src += srcStride;
dst += dstStride;
}
width, 1, border))
return;
- if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA
- || !ctx->Driver.CopyTexImage1D
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
+ if (ctx->ImageTransferState || !ctx->Driver.CopyTexImage1D
|| !(*ctx->Driver.CopyTexImage1D)(ctx, target, level,
internalFormat, x, y, width, border))
{
width, height, border))
return;
- if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA
- || !ctx->Driver.CopyTexImage2D
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
+ if (ctx->ImageTransferState || !ctx->Driver.CopyTexImage2D
|| !(*ctx->Driver.CopyTexImage2D)(ctx, target, level,
internalFormat, x, y, width, height, border))
{
xoffset, 0, 0, width, 1))
return;
- if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA
- || !ctx->Driver.CopyTexSubImage1D
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
+ if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage1D
|| !(*ctx->Driver.CopyTexSubImage1D)(ctx, target, level,
xoffset, x, y, width)) {
struct gl_texture_unit *texUnit;
xoffset, yoffset, 0, width, height))
return;
- if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA
- || !ctx->Driver.CopyTexSubImage2D
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
+ if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage2D
|| !(*ctx->Driver.CopyTexSubImage2D)(ctx, target, level,
xoffset, yoffset, x, y, width, height )) {
struct gl_texture_unit *texUnit;
xoffset, yoffset, zoffset, width, height))
return;
- if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA
- || !ctx->Driver.CopyTexSubImage3D
+ if (ctx->ImageTransferState == UPDATE_IMAGE_TRANSFER_STATE)
+ _mesa_update_image_transfer_state(ctx);
+
+ if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage3D
|| !(*ctx->Driver.CopyTexSubImage3D)(ctx, target, level,
xoffset, yoffset, zoffset, x, y, width, height )) {
struct gl_texture_unit *texUnit;