summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/get.c60
-rw-r--r--src/mesa/main/get_gen.py20
-rw-r--r--src/mesa/main/image.c12
-rw-r--r--src/mesa/main/mtypes.h121
-rw-r--r--src/mesa/main/pixel.c218
5 files changed, 228 insertions, 203 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9b2a42f7c1..7601f32069 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -677,34 +677,34 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection);
break;
case GL_PIXEL_MAP_A_TO_A_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapAtoAsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.AtoA.Size);
break;
case GL_PIXEL_MAP_B_TO_B_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapBtoBsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.BtoB.Size);
break;
case GL_PIXEL_MAP_G_TO_G_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapGtoGsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.GtoG.Size);
break;
case GL_PIXEL_MAP_I_TO_A_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoAsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoA.Size);
break;
case GL_PIXEL_MAP_I_TO_B_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoBsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoB.Size);
break;
case GL_PIXEL_MAP_I_TO_G_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoGsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoG.Size);
break;
case GL_PIXEL_MAP_I_TO_I_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoIsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoI.Size);
break;
case GL_PIXEL_MAP_I_TO_R_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoRsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoR.Size);
break;
case GL_PIXEL_MAP_R_TO_R_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapRtoRsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.RtoR.Size);
break;
case GL_PIXEL_MAP_S_TO_S_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapStoSsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.StoS.Size);
break;
case GL_POINT_SIZE:
params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size);
@@ -2504,34 +2504,34 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
break;
case GL_PIXEL_MAP_A_TO_A_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapAtoAsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.AtoA.Size);
break;
case GL_PIXEL_MAP_B_TO_B_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapBtoBsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.BtoB.Size);
break;
case GL_PIXEL_MAP_G_TO_G_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapGtoGsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.GtoG.Size);
break;
case GL_PIXEL_MAP_I_TO_A_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoAsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoA.Size);
break;
case GL_PIXEL_MAP_I_TO_B_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoBsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoB.Size);
break;
case GL_PIXEL_MAP_I_TO_G_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoGsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoG.Size);
break;
case GL_PIXEL_MAP_I_TO_I_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoIsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoI.Size);
break;
case GL_PIXEL_MAP_I_TO_R_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoRsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoR.Size);
break;
case GL_PIXEL_MAP_R_TO_R_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapRtoRsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.RtoR.Size);
break;
case GL_PIXEL_MAP_S_TO_S_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapStoSsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.StoS.Size);
break;
case GL_POINT_SIZE:
params[0] = ctx->Point.Size;
@@ -4331,34 +4331,34 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection);
break;
case GL_PIXEL_MAP_A_TO_A_SIZE:
- params[0] = ctx->Pixel.MapAtoAsize;
+ params[0] = ctx->PixelMaps.AtoA.Size;
break;
case GL_PIXEL_MAP_B_TO_B_SIZE:
- params[0] = ctx->Pixel.MapBtoBsize;
+ params[0] = ctx->PixelMaps.BtoB.Size;
break;
case GL_PIXEL_MAP_G_TO_G_SIZE:
- params[0] = ctx->Pixel.MapGtoGsize;
+ params[0] = ctx->PixelMaps.GtoG.Size;
break;
case GL_PIXEL_MAP_I_TO_A_SIZE:
- params[0] = ctx->Pixel.MapItoAsize;
+ params[0] = ctx->PixelMaps.ItoA.Size;
break;
case GL_PIXEL_MAP_I_TO_B_SIZE:
- params[0] = ctx->Pixel.MapItoBsize;
+ params[0] = ctx->PixelMaps.ItoB.Size;
break;
case GL_PIXEL_MAP_I_TO_G_SIZE:
- params[0] = ctx->Pixel.MapItoGsize;
+ params[0] = ctx->PixelMaps.ItoG.Size;
break;
case GL_PIXEL_MAP_I_TO_I_SIZE:
- params[0] = ctx->Pixel.MapItoIsize;
+ params[0] = ctx->PixelMaps.ItoI.Size;
break;
case GL_PIXEL_MAP_I_TO_R_SIZE:
- params[0] = ctx->Pixel.MapItoRsize;
+ params[0] = ctx->PixelMaps.ItoR.Size;
break;
case GL_PIXEL_MAP_R_TO_R_SIZE:
- params[0] = ctx->Pixel.MapRtoRsize;
+ params[0] = ctx->PixelMaps.RtoR.Size;
break;
case GL_PIXEL_MAP_S_TO_S_SIZE:
- params[0] = ctx->Pixel.MapStoSsize;
+ params[0] = ctx->PixelMaps.StoS.Size;
break;
case GL_POINT_SIZE:
params[0] = IROUND(ctx->Point.Size);
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index c18216d4a8..76417d2899 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -337,16 +337,16 @@ StateVars = [
( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ),
( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
["ctx->Hint.PerspectiveCorrection"], "", None ),
- ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->Pixel.MapAtoAsize"], "", None ),
- ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->Pixel.MapBtoBsize"], "", None ),
- ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->Pixel.MapGtoGsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->Pixel.MapItoAsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->Pixel.MapItoBsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->Pixel.MapItoGsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->Pixel.MapItoIsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->Pixel.MapItoRsize"], "", None ),
- ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->Pixel.MapRtoRsize"], "", None ),
- ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->Pixel.MapStoSsize"], "", None ),
+ ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", None ),
+ ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", None ),
+ ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", None ),
+ ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", None ),
+ ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", None ),
( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
( "GL_POINT_SIZE_GRANULARITY", GLfloat,
["ctx->Const.PointSizeGranularity"], "", None ),
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index a60f4d3f4d..cdcf49886a 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1129,11 +1129,11 @@ _mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps,
shift_and_offset_ci(ctx, n, indexes);
}
if (transferOps & IMAGE_MAP_COLOR_BIT) {
- const GLuint mask = ctx->Pixel.MapItoIsize - 1;
+ const GLuint mask = ctx->PixelMaps.ItoI.Size - 1;
GLuint i;
for (i = 0; i < n; i++) {
const GLuint j = indexes[i] & mask;
- indexes[i] = IROUND(ctx->Pixel.MapItoI[j]);
+ indexes[i] = IROUND(ctx->PixelMaps.ItoI.Map[j]);
}
}
}
@@ -1169,10 +1169,10 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
}
}
if (ctx->Pixel.MapStencilFlag) {
- GLuint mask = ctx->Pixel.MapStoSsize - 1;
+ GLuint mask = ctx->PixelMaps.StoS.Size - 1;
GLuint i;
for (i = 0; i < n; i++) {
- stencil[i] = ctx->Pixel.MapStoS[ stencil[i] & mask ];
+ stencil[i] = ctx->PixelMaps.StoS.Map[ stencil[i] & mask ];
}
}
}
@@ -3691,10 +3691,10 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
if (ctx->Pixel.MapStencilFlag) {
/* Apply stencil lookup table */
- GLuint mask = ctx->Pixel.MapStoSsize - 1;
+ GLuint mask = ctx->PixelMaps.StoS.Size - 1;
GLuint i;
for (i=0;i<n;i++) {
- indexes[i] = ctx->Pixel.MapStoS[ indexes[i] & mask ];
+ indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ];
}
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7caa1f8d7f..bced1a64d9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -965,74 +965,104 @@ struct gl_multisample_attrib
/**
+ * A pixelmap (see glPixelMap)
+ */
+struct gl_pixelmap
+{
+ GLint Size;
+ GLfloat Map[MAX_PIXEL_MAP_TABLE];
+ GLubyte Map8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */
+};
+
+
+/**
+ * Collection of all pixelmaps
+ */
+struct gl_pixelmaps
+{
+ struct gl_pixelmap RtoR; /**< i.e. GL_PIXEL_MAP_R_TO_R */
+ struct gl_pixelmap GtoG;
+ struct gl_pixelmap BtoB;
+ struct gl_pixelmap AtoA;
+ struct gl_pixelmap ItoR;
+ struct gl_pixelmap ItoG;
+ struct gl_pixelmap ItoB;
+ struct gl_pixelmap ItoA;
+ struct gl_pixelmap ItoI;
+ struct gl_pixelmap StoS;
+};
+
+
+/**
* Pixel attribute group (GL_PIXEL_MODE_BIT).
*/
struct gl_pixel_attrib
{
GLenum ReadBuffer; /**< source buffer for glRead/CopyPixels() */
+
+ /*--- Begin Pixel Transfer State ---*/
+ /* Fields are in the order in which they're applied... */
+
+ /* Scale & Bias (index shift, offset) */
GLfloat RedBias, RedScale;
GLfloat GreenBias, GreenScale;
GLfloat BlueBias, BlueScale;
GLfloat AlphaBias, AlphaScale;
GLfloat DepthBias, DepthScale;
GLint IndexShift, IndexOffset;
+
+ /* Pixel Maps */
+ /* Note: actual pixel maps are not part of this attrib group */
GLboolean MapColorFlag;
GLboolean MapStencilFlag;
- GLfloat ZoomX, ZoomY;
- /* XXX move these out of gl_pixel_attrib */
- GLint MapStoSsize; /**< Size of each pixel map */
- GLint MapItoIsize;
- GLint MapItoRsize;
- GLint MapItoGsize;
- GLint MapItoBsize;
- GLint MapItoAsize;
- GLint MapRtoRsize;
- GLint MapGtoGsize;
- GLint MapBtoBsize;
- GLint MapAtoAsize;
- GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /**< Pixel map tables */
- GLfloat MapItoI[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoR[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoG[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoB[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoA[MAX_PIXEL_MAP_TABLE];
- GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */
- GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE];
- GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE];
- GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE];
- GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE];
- GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE];
- GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE];
- GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE];
- /** GL_EXT_histogram */
- GLboolean HistogramEnabled;
- GLboolean MinMaxEnabled;
- /** GL_SGI_color_matrix */
- GLfloat PostColorMatrixScale[4]; /**< RGBA */
- GLfloat PostColorMatrixBias[4]; /**< RGBA */
- /** GL_SGI_color_table */
+
+ /* Color table lookup (GL_SGI_color_table) */
+ /* Note: actual table is not part of this attrib group */
GLfloat ColorTableScale[4];
GLfloat ColorTableBias[4];
GLboolean ColorTableEnabled;
- GLfloat PCCTscale[4];
- GLfloat PCCTbias[4];
- GLboolean PostConvolutionColorTableEnabled;
- GLfloat PCMCTscale[4];
- GLfloat PCMCTbias[4];
- GLboolean PostColorMatrixColorTableEnabled;
- /** GL_SGI_texture_color_table */
- GLfloat TextureColorTableScale[4];
- GLfloat TextureColorTableBias[4];
- /** Convolution */
+
+ /* Convolution (GL_EXT_convolution) */
GLboolean Convolution1DEnabled;
GLboolean Convolution2DEnabled;
GLboolean Separable2DEnabled;
GLfloat ConvolutionBorderColor[3][4];
GLenum ConvolutionBorderMode[3];
- GLfloat ConvolutionFilterScale[3][4];
- GLfloat ConvolutionFilterBias[3][4];
+ GLfloat ConvolutionFilterScale[3][4]; /**< RGBA */
+ GLfloat ConvolutionFilterBias[3][4]; /**< RGBA */
GLfloat PostConvolutionScale[4]; /**< RGBA */
GLfloat PostConvolutionBias[4]; /**< RGBA */
+
+ /* Post-convolution color table */
+ /* Note: actual table is not part of this attrib group */
+ GLboolean PostConvolutionColorTableEnabled;
+ GLfloat PCCTscale[4]; /** Post Convolution Color Table scale */
+ GLfloat PCCTbias[4]; /** Post Convolution Color Table bias */
+
+ /* Color matrix (GL_SGI_color_matrix) */
+ /* Note: the color matrix is not part of this attrib group */
+ GLfloat PostColorMatrixScale[4]; /**< RGBA */
+ GLfloat PostColorMatrixBias[4]; /**< RGBA */
+
+ /* Post color matrix color table */
+ /* Note: actual table is not part of this attrib group */
+ GLboolean PostColorMatrixColorTableEnabled;
+ GLfloat PCMCTscale[4]; /** Post Color Matrix Color Table scale */
+ GLfloat PCMCTbias[4]; /** Post Color Matrix Color Table bias */
+
+ /* Histogram & minmax (GL_EXT_histogram) */
+ /* Note: histogram and minmax data are not part of this attrib group */
+ GLboolean HistogramEnabled;
+ GLboolean MinMaxEnabled;
+
+ /*--- End Pixel Transfer State ---*/
+
+ /* Pixel Zoom */
+ GLfloat ZoomX, ZoomY;
+
+ /** GL_SGI_texture_color_table */
+ GLfloat TextureColorTableScale[4];
+ GLfloat TextureColorTableBias[4];
};
@@ -2893,6 +2923,7 @@ struct __GLcontextRec
/** \name Other assorted state (not pushed/popped on attribute stack) */
/*@{*/
+ struct gl_pixelmaps PixelMaps;
struct gl_histogram_attrib Histogram;
struct gl_minmax_attrib MinMax;
struct gl_convolution_attrib Convolution1D;
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 4e47cdba89..a6a0ffdfa3 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -262,71 +262,71 @@ pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, const GLfloat *values)
GLint i;
switch (map) {
case GL_PIXEL_MAP_S_TO_S:
- ctx->Pixel.MapStoSsize = mapsize;
+ ctx->PixelMaps.StoS.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapStoS[i] = IROUND(values[i]);
+ ctx->PixelMaps.StoS.Map[i] = IROUND(values[i]);
}
break;
case GL_PIXEL_MAP_I_TO_I:
- ctx->Pixel.MapItoIsize = mapsize;
+ ctx->PixelMaps.ItoI.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapItoI[i] = values[i];
+ ctx->PixelMaps.ItoI.Map[i] = values[i];
}
break;
case GL_PIXEL_MAP_I_TO_R:
- ctx->Pixel.MapItoRsize = mapsize;
+ ctx->PixelMaps.ItoR.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoR[i] = val;
- ctx->Pixel.MapItoR8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoR.Map[i] = val;
+ ctx->PixelMaps.ItoR.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_I_TO_G:
- ctx->Pixel.MapItoGsize = mapsize;
+ ctx->PixelMaps.ItoG.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoG[i] = val;
- ctx->Pixel.MapItoG8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoG.Map[i] = val;
+ ctx->PixelMaps.ItoG.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_I_TO_B:
- ctx->Pixel.MapItoBsize = mapsize;
+ ctx->PixelMaps.ItoB.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoB[i] = val;
- ctx->Pixel.MapItoB8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoB.Map[i] = val;
+ ctx->PixelMaps.ItoB.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_I_TO_A:
- ctx->Pixel.MapItoAsize = mapsize;
+ ctx->PixelMaps.ItoA.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoA[i] = val;
- ctx->Pixel.MapItoA8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoA.Map[i] = val;
+ ctx->PixelMaps.ItoA.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_R_TO_R:
- ctx->Pixel.MapRtoRsize = mapsize;
+ ctx->PixelMaps.RtoR.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.RtoR.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
case GL_PIXEL_MAP_G_TO_G:
- ctx->Pixel.MapGtoGsize = mapsize;
+ ctx->PixelMaps.GtoG.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.GtoG.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
case GL_PIXEL_MAP_B_TO_B:
- ctx->Pixel.MapBtoBsize = mapsize;
+ ctx->PixelMaps.BtoB.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.BtoB.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
case GL_PIXEL_MAP_A_TO_A:
- ctx->Pixel.MapAtoAsize = mapsize;
+ ctx->PixelMaps.AtoA.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.AtoA.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
default:
@@ -551,25 +551,25 @@ get_map_size(GLcontext *ctx, GLenum map)
{
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
- return ctx->Pixel.MapItoIsize;
+ return ctx->PixelMaps.ItoI.Size;
case GL_PIXEL_MAP_S_TO_S:
- return ctx->Pixel.MapStoSsize;
+ return ctx->PixelMaps.StoS.Size;
case GL_PIXEL_MAP_I_TO_R:
- return ctx->Pixel.MapItoRsize;
+ return ctx->PixelMaps.ItoR.Size;
case GL_PIXEL_MAP_I_TO_G:
- return ctx->Pixel.MapItoGsize;
+ return ctx->PixelMaps.ItoG.Size;
case GL_PIXEL_MAP_I_TO_B:
- return ctx->Pixel.MapItoBsize;
+ return ctx->PixelMaps.ItoB.Size;
case GL_PIXEL_MAP_I_TO_A:
- return ctx->Pixel.MapItoAsize;
+ return ctx->PixelMaps.ItoA.Size;
case GL_PIXEL_MAP_R_TO_R:
- return ctx->Pixel.MapRtoRsize;
+ return ctx->PixelMaps.RtoR.Size;
case GL_PIXEL_MAP_G_TO_G:
- return ctx->Pixel.MapGtoGsize;
+ return ctx->PixelMaps.GtoG.Size;
case GL_PIXEL_MAP_B_TO_B:
- return ctx->Pixel.MapBtoBsize;
+ return ctx->PixelMaps.BtoB.Size;
case GL_PIXEL_MAP_A_TO_A:
- return ctx->Pixel.MapAtoAsize;
+ return ctx->PixelMaps.AtoA.Size;
default:
return 0;
}
@@ -615,36 +615,36 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
- MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoI.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_S_TO_S:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLfloat) ctx->Pixel.MapStoS[i];
+ values[i] = (GLfloat) ctx->PixelMaps.StoS.Map[i];
}
break;
case GL_PIXEL_MAP_I_TO_R:
- MEMCPY(values, ctx->Pixel.MapItoR, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoR.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_I_TO_G:
- MEMCPY(values, ctx->Pixel.MapItoG, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoG.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_I_TO_B:
- MEMCPY(values, ctx->Pixel.MapItoB, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoB.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_I_TO_A:
- MEMCPY(values, ctx->Pixel.MapItoA, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoA.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_R_TO_R:
- MEMCPY(values, ctx->Pixel.MapRtoR, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.RtoR.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_G_TO_G:
- MEMCPY(values, ctx->Pixel.MapGtoG, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.GtoG.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_B_TO_B:
- MEMCPY(values, ctx->Pixel.MapBtoB, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.BtoB.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_A_TO_A:
- MEMCPY(values, ctx->Pixel.MapAtoA, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.AtoA.Map, mapsize * sizeof(GLfloat));
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
@@ -697,50 +697,50 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoI[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoI.Map[i] );
}
break;
case GL_PIXEL_MAP_S_TO_S:
- MEMCPY(values, ctx->Pixel.MapStoS, mapsize * sizeof(GLint));
+ MEMCPY(values, ctx->PixelMaps.StoS.Map, mapsize * sizeof(GLint));
break;
case GL_PIXEL_MAP_I_TO_R:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoR[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoR.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_G:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoG.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_B:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoB.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_A:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoA.Map[i] );
}
break;
case GL_PIXEL_MAP_R_TO_R:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.RtoR.Map[i] );
}
break;
case GL_PIXEL_MAP_G_TO_G:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.GtoG.Map[i] );
}
break;
case GL_PIXEL_MAP_B_TO_B:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.BtoB.Map[i] );
}
break;
case GL_PIXEL_MAP_A_TO_A:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.AtoA.Map[i] );
}
break;
default:
@@ -795,52 +795,52 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->Pixel.MapItoI[i], 0.0, 65535.0);
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.ItoI.Map[i], 0.0, 65535.0);
}
break;
case GL_PIXEL_MAP_S_TO_S:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->Pixel.MapStoS[i], 0.0, 65535.0);
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.StoS.Map[i], 0.0, 65535.0);
}
break;
case GL_PIXEL_MAP_I_TO_R:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoR[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoR.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_G:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoG[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoG.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_B:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoB[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoB.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_A:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoA[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoA.Map[i] );
}
break;
case GL_PIXEL_MAP_R_TO_R:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapRtoR[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.RtoR.Map[i] );
}
break;
case GL_PIXEL_MAP_G_TO_G:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapGtoG[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.GtoG.Map[i] );
}
break;
case GL_PIXEL_MAP_B_TO_B:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapBtoB[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.BtoB.Map[i] );
}
break;
case GL_PIXEL_MAP_A_TO_A:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapAtoA[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.AtoA.Map[i] );
}
break;
default:
@@ -1113,14 +1113,14 @@ _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
void
_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
{
- const GLfloat rscale = (GLfloat) (ctx->Pixel.MapRtoRsize - 1);
- const GLfloat gscale = (GLfloat) (ctx->Pixel.MapGtoGsize - 1);
- const GLfloat bscale = (GLfloat) (ctx->Pixel.MapBtoBsize - 1);
- const GLfloat ascale = (GLfloat) (ctx->Pixel.MapAtoAsize - 1);
- const GLfloat *rMap = ctx->Pixel.MapRtoR;
- const GLfloat *gMap = ctx->Pixel.MapGtoG;
- const GLfloat *bMap = ctx->Pixel.MapBtoB;
- const GLfloat *aMap = ctx->Pixel.MapAtoA;
+ const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1);
+ const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1);
+ const GLfloat bscale = (GLfloat) (ctx->PixelMaps.BtoB.Size - 1);
+ const GLfloat ascale = (GLfloat) (ctx->PixelMaps.AtoA.Size - 1);
+ const GLfloat *rMap = ctx->PixelMaps.RtoR.Map;
+ const GLfloat *gMap = ctx->PixelMaps.GtoG.Map;
+ const GLfloat *bMap = ctx->PixelMaps.BtoB.Map;
+ const GLfloat *aMap = ctx->PixelMaps.AtoA.Map;
GLuint i;
for (i=0;i<n;i++) {
GLfloat r = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
@@ -1413,14 +1413,14 @@ void
_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n,
const GLuint index[], GLfloat rgba[][4] )
{
- GLuint rmask = ctx->Pixel.MapItoRsize - 1;
- GLuint gmask = ctx->Pixel.MapItoGsize - 1;
- GLuint bmask = ctx->Pixel.MapItoBsize - 1;
- GLuint amask = ctx->Pixel.MapItoAsize - 1;
- 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 rmask = ctx->PixelMaps.ItoR.Size - 1;
+ GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
+ GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
+ GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
+ const GLfloat *rMap = ctx->PixelMaps.ItoR.Map;
+ const GLfloat *gMap = ctx->PixelMaps.ItoG.Map;
+ const GLfloat *bMap = ctx->PixelMaps.ItoB.Map;
+ const GLfloat *aMap = ctx->PixelMaps.ItoA.Map;
GLuint i;
for (i=0;i<n;i++) {
rgba[i][RCOMP] = rMap[index[i] & rmask];
@@ -1438,14 +1438,14 @@ void
_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
GLubyte rgba[][4])
{
- GLuint rmask = ctx->Pixel.MapItoRsize - 1;
- GLuint gmask = ctx->Pixel.MapItoGsize - 1;
- GLuint bmask = ctx->Pixel.MapItoBsize - 1;
- GLuint amask = ctx->Pixel.MapItoAsize - 1;
- const GLubyte *rMap = ctx->Pixel.MapItoR8;
- const GLubyte *gMap = ctx->Pixel.MapItoG8;
- const GLubyte *bMap = ctx->Pixel.MapItoB8;
- const GLubyte *aMap = ctx->Pixel.MapItoA8;
+ GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
+ GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
+ GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
+ GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
+ const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8;
+ const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8;
+ const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8;
+ const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8;
GLuint i;
for (i=0;i<n;i++) {
rgba[i][RCOMP] = rMap[index[i] & rmask];
@@ -1558,6 +1558,14 @@ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
/***** Initialization *****/
/**********************************************************************/
+static void
+init_pixelmap(struct gl_pixelmap *map)
+{
+ map->Size = 1;
+ map->Map[0] = 0.0;
+ map->Map8[0] = 0;
+}
+
/**
* Initialize the context's PIXEL attribute group.
@@ -1584,30 +1592,16 @@ _mesa_init_pixel( GLcontext *ctx )
ctx->Pixel.ZoomY = 1.0;
ctx->Pixel.MapColorFlag = GL_FALSE;
ctx->Pixel.MapStencilFlag = GL_FALSE;
- ctx->Pixel.MapStoSsize = 1;
- ctx->Pixel.MapItoIsize = 1;
- ctx->Pixel.MapItoRsize = 1;
- ctx->Pixel.MapItoGsize = 1;
- ctx->Pixel.MapItoBsize = 1;
- ctx->Pixel.MapItoAsize = 1;
- ctx->Pixel.MapRtoRsize = 1;
- ctx->Pixel.MapGtoGsize = 1;
- ctx->Pixel.MapBtoBsize = 1;
- ctx->Pixel.MapAtoAsize = 1;
- ctx->Pixel.MapStoS[0] = 0;
- ctx->Pixel.MapItoI[0] = 0.0;
- ctx->Pixel.MapItoR[0] = 0.0;
- ctx->Pixel.MapItoG[0] = 0.0;
- ctx->Pixel.MapItoB[0] = 0.0;
- ctx->Pixel.MapItoA[0] = 0.0;
- ctx->Pixel.MapItoR8[0] = 0;
- ctx->Pixel.MapItoG8[0] = 0;
- ctx->Pixel.MapItoB8[0] = 0;
- ctx->Pixel.MapItoA8[0] = 0;
- ctx->Pixel.MapRtoR[0] = 0.0;
- ctx->Pixel.MapGtoG[0] = 0.0;
- ctx->Pixel.MapBtoB[0] = 0.0;
- ctx->Pixel.MapAtoA[0] = 0.0;
+ init_pixelmap(&ctx->PixelMaps.StoS);
+ init_pixelmap(&ctx->PixelMaps.ItoI);
+ init_pixelmap(&ctx->PixelMaps.ItoR);
+ init_pixelmap(&ctx->PixelMaps.ItoG);
+ init_pixelmap(&ctx->PixelMaps.ItoB);
+ init_pixelmap(&ctx->PixelMaps.ItoA);
+ init_pixelmap(&ctx->PixelMaps.RtoR);
+ init_pixelmap(&ctx->PixelMaps.GtoG);
+ init_pixelmap(&ctx->PixelMaps.BtoB);
+ init_pixelmap(&ctx->PixelMaps.AtoA);
ctx->Pixel.HistogramEnabled = GL_FALSE;
ctx->Pixel.MinMaxEnabled = GL_FALSE;
ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0);