summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-21 11:57:30 -0600
committerBrian <brian@yutani.localnet.net>2007-03-21 11:57:30 -0600
commit23d31efc167f09d47635352f697ffcb087d3ebbd (patch)
tree782f5bdcda8a4374501cae05a94a024fe1c26777 /src/mesa/main
parent180cc2f8458c13ce415f7cdf9a425ae59cb6ad8b (diff)
parent88db19a48412cbe89196b1cc06e8ecf8ccae78b0 (diff)
merge from master
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/attrib.c19
-rw-r--r--src/mesa/main/buffers.c3
-rw-r--r--src/mesa/main/colortab.c313
-rw-r--r--src/mesa/main/enable.c18
-rw-r--r--src/mesa/main/framebuffer.c7
-rw-r--r--src/mesa/main/get.c78
-rw-r--r--src/mesa/main/get_gen.py26
-rw-r--r--src/mesa/main/image.c301
-rw-r--r--src/mesa/main/mtypes.h134
-rw-r--r--src/mesa/main/pixel.c483
-rw-r--r--src/mesa/main/renderbuffer.c26
-rw-r--r--src/mesa/main/texcompress_fxt1.c77
-rw-r--r--src/mesa/main/texstore.c21
13 files changed, 705 insertions, 801 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 2b1a35f3de..0df8d23050 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -138,9 +138,9 @@ _mesa_PushAttrib(GLbitfield mask)
attr->Blend = ctx->Color.BlendEnabled;
attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled;
attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
- attr->ColorTable = ctx->Pixel.ColorTableEnabled;
- attr->PostColorMatrixColorTable = ctx->Pixel.PostColorMatrixColorTableEnabled;
- attr->PostConvolutionColorTable = ctx->Pixel.PostConvolutionColorTableEnabled;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ attr->ColorTable[i] = ctx->Pixel.ColorTableEnabled[i];
+ }
attr->Convolution1D = ctx->Pixel.Convolution1DEnabled;
attr->Convolution2D = ctx->Pixel.Convolution2DEnabled;
attr->Separable2D = ctx->Pixel.Separable2DEnabled;
@@ -432,14 +432,15 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
GL_COLOR_MATERIAL);
- TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled, enable->ColorTable,
+ TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION],
+ enable->ColorTable[COLORTABLE_PRECONVOLUTION],
GL_COLOR_TABLE);
- TEST_AND_UPDATE(ctx->Pixel.PostColorMatrixColorTableEnabled,
- enable->PostColorMatrixColorTable,
- GL_POST_COLOR_MATRIX_COLOR_TABLE);
- TEST_AND_UPDATE(ctx->Pixel.PostConvolutionColorTableEnabled,
- enable->PostConvolutionColorTable,
+ TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION],
+ enable->ColorTable[COLORTABLE_POSTCONVOLUTION],
GL_POST_CONVOLUTION_COLOR_TABLE);
+ TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX],
+ enable->ColorTable[COLORTABLE_POSTCOLORMATRIX],
+ GL_POST_COLOR_MATRIX_COLOR_TABLE);
TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 0e3ed15584..11bd173e35 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -140,6 +140,9 @@ _mesa_Clear( GLbitfield mask )
return;
}
+ if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0)
+ return;
+
if (ctx->RenderMode == GL_RENDER) {
GLbitfield bufferMask;
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 2ad5c309b4..610acba306 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -291,15 +291,17 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *data )
{
+ static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 };
+ static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 };
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj = NULL;
struct gl_color_table *table = NULL;
GLboolean proxy = GL_FALSE;
GLint baseFormat;
- GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
- GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
+ const GLfloat *scale = one, *bias = zero;
GLint comps;
+
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
switch (target) {
@@ -350,18 +352,12 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
- rScale = ctx->Pixel.ColorTableScale[0];
- gScale = ctx->Pixel.ColorTableScale[1];
- bScale = ctx->Pixel.ColorTableScale[2];
- aScale = ctx->Pixel.ColorTableScale[3];
- rBias = ctx->Pixel.ColorTableBias[0];
- gBias = ctx->Pixel.ColorTableBias[1];
- bBias = ctx->Pixel.ColorTableBias[2];
- aBias = ctx->Pixel.ColorTableBias[3];
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION];
break;
case GL_PROXY_COLOR_TABLE:
- table = &ctx->ProxyColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];
proxy = GL_TRUE;
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
@@ -370,14 +366,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
return;
}
table = &(texUnit->ColorTable);
- rScale = ctx->Pixel.TextureColorTableScale[0];
- gScale = ctx->Pixel.TextureColorTableScale[1];
- bScale = ctx->Pixel.TextureColorTableScale[2];
- aScale = ctx->Pixel.TextureColorTableScale[3];
- rBias = ctx->Pixel.TextureColorTableBias[0];
- gBias = ctx->Pixel.TextureColorTableBias[1];
- bBias = ctx->Pixel.TextureColorTableBias[2];
- aBias = ctx->Pixel.TextureColorTableBias[3];
+ scale = ctx->Pixel.TextureColorTableScale;
+ bias = ctx->Pixel.TextureColorTableBias;
break;
case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -388,33 +378,21 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
proxy = GL_TRUE;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
- rScale = ctx->Pixel.PCCTscale[0];
- gScale = ctx->Pixel.PCCTscale[1];
- bScale = ctx->Pixel.PCCTscale[2];
- aScale = ctx->Pixel.PCCTscale[3];
- rBias = ctx->Pixel.PCCTbias[0];
- gBias = ctx->Pixel.PCCTbias[1];
- bBias = ctx->Pixel.PCCTbias[2];
- aBias = ctx->Pixel.PCCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION];
break;
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->ProxyPostConvolutionColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];
proxy = GL_TRUE;
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
- rScale = ctx->Pixel.PCMCTscale[0];
- gScale = ctx->Pixel.PCMCTscale[1];
- bScale = ctx->Pixel.PCMCTscale[2];
- aScale = ctx->Pixel.PCMCTscale[3];
- rBias = ctx->Pixel.PCMCTbias[0];
- gBias = ctx->Pixel.PCMCTbias[1];
- bBias = ctx->Pixel.PCMCTbias[2];
- aBias = ctx->Pixel.PCMCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX];
break;
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->ProxyPostColorMatrixColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];
proxy = GL_TRUE;
break;
default:
@@ -483,10 +461,10 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
store_colortable_entries(ctx, table,
0, width, /* start, count */
format, type, data,
- rScale, rBias,
- gScale, gBias,
- bScale, bBias,
- aScale, aBias);
+ scale[0], bias[0],
+ scale[1], bias[1],
+ scale[2], bias[2],
+ scale[3], bias[3]);
}
} /* proxy */
@@ -510,12 +488,14 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *data )
{
+ static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 };
+ static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 };
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
struct gl_texture_object *texObj = NULL;
struct gl_color_table *table = NULL;
- GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0;
- GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0;
+ const GLfloat *scale = one, *bias = zero;
+
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
@@ -543,15 +523,9 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
- rScale = ctx->Pixel.ColorTableScale[0];
- gScale = ctx->Pixel.ColorTableScale[1];
- bScale = ctx->Pixel.ColorTableScale[2];
- aScale = ctx->Pixel.ColorTableScale[3];
- rBias = ctx->Pixel.ColorTableBias[0];
- gBias = ctx->Pixel.ColorTableBias[1];
- bBias = ctx->Pixel.ColorTableBias[2];
- aBias = ctx->Pixel.ColorTableBias[3];
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -559,36 +533,18 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
return;
}
table = &(texUnit->ColorTable);
- rScale = ctx->Pixel.TextureColorTableScale[0];
- gScale = ctx->Pixel.TextureColorTableScale[1];
- bScale = ctx->Pixel.TextureColorTableScale[2];
- aScale = ctx->Pixel.TextureColorTableScale[3];
- rBias = ctx->Pixel.TextureColorTableBias[0];
- gBias = ctx->Pixel.TextureColorTableBias[1];
- bBias = ctx->Pixel.TextureColorTableBias[2];
- aBias = ctx->Pixel.TextureColorTableBias[3];
+ scale = ctx->Pixel.TextureColorTableScale;
+ bias = ctx->Pixel.TextureColorTableBias;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
- rScale = ctx->Pixel.PCCTscale[0];
- gScale = ctx->Pixel.PCCTscale[1];
- bScale = ctx->Pixel.PCCTscale[2];
- aScale = ctx->Pixel.PCCTscale[3];
- rBias = ctx->Pixel.PCCTbias[0];
- gBias = ctx->Pixel.PCCTbias[1];
- bBias = ctx->Pixel.PCCTbias[2];
- aBias = ctx->Pixel.PCCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
- rScale = ctx->Pixel.PCMCTscale[0];
- gScale = ctx->Pixel.PCMCTscale[1];
- bScale = ctx->Pixel.PCMCTscale[2];
- aScale = ctx->Pixel.PCMCTscale[3];
- rBias = ctx->Pixel.PCMCTbias[0];
- gBias = ctx->Pixel.PCMCTbias[1];
- bBias = ctx->Pixel.PCMCTbias[2];
- aBias = ctx->Pixel.PCMCTbias[3];
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
+ scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
@@ -623,10 +579,10 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
store_colortable_entries(ctx, table, start, count,
format, type, data,
- rScale, rBias,
- gScale, gBias,
- bScale, bBias,
- aScale, aBias);
+ scale[0], bias[0],
+ scale[1], bias[1],
+ scale[2], bias[2],
+ scale[3], bias[3]);
if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) {
/* per-texture object palette */
@@ -700,7 +656,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -710,10 +666,10 @@ _mesa_GetColorTable( GLenum target, GLenum format,
table = &(texUnit->ColorTable);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
@@ -831,16 +787,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
switch (target) {
case GL_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.ColorTableScale[0] = params[0];
- ctx->Pixel.ColorTableScale[1] = params[1];
- ctx->Pixel.ColorTableScale[2] = params[2];
- ctx->Pixel.ColorTableScale[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION], params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.ColorTableBias[0] = params[0];
- ctx->Pixel.ColorTableBias[1] = params[1];
- ctx->Pixel.ColorTableBias[2] = params[2];
- ctx->Pixel.ColorTableBias[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION], params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -853,16 +803,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
return;
}
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.TextureColorTableScale[0] = params[0];
- ctx->Pixel.TextureColorTableScale[1] = params[1];
- ctx->Pixel.TextureColorTableScale[2] = params[2];
- ctx->Pixel.TextureColorTableScale[3] = params[3];
+ COPY_4V(ctx->Pixel.TextureColorTableScale, params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.TextureColorTableBias[0] = params[0];
- ctx->Pixel.TextureColorTableBias[1] = params[1];
- ctx->Pixel.TextureColorTableBias[2] = params[2];
- ctx->Pixel.TextureColorTableBias[3] = params[3];
+ COPY_4V(ctx->Pixel.TextureColorTableBias, params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -871,16 +815,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.PCCTscale[0] = params[0];
- ctx->Pixel.PCCTscale[1] = params[1];
- ctx->Pixel.PCCTscale[2] = params[2];
- ctx->Pixel.PCCTscale[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION], params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.PCCTbias[0] = params[0];
- ctx->Pixel.PCCTbias[1] = params[1];
- ctx->Pixel.PCCTbias[2] = params[2];
- ctx->Pixel.PCCTbias[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION], params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -889,16 +827,10 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- ctx->Pixel.PCMCTscale[0] = params[0];
- ctx->Pixel.PCMCTscale[1] = params[1];
- ctx->Pixel.PCMCTscale[2] = params[2];
- ctx->Pixel.PCMCTscale[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX], params);
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- ctx->Pixel.PCMCTbias[0] = params[0];
- ctx->Pixel.PCMCTbias[1] = params[1];
- ctx->Pixel.PCMCTbias[2] = params[2];
- ctx->Pixel.PCMCTbias[3] = params[3];
+ COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX], params);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)");
@@ -985,24 +917,18 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.ColorTableScale[0];
- params[1] = ctx->Pixel.ColorTableScale[1];
- params[2] = ctx->Pixel.ColorTableScale[2];
- params[3] = ctx->Pixel.ColorTableScale[3];
+ COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.ColorTableBias[0];
- params[1] = ctx->Pixel.ColorTableBias[1];
- params[2] = ctx->Pixel.ColorTableBias[2];
- params[3] = ctx->Pixel.ColorTableBias[3];
+ COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]);
return;
}
break;
case GL_PROXY_COLOR_TABLE:
- table = &ctx->ProxyColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -1011,17 +937,11 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
}
table = &(texUnit->ColorTable);
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.TextureColorTableScale[0];
- params[1] = ctx->Pixel.TextureColorTableScale[1];
- params[2] = ctx->Pixel.TextureColorTableScale[2];
- params[3] = ctx->Pixel.TextureColorTableScale[3];
+ COPY_4V(params, ctx->Pixel.TextureColorTableScale);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.TextureColorTableBias[0];
- params[1] = ctx->Pixel.TextureColorTableBias[1];
- params[2] = ctx->Pixel.TextureColorTableBias[2];
- params[3] = ctx->Pixel.TextureColorTableBias[3];
+ COPY_4V(params, ctx->Pixel.TextureColorTableBias);
return;
}
break;
@@ -1033,44 +953,32 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
table = &(texUnit->ProxyColorTable);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.PCCTscale[0];
- params[1] = ctx->Pixel.PCCTscale[1];
- params[2] = ctx->Pixel.PCCTscale[2];
- params[3] = ctx->Pixel.PCCTscale[3];
+ COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.PCCTbias[0];
- params[1] = ctx->Pixel.PCCTbias[1];
- params[2] = ctx->Pixel.PCCTbias[2];
- params[3] = ctx->Pixel.PCCTbias[3];
+ COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]);
return;
}
break;
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->ProxyPostConvolutionColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = ctx->Pixel.PCMCTscale[0];
- params[1] = ctx->Pixel.PCMCTscale[1];
- params[2] = ctx->Pixel.PCMCTscale[2];
- params[3] = ctx->Pixel.PCMCTscale[3];
+ COPY_4V(params, ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]);
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = ctx->Pixel.PCMCTbias[0];
- params[1] = ctx->Pixel.PCMCTbias[1];
- params[2] = ctx->Pixel.PCMCTbias[2];
- params[3] = ctx->Pixel.PCMCTbias[3];
+ COPY_4V(params, ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]);
return;
}
break;
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->ProxyPostColorMatrixColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)");
@@ -1159,24 +1067,26 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
table = &ctx->Texture.Palette;
break;
case GL_COLOR_TABLE:
- table = &ctx->ColorTable;
+ table = &ctx->ColorTable[COLORTABLE_PRECONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = (GLint) ctx->Pixel.ColorTableScale[0];
- params[1] = (GLint) ctx->Pixel.ColorTableScale[1];
- params[2] = (GLint) ctx->Pixel.ColorTableScale[2];
- params[3] = (GLint) ctx->Pixel.ColorTableScale[3];
+ GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION];
+ params[0] = (GLint) scale[0];
+ params[1] = (GLint) scale[1];
+ params[2] = (GLint) scale[2];
+ params[3] = (GLint) scale[3];
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = (GLint) ctx->Pixel.ColorTableBias[0];
- params[1] = (GLint) ctx->Pixel.ColorTableBias[1];
- params[2] = (GLint) ctx->Pixel.ColorTableBias[2];
- params[3] = (GLint) ctx->Pixel.ColorTableBias[3];
+ GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION];
+ params[0] = (GLint) bias[0];
+ params[1] = (GLint) bias[1];
+ params[2] = (GLint) bias[2];
+ params[3] = (GLint) bias[3];
return;
}
break;
case GL_PROXY_COLOR_TABLE:
- table = &ctx->ProxyColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_PRECONVOLUTION];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
if (!ctx->Extensions.SGI_texture_color_table) {
@@ -1207,44 +1117,48 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
table = &(texUnit->ProxyColorTable);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->PostConvolutionColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCONVOLUTION];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = (GLint) ctx->Pixel.PCCTscale[0];
- params[1] = (GLint) ctx->Pixel.PCCTscale[1];
- params[2] = (GLint) ctx->Pixel.PCCTscale[2];
- params[3] = (GLint) ctx->Pixel.PCCTscale[3];
+ GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION];
+ params[0] = (GLint) scale[0];
+ params[1] = (GLint) scale[1];
+ params[2] = (GLint) scale[2];
+ params[3] = (GLint) scale[3];
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = (GLint) ctx->Pixel.PCCTbias[0];
- params[1] = (GLint) ctx->Pixel.PCCTbias[1];
- params[2] = (GLint) ctx->Pixel.PCCTbias[2];
- params[3] = (GLint) ctx->Pixel.PCCTbias[3];
+ GLfloat *bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION];
+ params[0] = (GLint) bias[0];
+ params[1] = (GLint) bias[1];
+ params[2] = (GLint) bias[2];
+ params[3] = (GLint) bias[3];
return;
}
break;
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
- table = &ctx->ProxyPostConvolutionColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->PostColorMatrixColorTable;
+ table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX];
if (pname == GL_COLOR_TABLE_SCALE_SGI) {
- params[0] = (GLint) ctx->Pixel.PCMCTscale[0];
- params[1] = (GLint) ctx->Pixel.PCMCTscale[1];
- params[2] = (GLint) ctx->Pixel.PCMCTscale[2];
- params[3] = (GLint) ctx->Pixel.PCMCTscale[3];
+ GLfloat *scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ params[0] = (GLint) scale[0];
+ params[0] = (GLint) scale[1];
+ params[0] = (GLint) scale[2];
+ params[0] = (GLint) scale[3];
return;
}
else if (pname == GL_COLOR_TABLE_BIAS_SGI) {
- params[0] = (GLint) ctx->Pixel.PCMCTbias[0];
- params[1] = (GLint) ctx->Pixel.PCMCTbias[1];
- params[2] = (GLint) ctx->Pixel.PCMCTbias[2];
- params[3] = (GLint) ctx->Pixel.PCMCTbias[3];
+ GLfloat *bias = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX];
+ params[0] = (GLint) bias[0];
+ params[1] = (GLint) bias[1];
+ params[2] = (GLint) bias[2];
+ params[3] = (GLint) bias[3];
return;
}
break;
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
- table = &ctx->ProxyPostColorMatrixColorTable;
+ table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX];
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)");
@@ -1320,13 +1234,11 @@ _mesa_free_colortable_data( struct gl_color_table *p )
void
_mesa_init_colortables( GLcontext * ctx )
{
- /* Color tables */
- _mesa_init_colortable(&ctx->ColorTable);
- _mesa_init_colortable(&ctx->ProxyColorTable);
- _mesa_init_colortable(&ctx->PostConvolutionColorTable);
- _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable);
- _mesa_init_colortable(&ctx->PostColorMatrixColorTable);
- _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable);
+ GLuint i;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ _mesa_init_colortable(&ctx->ColorTable[i]);
+ _mesa_init_colortable(&ctx->ProxyColorTable[i]);
+ }
}
@@ -1336,10 +1248,9 @@ _mesa_init_colortables( GLcontext * ctx )
void
_mesa_free_colortables_data( GLcontext *ctx )
{
- _mesa_free_colortable_data(&ctx->ColorTable);
- _mesa_free_colortable_data(&ctx->ProxyColorTable);
- _mesa_free_colortable_data(&ctx->PostConvolutionColorTable);
- _mesa_free_colortable_data(&ctx->ProxyPostConvolutionColorTable);
- _mesa_free_colortable_data(&ctx->PostColorMatrixColorTable);
- _mesa_free_colortable_data(&ctx->ProxyPostColorMatrixColorTable);
+ GLuint i;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ _mesa_free_colortable_data(&ctx->ColorTable[i]);
+ _mesa_free_colortable_data(&ctx->ProxyColorTable[i]);
+ }
}
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 0d54c29949..11b4ad6400 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -663,24 +663,24 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table, cap);
- if (ctx->Pixel.ColorTableEnabled == state)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] == state)
return;
FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.ColorTableEnabled = state;
+ ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION] = state;
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table, cap);
- if (ctx->Pixel.PostConvolutionColorTableEnabled == state)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] == state)
return;
FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostConvolutionColorTableEnabled = state;
+ ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION] = state;
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table, cap);
- if (ctx->Pixel.PostColorMatrixColorTableEnabled == state)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] == state)
return;
FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX] = state;
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_texture_color_table, cap);
@@ -1192,13 +1192,13 @@ _mesa_IsEnabled( GLenum cap )
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table);
- return ctx->Pixel.ColorTableEnabled;
+ return ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION];
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table);
- return ctx->Pixel.PostConvolutionColorTableEnabled;
+ return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION];
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXTENSION(SGI_color_table);
- return ctx->Pixel.PostColorMatrixColorTableEnabled;
+ return ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX];
/* GL_SGI_texture_color_table */
case GL_TEXTURE_COLOR_TABLE_SGI:
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 3136a950e0..cd4f594aa2 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -647,7 +647,7 @@ update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
const GLuint bufferBit = 1 << i;
if (bufferBit & bufferMask) {
struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
- if (rb) {
+ if (rb && rb->Width > 0 && rb->Height > 0) {
fb->_ColorDrawBuffers[output][count] = rb;
count++;
}
@@ -673,7 +673,10 @@ static void
update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
(void) ctx;
- if (fb->_ColorReadBufferIndex == -1 || fb->DeletePending) {
+ if (fb->_ColorReadBufferIndex == -1 ||
+ fb->DeletePending ||
+ fb->Width == 0 ||
+ fb->Height == 0) {
fb->_ColorReadBuffer = NULL; /* legal! */
}
else {
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index d09e0610ab..eb81ee4a52 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);
@@ -1283,15 +1283,15 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetBooleanv");
- params[0] = ctx->Pixel.ColorTableEnabled;
+ params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION];
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetBooleanv");
- params[0] = ctx->Pixel.PostConvolutionColorTableEnabled;
+ params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION];
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetBooleanv");
- params[0] = ctx->Pixel.PostColorMatrixColorTableEnabled;
+ params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX];
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_texture_color_table, "GetBooleanv");
@@ -2508,34 +2508,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;
@@ -3114,15 +3114,15 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetFloatv");
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled);
+ params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetFloatv");
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostConvolutionColorTableEnabled);
+ params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]);
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetFloatv");
- params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostColorMatrixColorTableEnabled);
+ params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]);
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_texture_color_table, "GetFloatv");
@@ -4339,34 +4339,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);
@@ -4945,15 +4945,15 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetIntegerv");
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled);
+ params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]);
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetIntegerv");
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostConvolutionColorTableEnabled);
+ params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]);
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_color_table, "GetIntegerv");
- params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostColorMatrixColorTableEnabled);
+ params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]);
break;
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXT1(SGI_texture_color_table, "GetIntegerv");
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 3e66946b92..33be768999 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 ),
@@ -624,11 +624,11 @@ StateVars = [
# GL_SGI_color_table / GL_ARB_imaging
( "GL_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.ColorTableEnabled"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "", ["SGI_color_table"] ),
( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.PostConvolutionColorTableEnabled"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "", ["SGI_color_table"] ),
( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.PostColorMatrixColorTableEnabled"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "", ["SGI_color_table"] ),
# GL_SGI_texture_color_table
( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean,
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index eb91ebb611..394a7c65cd 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 6.5.3
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -60,6 +60,34 @@
/**
+ * \return GL_TRUE if type is packed pixel type, GL_FALSE otherwise.
+ */
+static GLboolean
+_mesa_type_is_packed(GLenum type)
+ {
+ switch (type) {
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_SHORT_8_8_MESA:
+ case GL_UNSIGNED_SHORT_8_8_REV_MESA:
+ case GL_UNSIGNED_INT_24_8_EXT:
+ return GL_TRUE;
+ }
+
+ return GL_FALSE;
+}
+
+/**
* Flip the 8 bits in each byte of the given array.
*
* \param p array.
@@ -651,39 +679,34 @@ _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
/**
- * Compute the stride between image rows.
+ * Compute the stride (in bytes) between image rows.
*
* \param packing the pixelstore attributes
* \param width image width.
* \param format pixel format.
* \param type pixel data type.
*
- * \return the stride in bytes for the given parameters.
+ * \return the stride in bytes for the given parameters, or -1 if error
*/
GLint
_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
GLint width, GLenum format, GLenum type )
{
+ GLint bytesPerRow, remainder;
+
ASSERT(packing);
+
if (type == GL_BITMAP) {
- /* BITMAP data */
- GLint bytes;
if (packing->RowLength == 0) {
- bytes = (width + 7) / 8;
+ bytesPerRow = (width + 7) / 8;
}
else {
- bytes = (packing->RowLength + 7) / 8;
+ bytesPerRow = (packing->RowLength + 7) / 8;
}
- if (packing->Invert) {
- /* negate the bytes per row (negative row stride) */
- bytes = -bytes;
- }
- return bytes;
}
else {
/* Non-BITMAP data */
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
- GLint bytesPerRow, remainder;
if (bytesPerPixel <= 0)
return -1; /* error */
if (packing->RowLength == 0) {
@@ -692,13 +715,19 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
else {
bytesPerRow = bytesPerPixel * packing->RowLength;
}
- remainder = bytesPerRow % packing->Alignment;
- if (remainder > 0)
- bytesPerRow += (packing->Alignment - remainder);
- if (packing->Invert)
- bytesPerRow = -bytesPerRow;
- return bytesPerRow;
}
+
+ remainder = bytesPerRow % packing->Alignment;
+ if (remainder > 0) {
+ bytesPerRow += (packing->Alignment - remainder);
+ }
+
+ if (packing->Invert) {
+ /* negate the bytes per row (negative row stride) */
+ bytesPerRow = -bytesPerRow;
+ }
+
+ return bytesPerRow;
}
@@ -1007,7 +1036,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
}
/* GL_COLOR_TABLE lookup */
if (transferOps & IMAGE_COLOR_TABLE_BIT) {
- _mesa_lookup_rgba_float(&ctx->ColorTable, n, rgba);
+ _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_PRECONVOLUTION], n, rgba);
}
/* convolution */
if (transferOps & IMAGE_CONVOLUTION_BIT) {
@@ -1028,7 +1057,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
}
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) {
- _mesa_lookup_rgba_float(&ctx->PostConvolutionColorTable, n, rgba);
+ _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_POSTCONVOLUTION], n, rgba);
}
/* color matrix transform */
if (transferOps & IMAGE_COLOR_MATRIX_BIT) {
@@ -1036,7 +1065,7 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
}
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */
if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) {
- _mesa_lookup_rgba_float(&ctx->PostColorMatrixColorTable, n, rgba);
+ _mesa_lookup_rgba_float(&ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX], n, rgba);
}
/* update histogram count */
if (transferOps & IMAGE_HISTOGRAM_BIT) {
@@ -1100,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]);
}
}
}
@@ -1140,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 ];
}
}
}
@@ -1182,24 +1211,15 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
/* compute luminance values */
- if (transferOps & IMAGE_RED_TO_LUMINANCE) {
- /* Luminance = Red (glGetTexImage) */
+ if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
for (i = 0; i < n; i++) {
- luminance[i] = rgba[i][RCOMP];
+ GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ luminance[i] = CLAMP(sum, 0.0F, 1.0F);
}
}
else {
- /* Luminance = Red + Green + Blue (glReadPixels) */
- if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
- 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);
- }
- }
- else {
- for (i = 0; i < n; i++) {
- luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
- }
+ for (i = 0; i < n; i++) {
+ luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
}
}
}
@@ -1425,9 +1445,6 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n * comps);
- }
}
break;
case GL_SHORT:
@@ -1501,9 +1518,6 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n * comps );
- }
}
break;
case GL_UNSIGNED_INT:
@@ -1577,9 +1591,6 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n * comps );
- }
}
break;
case GL_INT:
@@ -1653,9 +1664,6 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n * comps );
- }
}
break;
case GL_FLOAT:
@@ -1729,9 +1737,6 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
- if (dstPacking->SwapBytes) {
- _mesa_swap4( (GLuint *) dst, n * comps );
- }
}
break;
case GL_HALF_FLOAT_ARB:
@@ -1805,9 +1810,6 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
- if (dstPacking->SwapBytes) {
- _mesa_swap2( (GLushort *) dst, n * comps );
- }
}
break;
case GL_UNSIGNED_BYTE_3_3_2:
@@ -2084,6 +2086,21 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
break;
default:
_mesa_problem(ctx, "bad type in _mesa_pack_rgba_span_float");
+ return;
+ }
+
+ if (dstPacking->SwapBytes) {
+ GLint swapSize = _mesa_sizeof_packed_type(dstType);
+ if (swapSize == 2) {
+ if (dstPacking->SwapBytes) {
+ _mesa_swap2((GLushort *) dstAddr, n * comps);
+ }
+ }
+ else if (swapSize == 4) {
+ if (dstPacking->SwapBytes) {
+ _mesa_swap4((GLuint *) dstAddr, n * comps);
+ }
+ }
}
}
@@ -3662,10 +3679,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 ];
}
}
}
@@ -3851,6 +3868,22 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
}
}
+#define DEPTH_VALUES(GLTYPE, GLTYPE2FLOAT) \
+ do { \
+ GLuint i; \
+ const GLTYPE *src = (const GLTYPE *)source; \
+ for (i = 0; i < n; i++) { \
+ GLTYPE value = src[i]; \
+ if (srcPacking->SwapBytes) { \
+ if (sizeof(GLTYPE) == 2) { \
+ SWAP2BYTE(value); \
+ } else if (sizeof(GLTYPE) == 4) { \
+ SWAP4BYTE(value); \
+ } \
+ } \
+ depthValues[i] = CLAMP(GLTYPE2FLOAT(value), 0.0F, 1.0F); \
+ } \
+ } while (0)
void
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
@@ -3872,59 +3905,23 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
switch (srcType) {
case GL_BYTE:
- {
- GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- for (i = 0; i < n; i++) {
- depthValues[i] = BYTE_TO_FLOAT(src[i]);
- }
- }
- break;
+ DEPTH_VALUES(GLbyte, BYTE_TO_FLOAT);
+ break;
case GL_UNSIGNED_BYTE:
- {
- GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- for (i = 0; i < n; i++) {
- depthValues[i] = UBYTE_TO_FLOAT(src[i]);
- }
- }
- break;
+ DEPTH_VALUES(GLubyte, UBYTE_TO_FLOAT);
+ break;
case GL_SHORT:
- {
- GLuint i;
- const GLshort *src = (const GLshort *) source;
- for (i = 0; i < n; i++) {
- depthValues[i] = SHORT_TO_FLOAT(src[i]);
- }
- }
- break;
+ DEPTH_VALUES(GLshort, SHORT_TO_FLOAT);
+ break;
case GL_UNSIGNED_SHORT:
- {
- GLuint i;
- const GLushort *src = (const GLushort *) source;
- for (i = 0; i < n; i++) {
- depthValues[i] = USHORT_TO_FLOAT(src[i]);
- }
- }
- break;
+ DEPTH_VALUES(GLushort, USHORT_TO_FLOAT);
+ break;
case GL_INT:
- {
- GLuint i;
- const GLint *src = (const GLint *) source;
- for (i = 0; i < n; i++) {
- depthValues[i] = INT_TO_FLOAT(src[i]);
- }
- }
- break;
+ DEPTH_VALUES(GLint, INT_TO_FLOAT);
+ break;
case GL_UNSIGNED_INT:
- {
- GLuint i;
- const GLuint *src = (const GLuint *) source;
- for (i = 0; i < n; i++) {
- depthValues[i] = UINT_TO_FLOAT(src[i]);
- }
- }
- break;
+ DEPTH_VALUES(GLuint, UINT_TO_FLOAT);
+ break;
case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
if (dstType == GL_UNSIGNED_INT &&
depthScale == (GLfloat) 0xffffff &&
@@ -3934,7 +3931,11 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
GLuint *zValues = (GLuint *) dest;
GLuint i;
for (i = 0; i < n; i++) {
- zValues[i] = src[i] & 0xffffff00;
+ GLuint value = src[i];
+ if (srcPacking->SwapBytes) {
+ SWAP4BYTE(value);
+ }
+ zValues[i] = value & 0xffffff00;
}
return;
}
@@ -3943,19 +3944,27 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
const GLfloat scale = 1.0f / 0xffffff;
GLuint i;
for (i = 0; i < n; i++) {
- depthValues[i] = (src[i] >> 8) * scale;
+ GLuint value = src[i];
+ if (srcPacking->SwapBytes) {
+ SWAP4BYTE(value);
+ }
+ depthValues[i] = (value >> 8) * scale;
}
}
break;
case GL_FLOAT:
- _mesa_memcpy(depthValues, source, n * sizeof(GLfloat));
- break;
+ DEPTH_VALUES(GLfloat, 1*);
+ break;
case GL_HALF_FLOAT_ARB:
{
GLuint i;
const GLhalfARB *src = (const GLhalfARB *) source;
for (i = 0; i < n; i++) {
- depthValues[i] = _mesa_half_to_float(src[i]);
+ GLhalfARB value = src[i];
+ if (srcPacking->SwapBytes) {
+ SWAP2BYTE(value);
+ }
+ depthValues[i] = _mesa_half_to_float(value);
}
}
break;
@@ -4186,14 +4195,18 @@ _mesa_unpack_image( GLuint dimensions,
if (type == GL_BITMAP) {
bytesPerRow = (width + 7) >> 3;
- flipBytes = !unpack->LsbFirst;
+ flipBytes = unpack->LsbFirst;
swap2 = swap4 = GL_FALSE;
compsPerRow = 0;
}
else {
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
- const GLint components = _mesa_components_in_format(format);
+ GLint components = _mesa_components_in_format(format);
GLint bytesPerComp;
+
+ if (_mesa_type_is_packed(type))
+ components = 1;
+
if (bytesPerPixel <= 0 || components <= 0)
return NULL; /* bad format or type. generate error later */
bytesPerRow = bytesPerPixel * width;
@@ -4218,7 +4231,61 @@ _mesa_unpack_image( GLuint dimensions,
for (row = 0; row < height; row++) {
const GLvoid *src = _mesa_image_address(dimensions, unpack, pixels,
width, height, format, type, img, row, 0);
- _mesa_memcpy(dst, src, bytesPerRow);
+
+ if ((type == GL_BITMAP) && (unpack->SkipPixels & 0x7)) {
+ GLint i;
+ flipBytes = GL_FALSE;
+ if (unpack->LsbFirst) {
+ GLubyte srcMask = 1 << (unpack->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 128) {
+ srcMask = 1;
+ s++;
+ } else {
+ srcMask = srcMask << 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ } else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ } else {
+ GLubyte srcMask = 128 >> (unpack->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 1) {
+ srcMask = 128;
+ s++;
+ } else {
+ srcMask = srcMask >> 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ } else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ } else
+ _mesa_memcpy(dst, src, bytesPerRow);
/* byte flipping/swapping */
if (flipBytes) {
flip_bytes((GLubyte *) dst, bytesPerRow);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 25a5a3cc36..0c9bf200d8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -381,6 +381,13 @@ enum {
BUFFER_BIT_COLOR7)
+/** The pixel transfer path has three color tables: */
+/*@{*/
+#define COLORTABLE_PRECONVOLUTION 0
+#define COLORTABLE_POSTCONVOLUTION 1
+#define COLORTABLE_POSTCOLORMATRIX 2
+#define COLORTABLE_MAX 3
+/*@}*/
/**
@@ -661,9 +668,7 @@ struct gl_enable_attrib
GLboolean Blend;
GLbitfield ClipPlanes;
GLboolean ColorMaterial;
- GLboolean ColorTable; /* SGI_color_table */
- GLboolean PostColorMatrixColorTable; /* SGI_color_table */
- GLboolean PostConvolutionColorTable; /* SGI_color_table */
+ GLboolean ColorTable[COLORTABLE_MAX];
GLboolean Convolution1D;
GLboolean Convolution2D;
GLboolean Separable2D;
@@ -963,74 +968,91 @@ 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 */
- 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 */
+
+ /* There are multiple color table stages: */
+ GLboolean ColorTableEnabled[COLORTABLE_MAX];
+ GLfloat ColorTableScale[COLORTABLE_MAX][4]; /**< RGBA */
+ GLfloat ColorTableBias[COLORTABLE_MAX][4]; /**< RGBA */
+
+ /* 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 */
+
+ /* 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 */
+
+ /* 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];
};
@@ -2213,7 +2235,7 @@ struct gl_renderbuffer
GLubyte IndexBits;
GLubyte DepthBits;
GLubyte StencilBits;
- GLvoid *Data;
+ GLvoid *Data; /**< This may not be used by some kinds of RBs */
/* Used to wrap one renderbuffer around another: */
struct gl_renderbuffer *Wrapped;
@@ -2614,7 +2636,6 @@ struct gl_matrix_stack
#define IMAGE_HISTOGRAM_BIT 0x200
#define IMAGE_MIN_MAX_BIT 0x400
#define IMAGE_CLAMP_BIT 0x800 /* extra */
-#define IMAGE_RED_TO_LUMINANCE 0x1000
/** Pixel Transfer ops up to convolution */
@@ -2966,6 +2987,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;
@@ -2976,12 +2998,14 @@ struct __GLcontextRec
struct gl_feedback Feedback; /**< Feedback */
struct gl_selection Select; /**< Selection */
- struct gl_color_table ColorTable; /**< Pre-convolution */
- struct gl_color_table ProxyColorTable; /**< Pre-convolution */
+ struct gl_color_table ColorTable[COLORTABLE_MAX];
+ struct gl_color_table ProxyColorTable[COLORTABLE_MAX];
+#if 0
struct gl_color_table PostConvolutionColorTable;
struct gl_color_table ProxyPostConvolutionColorTable;
struct gl_color_table PostColorMatrixColorTable;
struct gl_color_table ProxyPostColorMatrixColorTable;
+#endif
struct gl_program_state Program; /**< for vertex or fragment progs */
struct gl_vertex_program_state VertexProgram; /**< GL_ARB/NV_vertex_program */
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index de5c7fcef0..eb4fd6e7c9 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -252,85 +252,76 @@ _mesa_PixelStoref( GLenum pname, GLfloat param )
/***** glPixelMap *****/
/**********************************************************************/
+/**
+ * Return pointer to a pixelmap by name.
+ */
+static struct gl_pixelmap *
+get_pixelmap(GLcontext *ctx, GLenum map)
+{
+ switch (map) {
+ case GL_PIXEL_MAP_I_TO_I:
+ return &ctx->PixelMaps.ItoI;
+ case GL_PIXEL_MAP_S_TO_S:
+ return &ctx->PixelMaps.StoS;
+ case GL_PIXEL_MAP_I_TO_R:
+ return &ctx->PixelMaps.ItoR;
+ case GL_PIXEL_MAP_I_TO_G:
+ return &ctx->PixelMaps.ItoG;
+ case GL_PIXEL_MAP_I_TO_B:
+ return &ctx->PixelMaps.ItoB;
+ case GL_PIXEL_MAP_I_TO_A:
+ return &ctx->PixelMaps.ItoA;
+ case GL_PIXEL_MAP_R_TO_R:
+ return &ctx->PixelMaps.RtoR;
+ case GL_PIXEL_MAP_G_TO_G:
+ return &ctx->PixelMaps.GtoG;
+ case GL_PIXEL_MAP_B_TO_B:
+ return &ctx->PixelMaps.BtoB;
+ case GL_PIXEL_MAP_A_TO_A:
+ return &ctx->PixelMaps.AtoA;
+ default:
+ return NULL;
+ }
+}
+
/**
* Helper routine used by the other _mesa_PixelMap() functions.
*/
static void
-pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, const GLfloat *values)
+store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize,
+ const GLfloat *values)
{
GLint i;
+ struct gl_pixelmap *pm = get_pixelmap(ctx, map);
+ if (!pm) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glPixelMap(map)");
+ return;
+ }
+
switch (map) {
- case GL_PIXEL_MAP_S_TO_S:
- ctx->Pixel.MapStoSsize = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapStoS[i] = IROUND(values[i]);
- }
- break;
- case GL_PIXEL_MAP_I_TO_I:
- ctx->Pixel.MapItoIsize = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapItoI[i] = values[i];
- }
- break;
- case GL_PIXEL_MAP_I_TO_R:
- ctx->Pixel.MapItoRsize = 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);
- }
- break;
- case GL_PIXEL_MAP_I_TO_G:
- ctx->Pixel.MapItoGsize = 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);
- }
- break;
- case GL_PIXEL_MAP_I_TO_B:
- ctx->Pixel.MapItoBsize = 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);
- }
- break;
- case GL_PIXEL_MAP_I_TO_A:
- ctx->Pixel.MapItoAsize = 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);
- }
- break;
- case GL_PIXEL_MAP_R_TO_R:
- ctx->Pixel.MapRtoRsize = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F );
- }
- break;
- case GL_PIXEL_MAP_G_TO_G:
- ctx->Pixel.MapGtoGsize = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F );
- }
- break;
- case GL_PIXEL_MAP_B_TO_B:
- ctx->Pixel.MapBtoBsize = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F );
- }
- break;
- case GL_PIXEL_MAP_A_TO_A:
- ctx->Pixel.MapAtoAsize = mapsize;
- for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F );
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glPixelMap(map)" );
+ case GL_PIXEL_MAP_S_TO_S:
+ /* special case */
+ ctx->PixelMaps.StoS.Size = mapsize;
+ for (i = 0; i < mapsize; i++) {
+ ctx->PixelMaps.StoS.Map[i] = IROUND(values[i]);
+ }
+ break;
+ case GL_PIXEL_MAP_I_TO_I:
+ /* special case */
+ ctx->PixelMaps.ItoI.Size = mapsize;
+ for (i = 0; i < mapsize; i++) {
+ ctx->PixelMaps.ItoI.Map[i] = values[i];
+ }
+ break;
+ default:
+ /* general case */
+ pm->Size = mapsize;
+ for (i = 0; i < mapsize; i++) {
+ GLfloat val = CLAMP(values[i], 0.0F, 1.0F);
+ pm->Map[i] = val;
+ pm->Map8[i] = (GLint) (val * 255.0F);
+ }
}
}
@@ -385,7 +376,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
return;
}
- pixelmap(ctx, map, mapsize, values);
+ store_pixelmap(ctx, map, mapsize, values);
if (ctx->Unpack.BufferObj->Name) {
ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
@@ -394,7 +385,6 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
}
-
void GLAPIENTRY
_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
{
@@ -464,11 +454,10 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
ctx->Unpack.BufferObj);
}
- pixelmap(ctx, map, mapsize, fvalues);
+ store_pixelmap(ctx, map, mapsize, fvalues);
}
-
void GLAPIENTRY
_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
{
@@ -520,7 +509,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
return;
}
- /* convert to floats */
+ /* convert to floats */
if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {
GLint i;
for (i = 0; i < mapsize; i++) {
@@ -539,40 +528,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
ctx->Unpack.BufferObj);
}
- pixelmap(ctx, map, mapsize, fvalues);
-}
-
-
-/**
- * Return size of the named map.
- */
-static GLuint
-get_map_size(GLcontext *ctx, GLenum map)
-{
- switch (map) {
- case GL_PIXEL_MAP_I_TO_I:
- return ctx->Pixel.MapItoIsize;
- case GL_PIXEL_MAP_S_TO_S:
- return ctx->Pixel.MapStoSsize;
- case GL_PIXEL_MAP_I_TO_R:
- return ctx->Pixel.MapItoRsize;
- case GL_PIXEL_MAP_I_TO_G:
- return ctx->Pixel.MapItoGsize;
- case GL_PIXEL_MAP_I_TO_B:
- return ctx->Pixel.MapItoBsize;
- case GL_PIXEL_MAP_I_TO_A:
- return ctx->Pixel.MapItoAsize;
- case GL_PIXEL_MAP_R_TO_R:
- return ctx->Pixel.MapRtoRsize;
- case GL_PIXEL_MAP_G_TO_G:
- return ctx->Pixel.MapGtoGsize;
- case GL_PIXEL_MAP_B_TO_B:
- return ctx->Pixel.MapBtoBsize;
- case GL_PIXEL_MAP_A_TO_A:
- return ctx->Pixel.MapAtoAsize;
- default:
- return 0;
- }
+ store_pixelmap(ctx, map, mapsize, fvalues);
}
@@ -581,9 +537,17 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
{
GET_CURRENT_CONTEXT(ctx);
GLuint mapsize, i;
+ const struct gl_pixelmap *pm;
+
ASSERT_OUTSIDE_BEGIN_END(ctx);
- mapsize = get_map_size(ctx, map);
+ pm = get_pixelmap(ctx, map);
+ if (!pm) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapfv(map)");
+ return;
+ }
+
+ mapsize = pm->Size;
if (ctx->Pack.BufferObj->Name) {
/* pack pixelmap into PBO */
@@ -613,41 +577,14 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
return;
}
- switch (map) {
- case GL_PIXEL_MAP_I_TO_I:
- MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_S_TO_S:
- for (i = 0; i < mapsize; i++) {
- values[i] = (GLfloat) ctx->Pixel.MapStoS[i];
- }
- break;
- case GL_PIXEL_MAP_I_TO_R:
- MEMCPY(values, ctx->Pixel.MapItoR, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_I_TO_G:
- MEMCPY(values, ctx->Pixel.MapItoG, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_I_TO_B:
- MEMCPY(values, ctx->Pixel.MapItoB, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_I_TO_A:
- MEMCPY(values, ctx->Pixel.MapItoA, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_R_TO_R:
- MEMCPY(values, ctx->Pixel.MapRtoR, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_G_TO_G:
- MEMCPY(values, ctx->Pixel.MapGtoG, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_B_TO_B:
- MEMCPY(values, ctx->Pixel.MapBtoB, mapsize * sizeof(GLfloat));
- break;
- case GL_PIXEL_MAP_A_TO_A:
- MEMCPY(values, ctx->Pixel.MapAtoA, mapsize * sizeof(GLfloat));
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
+ if (map == GL_PIXEL_MAP_S_TO_S) {
+ /* special case */
+ for (i = 0; i < mapsize; i++) {
+ values[i] = (GLfloat) ctx->PixelMaps.StoS.Map[i];
+ }
+ }
+ else {
+ MEMCPY(values, pm->Map, mapsize * sizeof(GLfloat));
}
if (ctx->Pack.BufferObj->Name) {
@@ -662,9 +599,16 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
{
GET_CURRENT_CONTEXT(ctx);
GLint mapsize, i;
+ const struct gl_pixelmap *pm;
+
ASSERT_OUTSIDE_BEGIN_END(ctx);
- mapsize = get_map_size(ctx, map);
+ pm = get_pixelmap(ctx, map);
+ if (!pm) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapuiv(map)");
+ return;
+ }
+ mapsize = pm->Size;
if (ctx->Pack.BufferObj->Name) {
/* pack pixelmap into PBO */
@@ -694,57 +638,14 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
return;
}
- switch (map) {
- case GL_PIXEL_MAP_I_TO_I:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoI[i] );
- }
- break;
- case GL_PIXEL_MAP_S_TO_S:
- MEMCPY(values, ctx->Pixel.MapStoS, 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] );
- }
- break;
- case GL_PIXEL_MAP_I_TO_G:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] );
- }
- break;
- case GL_PIXEL_MAP_I_TO_B:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] );
- }
- break;
- case GL_PIXEL_MAP_I_TO_A:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] );
- }
- break;
- case GL_PIXEL_MAP_R_TO_R:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] );
- }
- break;
- case GL_PIXEL_MAP_G_TO_G:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] );
- }
- break;
- case GL_PIXEL_MAP_B_TO_B:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] );
- }
- break;
- case GL_PIXEL_MAP_A_TO_A:
- for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] );
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
+ if (map == GL_PIXEL_MAP_S_TO_S) {
+ /* special case */
+ MEMCPY(values, ctx->PixelMaps.StoS.Map, mapsize * sizeof(GLint));
+ }
+ else {
+ for (i = 0; i < mapsize; i++) {
+ values[i] = FLOAT_TO_UINT( pm->Map[i] );
+ }
}
if (ctx->Pack.BufferObj->Name) {
@@ -759,9 +660,16 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
{
GET_CURRENT_CONTEXT(ctx);
GLint mapsize, i;
+ const struct gl_pixelmap *pm;
+
ASSERT_OUTSIDE_BEGIN_END(ctx);
- mapsize = get_map_size(ctx, map);
+ pm = get_pixelmap(ctx, map);
+ if (!pm) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapusv(map)");
+ return;
+ }
+ mapsize = pm ? pm->Size : 0;
if (ctx->Pack.BufferObj->Name) {
/* pack pixelmap into PBO */
@@ -793,58 +701,21 @@ _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);
- }
- 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);
- }
- break;
- case GL_PIXEL_MAP_I_TO_R:
- for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoR[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] );
- }
- break;
- case GL_PIXEL_MAP_I_TO_B:
- for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoB[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] );
- }
- break;
- case GL_PIXEL_MAP_R_TO_R:
- for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapRtoR[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] );
- }
- break;
- case GL_PIXEL_MAP_B_TO_B:
- for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapBtoB[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] );
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
+ /* special cases */
+ case GL_PIXEL_MAP_I_TO_I:
+ for (i = 0; i < mapsize; i++) {
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.ItoI.Map[i], 0.0, 65535.);
+ }
+ break;
+ case GL_PIXEL_MAP_S_TO_S:
+ for (i = 0; i < mapsize; i++) {
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.StoS.Map[i], 0.0, 65535.);
+ }
+ break;
+ default:
+ for (i = 0; i < mapsize; i++) {
+ CLAMPED_FLOAT_TO_USHORT(values[i], pm->Map[i] );
+ }
}
if (ctx->Pack.BufferObj->Name) {
@@ -1113,14 +984,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 +1284,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 +1309,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];
@@ -1496,7 +1367,7 @@ update_image_transfer_state(GLcontext *ctx)
if (ctx->Pixel.MapColorFlag)
mask |= IMAGE_MAP_COLOR_BIT;
- if (ctx->Pixel.ColorTableEnabled)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION])
mask |= IMAGE_COLOR_TABLE_BIT;
if (ctx->Pixel.Convolution1DEnabled ||
@@ -1515,7 +1386,7 @@ update_image_transfer_state(GLcontext *ctx)
}
}
- if (ctx->Pixel.PostConvolutionColorTableEnabled)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION])
mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY ||
@@ -1529,7 +1400,7 @@ update_image_transfer_state(GLcontext *ctx)
ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
mask |= IMAGE_COLOR_MATRIX_BIT;
- if (ctx->Pixel.PostColorMatrixColorTableEnabled)
+ if (ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX])
mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
if (ctx->Pixel.HistogramEnabled)
@@ -1558,6 +1429,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,43 +1463,25 @@ _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);
ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(ctx->Pixel.PCCTscale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.PCCTbias, 0.0, 0.0, 0.0, 0.0);
- ASSIGN_4V(ctx->Pixel.PCMCTscale, 1.0, 1.0, 1.0, 1.0);
- ASSIGN_4V(ctx->Pixel.PCMCTbias, 0.0, 0.0, 0.0, 0.0);
- ctx->Pixel.ColorTableEnabled = GL_FALSE;
- ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE;
- ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE;
+ for (i = 0; i < COLORTABLE_MAX; i++) {
+ ASSIGN_4V(ctx->Pixel.ColorTableScale[i], 1.0, 1.0, 1.0, 1.0);
+ ASSIGN_4V(ctx->Pixel.ColorTableBias[i], 0.0, 0.0, 0.0, 0.0);
+ ctx->Pixel.ColorTableEnabled[i] = GL_FALSE;
+ }
ctx->Pixel.Convolution1DEnabled = GL_FALSE;
ctx->Pixel.Convolution2DEnabled = GL_FALSE;
ctx->Pixel.Separable2DEnabled = GL_FALSE;
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 1cc95a7d3b..e387c42c34 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -1192,18 +1192,22 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
ASSERT(rb->PutMonoValues);
/* free old buffer storage */
- if (rb->Data)
+ if (rb->Data) {
_mesa_free(rb->Data);
-
- /* allocate new buffer storage */
- rb->Data = _mesa_malloc(width * height * pixelSize);
- if (rb->Data == NULL) {
- rb->Width = 0;
- rb->Height = 0;
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "software renderbuffer allocation (%d x %d x %d)",
- width, height, pixelSize);
- return GL_FALSE;
+ rb->Data = NULL;
+ }
+
+ if (width > 0 && height > 0) {
+ /* allocate new buffer storage */
+ rb->Data = _mesa_malloc(width * height * pixelSize);
+ if (rb->Data == NULL) {
+ rb->Width = 0;
+ rb->Height = 0;
+ _mesa_error(ctx, GL_OUT_OF_MEMORY,
+ "software renderbuffer allocation (%d x %d x %d)",
+ width, height, pixelSize);
+ return GL_FALSE;
+ }
}
rb->Width = width;
diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index d3011cedce..411d51cfcc 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -752,44 +752,55 @@ fxt1_quantize_ALPHA1 (GLuint *cc,
GLint minColL = 0, maxColL = 0;
GLint minColR = 0, maxColR = 0;
GLint sumL = 0, sumR = 0;
-
+ GLint nn_comp;
/* Our solution here is to find the darkest and brightest colors in
* the 4x4 tile and use those as the two representative colors.
* There are probably better algorithms to use (histogram-based).
*/
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- sumL += sum;
+ nn_comp = n_comp;
+ while ((minColL == maxColL) && nn_comp) {
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = 0; k < N_TEXELS / 2; k++) {
+ GLint sum = 0;
+ for (i = 0; i < nn_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColL = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColL = k;
+ }
+ sumL += sum;
+ }
+
+ nn_comp--;
}
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- sumR += sum;
+
+ nn_comp = n_comp;
+ while ((minColR == maxColR) && nn_comp) {
+ minSum = 2000; /* big enough */
+ maxSum = -1; /* small enough */
+ for (k = N_TEXELS / 2; k < N_TEXELS; k++) {
+ GLint sum = 0;
+ for (i = 0; i < nn_comp; i++) {
+ sum += input[k][i];
+ }
+ if (minSum > sum) {
+ minSum = sum;
+ minColR = k;
+ }
+ if (maxSum < sum) {
+ maxSum = sum;
+ maxColR = k;
+ }
+ sumR += sum;
+ }
+
+ nn_comp--;
}
/* choose the common vector (yuck!) */
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 994fb16730..a570525155 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3608,10 +3608,29 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
GLint col;
for (col = 0; col < width; col++) {
(*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
+ if (texImage->TexFormat->BaseFormat == GL_ALPHA) {
+ rgba[col][RCOMP] = 0.0;
+ rgba[col][GCOMP] = 0.0;
+ rgba[col][BCOMP] = 0.0;
+ }
+ else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) {
+ rgba[col][GCOMP] = 0.0;
+ rgba[col][BCOMP] = 0.0;
+ rgba[col][ACOMP] = 1.0;
+ }
+ else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) {
+ rgba[col][GCOMP] = 0.0;
+ rgba[col][BCOMP] = 0.0;
+ }
+ else if (texImage->TexFormat->BaseFormat == GL_INTENSITY) {
+ rgba[col][GCOMP] = 0.0;
+ rgba[col][BCOMP] = 0.0;
+ rgba[col][ACOMP] = 1.0;
+ }
}
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
format, type, dest,
- &ctx->Pack, IMAGE_RED_TO_LUMINANCE);
+ &ctx->Pack, 0x0 /*image xfer ops*/);
} /* format */
} /* row */
} /* img */