Another optional ARB_imaging subset extension.
DEFINE_BIT(_NEW_MODELVIEW),
DEFINE_BIT(_NEW_PROJECTION),
DEFINE_BIT(_NEW_TEXTURE_MATRIX),
- DEFINE_BIT(_NEW_COLOR_MATRIX),
DEFINE_BIT(_NEW_ACCUM),
DEFINE_BIT(_NEW_COLOR),
DEFINE_BIT(_NEW_DEPTH),
dummy_enum_func(void)
{
gl_buffer_index bi = BUFFER_FRONT_LEFT;
- gl_colortable_index ci = COLORTABLE_PRECONVOLUTION;
gl_face_index fi = FACE_POS_X;
gl_frag_attrib fa = FRAG_ATTRIB_WPOS;
gl_frag_result fr = FRAG_RESULT_DEPTH;
gl_geom_result gr = GEOM_RESULT_POS;
(void) bi;
- (void) ci;
(void) fi;
(void) fa;
(void) fr;
_mesa_print_state( const char *msg, GLuint state )
{
_mesa_debug(NULL,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
msg,
state,
(state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
(state & _NEW_PROJECTION) ? "ctx->Projection, " : "",
(state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "",
- (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "",
(state & _NEW_ACCUM) ? "ctx->Accum, " : "",
(state & _NEW_COLOR) ? "ctx->Color, " : "",
(state & _NEW_DEPTH) ? "ctx->Depth, " : "",
n[3].f = params[0];
if (pname == GL_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
pname == GL_TEXTURE_COLOR_TABLE_SGI) {
n[4].f = params[1];
n[5].f = params[2];
n[3].i = params[0];
if (pname == GL_COLOR_TABLE_SGI ||
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI ||
pname == GL_TEXTURE_COLOR_TABLE_SGI) {
n[4].i = params[1];
n[5].i = params[2];
{ OFF, "GL_NV_vertex_program", F(NV_vertex_program) },
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
{ ON, "GL_OES_read_format", F(OES_read_format) },
- { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) },
{ OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
{ OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
{ OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
#if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program
ctx->Extensions.NV_fragment_program_option = GL_TRUE;
#endif
- ctx->Extensions.SGI_color_matrix = GL_TRUE;
ctx->Extensions.SGI_texture_color_table = GL_TRUE;
ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE;
ctx->Extensions.EXT_blend_minmax = GL_TRUE;
ctx->Extensions.EXT_blend_subtract = GL_TRUE;
ctx->Extensions.EXT_convolution = GL_TRUE;
- ctx->Extensions.SGI_color_matrix = GL_TRUE;
}
extra_EXT_compiled_vertex_array },
/* GL_ARB_transpose_matrix */
- { GL_TRANSPOSE_COLOR_MATRIX_ARB, CONTEXT_MATRIX_T(ColorMatrixStack.Top), NO_EXTRA },
{ GL_TRANSPOSE_MODELVIEW_MATRIX_ARB,
CONTEXT_MATRIX_T(ModelviewMatrixStack), NO_EXTRA },
{ GL_TRANSPOSE_PROJECTION_MATRIX_ARB,
CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA },
{ GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA },
- /* GL_SGI_color_matrix (also in 1.2 imaging) */
- { GL_COLOR_MATRIX_SGI, CONTEXT_MATRIX(ColorMatrixStack.Top), NO_EXTRA },
- { GL_COLOR_MATRIX_STACK_DEPTH_SGI, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, ColorMatrixStack.Depth), NO_EXTRA },
- { GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI,
- CONST(MAX_COLOR_STACK_DEPTH), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_RED_SCALE_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixScale[0]), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixScale[1]), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixScale[2]), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixScale[3]), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_RED_BIAS_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixBias[0]), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixBias[1]), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixBias[2]), NO_EXTRA },
- { GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI,
- CONTEXT_FLOAT(Pixel.PostColorMatrixBias[3]), NO_EXTRA },
-
/* GL_EXT_convolution (also in 1.2 imaging) */
{ GL_CONVOLUTION_1D_EXT, CONTEXT_BOOL(Pixel.Convolution1DEnabled),
extra_EXT_convolution },
case GL_MODELVIEW_STACK_DEPTH:
case GL_PROJECTION_STACK_DEPTH:
- case GL_COLOR_MATRIX_STACK_DEPTH_SGI:
v->value_int = *(GLint *) ((char *) ctx + d->offset) + 1;
break;
}
}
-
-/*
- * Apply the color matrix and post color matrix scaling and biasing.
- */
-void
-_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
-{
- const GLfloat rs = ctx->Pixel.PostColorMatrixScale[0];
- const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0];
- const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1];
- const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1];
- const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2];
- const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2];
- const GLfloat as = ctx->Pixel.PostColorMatrixScale[3];
- const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3];
- const GLfloat *m = ctx->ColorMatrixStack.Top->m;
- GLuint i;
- for (i = 0; i < n; i++) {
- const GLfloat r = rgba[i][RCOMP];
- const GLfloat g = rgba[i][GCOMP];
- const GLfloat b = rgba[i][BCOMP];
- const GLfloat a = rgba[i][ACOMP];
- rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb;
- rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb;
- rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb;
- rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab;
- }
-}
-
-
/**
* Apply a color table lookup to an array of floating point RGBA colors.
*/
ctx->Pixel.PostConvolutionBias[BCOMP],
ctx->Pixel.PostConvolutionBias[ACOMP]);
}
- /* color matrix transform */
- if (transferOps & IMAGE_COLOR_MATRIX_BIT) {
- _mesa_transform_rgba(ctx, n, rgba);
- }
/* clamping to [0,1] */
if (transferOps & IMAGE_CLAMP_BIT) {
GLuint i;
extern void
_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
-
-extern void
-_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
-
-
extern void
_mesa_lookup_rgba_float(const struct gl_color_table *table,
GLuint n, GLfloat rgba[][4]);
ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack));
ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
break;
- case GL_COLOR:
- ctx->CurrentStack = &ctx->ColorMatrixStack;
- break;
case GL_MATRIX0_NV:
case GL_MATRIX1_NV:
case GL_MATRIX2_NV:
_NEW_MODELVIEW);
init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH,
_NEW_PROJECTION);
- init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH,
- _NEW_COLOR_MATRIX);
for (i = 0; i < Elements(ctx->TextureMatrixStack); i++)
init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH,
_NEW_TEXTURE_MATRIX);
free_matrix_stack(&ctx->ModelviewMatrixStack);
free_matrix_stack(&ctx->ProjectionMatrixStack);
- free_matrix_stack(&ctx->ColorMatrixStack);
for (i = 0; i < Elements(ctx->TextureMatrixStack); i++)
free_matrix_stack(&ctx->TextureMatrixStack[i]);
for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++)
BUFFER_BIT_COLOR7)
-/** The pixel transfer path has three color tables: */
-typedef enum
-{
- COLORTABLE_PRECONVOLUTION,
- COLORTABLE_POSTCONVOLUTION,
- COLORTABLE_POSTCOLORMATRIX,
- COLORTABLE_MAX
-} gl_colortable_index;
-
-
/**
* Data structure for color tables
*/
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 */
-
/*--- End Pixel Transfer State ---*/
/** glPixelZoom */
GLboolean NV_vertex_program;
GLboolean NV_vertex_program1_1;
GLboolean OES_read_format;
- GLboolean SGI_color_matrix;
GLboolean SGI_texture_color_table;
GLboolean SGIS_generate_mipmap;
GLboolean SGIS_texture_edge_clamp;
#define IMAGE_MAP_COLOR_BIT 0x4
#define IMAGE_CONVOLUTION_BIT 0x10
#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
-#define IMAGE_COLOR_MATRIX_BIT 0x80
#define IMAGE_CLAMP_BIT 0x800
IMAGE_MAP_COLOR_BIT)
/** Pixel transfer ops after convolution */
-#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
- IMAGE_COLOR_MATRIX_BIT)
+#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS)
/*@}*/
#define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */
#define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */
#define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */
-#define _NEW_COLOR_MATRIX 0x8 /**< __GLcontextRec::ColorMatrix */
#define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */
#define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */
#define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */
#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
_NEW_TEXTURE)
-#define _MESA_NEW_TRANSFER_STATE (_NEW_PIXEL | \
- _NEW_COLOR_MATRIX)
+#define _MESA_NEW_TRANSFER_STATE (_NEW_PIXEL)
/*@}*/
/*@{*/
struct gl_matrix_stack ModelviewMatrixStack;
struct gl_matrix_stack ProjectionMatrixStack;
- struct gl_matrix_stack ColorMatrixStack;
struct gl_matrix_stack TextureMatrixStack[MAX_TEXTURE_UNITS];
struct gl_matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES];
struct gl_matrix_stack *CurrentStack; /**< Points to one of the above stacks */
FLUSH_VERTICES(ctx, _NEW_PIXEL);
ctx->Pixel.DepthBias = param;
break;
- case GL_POST_COLOR_MATRIX_RED_SCALE:
- if (ctx->Pixel.PostColorMatrixScale[0] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixScale[0] = param;
- break;
- case GL_POST_COLOR_MATRIX_RED_BIAS:
- if (ctx->Pixel.PostColorMatrixBias[0] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixBias[0] = param;
- break;
- case GL_POST_COLOR_MATRIX_GREEN_SCALE:
- if (ctx->Pixel.PostColorMatrixScale[1] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixScale[1] = param;
- break;
- case GL_POST_COLOR_MATRIX_GREEN_BIAS:
- if (ctx->Pixel.PostColorMatrixBias[1] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixBias[1] = param;
- break;
- case GL_POST_COLOR_MATRIX_BLUE_SCALE:
- if (ctx->Pixel.PostColorMatrixScale[2] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixScale[2] = param;
- break;
- case GL_POST_COLOR_MATRIX_BLUE_BIAS:
- if (ctx->Pixel.PostColorMatrixBias[2] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixBias[2] = param;
- break;
- case GL_POST_COLOR_MATRIX_ALPHA_SCALE:
- if (ctx->Pixel.PostColorMatrixScale[3] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixScale[3] = param;
- break;
- case GL_POST_COLOR_MATRIX_ALPHA_BIAS:
- if (ctx->Pixel.PostColorMatrixBias[3] == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PIXEL);
- ctx->Pixel.PostColorMatrixBias[3] = param;
- break;
case GL_POST_CONVOLUTION_RED_SCALE:
if (ctx->Pixel.PostConvolutionScale[0] == param)
return;
}
}
- if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY ||
- ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[0] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[1] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[2] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
- mask |= IMAGE_COLOR_MATRIX_BIT;
-
ctx->_ImageTransferState = mask;
}
*/
void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
{
- if (new_state & _NEW_COLOR_MATRIX)
- _math_matrix_analyse( ctx->ColorMatrixStack.Top );
-
- /* References ColorMatrix.type (derived above).
- */
if (new_state & _MESA_NEW_TRANSFER_STATE)
update_image_transfer_state(ctx);
}
init_pixelmap(&ctx->PixelMaps.GtoG);
init_pixelmap(&ctx->PixelMaps.BtoB);
init_pixelmap(&ctx->PixelMaps.AtoA);
- 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);
ctx->Pixel.Convolution1DEnabled = GL_FALSE;
ctx->Pixel.Convolution2DEnabled = GL_FALSE;
ctx->Pixel.Separable2DEnabled = GL_FALSE;
{GL_MODELVIEW, GL_MODELVIEW_MATRIX},
{GL_PROJECTION, GL_PROJECTION_MATRIX},
{GL_TEXTURE, GL_TEXTURE_MATRIX},
-#if 0
- /* this doesn't exist in GLES */
- {GL_COLOR, GL_COLOR_MATRIX},
-#endif
};
/* Call Mesa to get the current matrix in floating-point form. First,
case STATE_MVP_MATRIX:
case STATE_TEXTURE_MATRIX:
case STATE_PROGRAM_MATRIX:
- case STATE_COLOR_MATRIX:
{
/* state[0] = modelview, projection, texture, etc. */
/* state[1] = which texture matrix or program matrix */
ASSERT(index < Elements(ctx->ProgramMatrixStack));
matrix = ctx->ProgramMatrixStack[index].Top;
}
- else if (mat == STATE_COLOR_MATRIX) {
- matrix = ctx->ColorMatrixStack.Top;
- }
else {
_mesa_problem(ctx, "Bad matrix name in _mesa_fetch_state()");
return;
value[3] = ctx->Pixel.AlphaBias;
return;
- case STATE_PCM_SCALE:
- COPY_4V(value, ctx->Pixel.PostColorMatrixScale);
- return;
-
- case STATE_PCM_BIAS:
- COPY_4V(value, ctx->Pixel.PostColorMatrixBias);
- return;
-
case STATE_SHADOW_AMBIENT:
{
const int unit = (int) state[2];
return _NEW_TEXTURE_MATRIX;
case STATE_PROGRAM_MATRIX:
return _NEW_TRACK_MATRIX;
- case STATE_COLOR_MATRIX:
- return _NEW_COLOR_MATRIX;
case STATE_DEPTH_RANGE:
return _NEW_VIEWPORT;
case STATE_PT_SCALE:
case STATE_PT_BIAS:
- case STATE_PCM_SCALE:
- case STATE_PCM_BIAS:
return _NEW_PIXEL;
case STATE_FB_SIZE:
case STATE_PROGRAM_MATRIX:
append(dst, "matrix.program");
break;
- case STATE_COLOR_MATRIX:
- append(dst, "matrix.color");
- break;
case STATE_MATRIX_INVERSE:
append(dst, ".inverse");
break;
case STATE_PT_BIAS:
append(dst, "PTbias");
break;
- case STATE_PCM_SCALE:
- append(dst, "PCMscale");
- break;
- case STATE_PCM_BIAS:
- append(dst, "PCMbias");
- break;
case STATE_SHADOW_AMBIENT:
append(dst, "CompareFailValue");
break;
case STATE_MVP_MATRIX:
case STATE_TEXTURE_MATRIX:
case STATE_PROGRAM_MATRIX:
- case STATE_COLOR_MATRIX:
{
/* state[0] = modelview, projection, texture, etc. */
/* state[1] = which texture matrix or program matrix */
Elements(ctx->TextureMatrixStack) - 1);
mat = ctx->TextureMatrixStack[unit].Top;
}
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) {
- mat = ctx->ColorMatrixStack.Top;
- }
else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) {
/* XXX verify the combined matrix is up to date */
mat = &ctx->_ModelProjectMatrix;
STATE_MVP_MATRIX,
STATE_TEXTURE_MATRIX,
STATE_PROGRAM_MATRIX,
- STATE_COLOR_MATRIX,
STATE_MATRIX_INVERSE,
STATE_MATRIX_TRANSPOSE,
STATE_MATRIX_INVTRANS,
STATE_LIGHT_HALF_VECTOR, /* object vs eye space */
STATE_PT_SCALE, /**< Pixel transfer RGBA scale */
STATE_PT_BIAS, /**< Pixel transfer RGBA bias */
- STATE_PCM_SCALE, /**< Post color matrix RGBA scale */
- STATE_PCM_BIAS, /**< Post color matrix RGBA bias */
STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */
STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */
STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */
/*
* Generate fragment programs to implement pixel transfer ops, such as
- * scale/bias, colormatrix, colortable, convolution...
+ * scale/bias, colortable, convolution...
*
* Authors:
* Brian Paul
struct state_key
{
GLuint scaleAndBias:1;
- GLuint colorMatrix:1;
- GLuint colorMatrixPostScaleBias:1;
GLuint pixelMaps:1;
#if 0
#endif
};
-
-static GLboolean
-is_identity(const GLfloat m[16])
-{
- GLuint i;
- for (i = 0; i < 16; i++) {
- const int row = i % 4, col = i / 4;
- const float val = (GLfloat)(row == col);
- if (m[i] != val)
- return GL_FALSE;
- }
- return GL_TRUE;
-}
-
-
static void
make_state_key(GLcontext *ctx, struct state_key *key)
{
- static const GLfloat zero[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
- static const GLfloat one[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
-
memset(key, 0, sizeof(*key));
if (ctx->Pixel.RedBias != 0.0 || ctx->Pixel.RedScale != 1.0 ||
key->scaleAndBias = 1;
}
- if (!is_identity(ctx->ColorMatrixStack.Top->m)) {
- key->colorMatrix = 1;
- }
-
- if (!TEST_EQ_4V(ctx->Pixel.PostColorMatrixScale, one) ||
- !TEST_EQ_4V(ctx->Pixel.PostColorMatrixBias, zero)) {
- key->colorMatrixPostScaleBias = 1;
- }
-
key->pixelMaps = ctx->Pixel.MapColorFlag;
}
fp->Base.SamplersUsed |= (1 << 1); /* sampler 1 is used */
}
- if (key->colorMatrix) {
- static const gl_state_index row0_state[STATE_LENGTH] =
- { STATE_COLOR_MATRIX, 0, 0, 0, 0 };
- static const gl_state_index row1_state[STATE_LENGTH] =
- { STATE_COLOR_MATRIX, 0, 1, 1, 0 };
- static const gl_state_index row2_state[STATE_LENGTH] =
- { STATE_COLOR_MATRIX, 0, 2, 2, 0 };
- static const gl_state_index row3_state[STATE_LENGTH] =
- { STATE_COLOR_MATRIX, 0, 3, 3, 0 };
-
- GLint row0_p = _mesa_add_state_reference(params, row0_state);
- GLint row1_p = _mesa_add_state_reference(params, row1_state);
- GLint row2_p = _mesa_add_state_reference(params, row2_state);
- GLint row3_p = _mesa_add_state_reference(params, row3_state);
- const GLuint temp = 1;
-
- /* DP4 temp.x, colorTemp, matrow0; */
- _mesa_init_instructions(inst + ic, 1);
- inst[ic].Opcode = OPCODE_DP4;
- inst[ic].DstReg.File = PROGRAM_TEMPORARY;
- inst[ic].DstReg.Index = temp;
- inst[ic].DstReg.WriteMask = WRITEMASK_X;
- inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
- inst[ic].SrcReg[0].Index = colorTemp;
- inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR;
- inst[ic].SrcReg[1].Index = row0_p;
- ic++;
-
- /* DP4 temp.y, colorTemp, matrow1; */
- _mesa_init_instructions(inst + ic, 1);
- inst[ic].Opcode = OPCODE_DP4;
- inst[ic].DstReg.File = PROGRAM_TEMPORARY;
- inst[ic].DstReg.Index = temp;
- inst[ic].DstReg.WriteMask = WRITEMASK_Y;
- inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
- inst[ic].SrcReg[0].Index = colorTemp;
- inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR;
- inst[ic].SrcReg[1].Index = row1_p;
- ic++;
-
- /* DP4 temp.z, colorTemp, matrow2; */
- _mesa_init_instructions(inst + ic, 1);
- inst[ic].Opcode = OPCODE_DP4;
- inst[ic].DstReg.File = PROGRAM_TEMPORARY;
- inst[ic].DstReg.Index = temp;
- inst[ic].DstReg.WriteMask = WRITEMASK_Z;
- inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
- inst[ic].SrcReg[0].Index = colorTemp;
- inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR;
- inst[ic].SrcReg[1].Index = row2_p;
- ic++;
-
- /* DP4 temp.w, colorTemp, matrow3; */
- _mesa_init_instructions(inst + ic, 1);
- inst[ic].Opcode = OPCODE_DP4;
- inst[ic].DstReg.File = PROGRAM_TEMPORARY;
- inst[ic].DstReg.Index = temp;
- inst[ic].DstReg.WriteMask = WRITEMASK_W;
- inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
- inst[ic].SrcReg[0].Index = colorTemp;
- inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR;
- inst[ic].SrcReg[1].Index = row3_p;
- ic++;
-
- /* MOV colorTemp, temp; */
- _mesa_init_instructions(inst + ic, 1);
- inst[ic].Opcode = OPCODE_MOV;
- inst[ic].DstReg.File = PROGRAM_TEMPORARY;
- inst[ic].DstReg.Index = colorTemp;
- inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
- inst[ic].SrcReg[0].Index = temp;
- ic++;
- }
-
- if (key->colorMatrixPostScaleBias) {
- static const gl_state_index scale_state[STATE_LENGTH] =
- { STATE_INTERNAL, STATE_PT_SCALE, 0, 0, 0 };
- static const gl_state_index bias_state[STATE_LENGTH] =
- { STATE_INTERNAL, STATE_PT_BIAS, 0, 0, 0 };
- GLint scale_param, bias_param;
-
- scale_param = _mesa_add_state_reference(params, scale_state);
- bias_param = _mesa_add_state_reference(params, bias_state);
-
- _mesa_init_instructions(inst + ic, 1);
- inst[ic].Opcode = OPCODE_MAD;
- inst[ic].DstReg.File = PROGRAM_TEMPORARY;
- inst[ic].DstReg.Index = colorTemp;
- inst[ic].SrcReg[0].File = PROGRAM_TEMPORARY;
- inst[ic].SrcReg[0].Index = colorTemp;
- inst[ic].SrcReg[1].File = PROGRAM_STATE_VAR;
- inst[ic].SrcReg[1].Index = scale_param;
- inst[ic].SrcReg[2].File = PROGRAM_STATE_VAR;
- inst[ic].SrcReg[2].Index = bias_param;
- ic++;
- }
-
/* Modify last instruction's dst reg to write to result.color */
{
struct prog_instruction *last = &inst[ic - 1];
const struct st_tracked_state st_update_pixel_transfer = {
"st_update_pixel_transfer", /* name */
{ /* dirty */
- _NEW_PIXEL | _NEW_COLOR_MATRIX, /* mesa */
+ _NEW_PIXEL, /* mesa */
0, /* st */
},
update_pixel_transfer /* update */
ctx->Extensions.OES_draw_texture = GL_TRUE;
#endif
- ctx->Extensions.SGI_color_matrix = GL_TRUE;
ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
/*