From fa4525e289b475b928a7b2c4055af9dd7fe46600 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Aug 2000 14:22:24 +0000 Subject: [PATCH] implemented new ImageTransferState bitmask --- src/mesa/main/attrib.c | 3 +- src/mesa/main/context.c | 4 +- src/mesa/main/enable.c | 12 ++- src/mesa/main/image.c | 246 +++++++++++++++++++++-------------------------- src/mesa/main/image.h | 16 +-- src/mesa/main/pixel.c | 27 +----- src/mesa/main/state.c | 62 +++++++++++- src/mesa/main/state.h | 18 ++-- src/mesa/main/teximage.c | 127 ++++++++++++++++-------- 9 files changed, 289 insertions(+), 226 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index be0a644..8c40063 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $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 @@ -806,6 +806,7 @@ _mesa_PopAttrib(void) } ctx->NewState = NEW_ALL; + ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 5adbeb8..9933076 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $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 @@ -1036,7 +1036,6 @@ init_attrib_groups( GLcontext *ctx ) 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; @@ -1283,6 +1282,7 @@ init_attrib_groups( GLcontext *ctx ) 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; diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 0fa408f..537d2dd 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $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 @@ -476,34 +476,44 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* 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 */ diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 6d4464d..49ea1d5 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,8 +1,8 @@ -/* $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. * @@ -604,31 +604,23 @@ _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, * 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; @@ -662,49 +654,51 @@ _mesa_pack_rgba_span( GLcontext *ctx, /* * 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;iVisual->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) ); @@ -2280,13 +2263,11 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, 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) { @@ -2306,43 +2287,43 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, 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); } } @@ -2471,7 +2452,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, 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 || @@ -2519,16 +2500,6 @@ _mesa_unpack_float_color_span( GLcontext *ctx, /* 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]; @@ -2549,13 +2520,11 @@ _mesa_unpack_float_color_span( GLcontext *ctx, 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) { @@ -2575,43 +2544,43 @@ _mesa_unpack_float_color_span( GLcontext *ctx, 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); } } @@ -2666,11 +2635,11 @@ _mesa_unpack_float_color_span( GLcontext *ctx, 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; @@ -2736,8 +2705,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, /* * 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 @@ -2747,14 +2715,14 @@ _mesa_unpack_float_color_span( GLcontext *ctx, * 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 || @@ -2769,16 +2737,17 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, 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)); } @@ -2792,15 +2761,13 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, 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 */ @@ -2835,8 +2802,7 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, /* * 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 @@ -2846,14 +2812,14 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, * 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 || @@ -2868,17 +2834,21 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, 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 { @@ -2891,8 +2861,8 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, 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); } @@ -2942,7 +2912,7 @@ 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 ) { GLfloat *depth = MALLOC(n * sizeof(GLfloat)); if (!depth) diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index 1526491..c9a3aab 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -1,8 +1,8 @@ -/* $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. * @@ -84,7 +84,7 @@ _mesa_pack_rgba_span( GLcontext *ctx, GLuint n, CONST GLubyte rgba[][4], GLenum format, GLenum type, GLvoid *dest, const struct gl_pixelstore_attrib *packing, - GLboolean applyTransferOps ); + GLuint transferOps ); extern void @@ -93,7 +93,7 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *unpacking, - GLboolean applyTransferOps ); + GLuint transferOps ); extern void @@ -102,7 +102,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx, GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *unpacking, - GLboolean applyTransferOps, GLboolean clamp ); + GLuint transferOps, GLboolean clamp ); extern void @@ -110,7 +110,7 @@ _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 ); extern void @@ -118,14 +118,14 @@ _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 ); 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 * diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 7d5d23e..8c839b8 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1,4 +1,4 @@ -/* $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 @@ -610,29 +610,8 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) 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; } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 8f52c9f..90cb072 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,8 +1,8 @@ -/* $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. * @@ -1230,3 +1230,61 @@ void gl_update_state( GLcontext *ctx ) 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; +} diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 55d7b4c..640c21d 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -1,8 +1,8 @@ -/* $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. * @@ -37,15 +37,17 @@ _mesa_init_no_op_table(struct _glapi_table *exec, GLuint tableSize); 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 diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 98f62c8..14f9c60 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,7 +1,8 @@ +/* $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. * @@ -33,6 +34,7 @@ #include "mem.h" #include "mmath.h" #include "span.h" +#include "state.h" #include "teximage.h" #include "texstate.h" #include "types.h" @@ -688,7 +690,7 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, * 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) @@ -730,10 +732,11 @@ make_texture_image( GLcontext *ctx, * 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) || @@ -799,7 +802,8 @@ make_texture_image( GLcontext *ctx, 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; } } @@ -810,12 +814,14 @@ make_texture_image( GLcontext *ctx, 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; } } @@ -1384,12 +1390,14 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, /* 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, @@ -1397,7 +1405,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, } 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 */ @@ -1493,12 +1501,14 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, /* 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, @@ -1506,7 +1516,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, } 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 */ @@ -1612,12 +1622,14 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, 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, @@ -1625,7 +1637,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, } 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 */ @@ -1755,7 +1767,7 @@ _mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level, 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; } @@ -1767,7 +1779,7 @@ _mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level, 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; } @@ -1870,6 +1882,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, 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, @@ -1880,7 +1895,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, 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 */ @@ -1944,7 +1960,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, 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 ); } } @@ -1983,9 +2000,10 @@ _mesa_TexSubImage1D( GLenum target, GLint level, 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 ); @@ -2012,15 +2030,18 @@ _mesa_TexSubImage1D( GLenum target, GLint level, 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) { @@ -2066,8 +2087,10 @@ _mesa_TexSubImage2D( GLenum target, GLint level, 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 ); @@ -2102,7 +2125,8 @@ _mesa_TexSubImage2D( GLenum target, GLint level, 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; } @@ -2114,9 +2138,12 @@ _mesa_TexSubImage2D( GLenum target, GLint level, 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; } @@ -2177,8 +2204,10 @@ _mesa_TexSubImage3D( GLenum target, GLint level, 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 ); @@ -2208,7 +2237,8 @@ _mesa_TexSubImage3D( GLenum target, GLint level, + 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; } @@ -2224,7 +2254,10 @@ _mesa_TexSubImage3D( GLenum target, GLint level, + 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; } @@ -2302,8 +2335,10 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, 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)) { @@ -2341,8 +2376,10 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, 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)) { @@ -2379,8 +2416,10 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, 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; @@ -2424,8 +2463,10 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, 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; @@ -2469,8 +2510,10 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, 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; -- 2.7.4