ALPHA_REF_VALUE(refInt));
}
-/* This function makes sure that the proper enables are
- * set for LogicOp, Independant Alpha Blend, and Blending.
- * It needs to be called from numerous places where we
+/**
+ * Makes sure that the proper enables are set for LogicOp, Independant Alpha
+ * Blend, and Blending. It needs to be called from numerous places where we
* could change the LogicOp or Independant Alpha Blend without subsequent
* calls to glEnable.
+ *
+ * \todo
+ * This function is substantially different from the old i830-specific driver.
+ * I'm not sure which is correct.
*/
static void i830EvalLogicOpBlendState(GLcontext *ctx)
{
i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = (a<<24) | (r<<16) | (g<<8) | b;
}
-static void i830BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB,
- GLenum modeA)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- int func = ENABLE_ALPHA_BLENDFUNC;
-
- assert( modeRGB == modeA );
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(modeRGB));
-
- /* This will catch a logicop blend equation */
- i830EvalLogicOpBlendState(ctx);
-
- switch(modeRGB) {
- case GL_FUNC_ADD:
- func |= BLENDFUNC_ADD;
- break;
- case GL_MIN:
- func |= BLENDFUNC_MIN;
- break;
- case GL_MAX:
- func |= BLENDFUNC_MAX;
- break;
- case GL_FUNC_SUBTRACT:
- func |= BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- func |= BLENDFUNC_RVRSE_SUB;
- break;
- case GL_LOGIC_OP:
- default: return;
- }
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE1] &= ~BLENDFUNC_MASK;
- i830->state.Ctx[I830_CTXREG_STATE1] |= func;
-}
-
-
+/**
+ * Calculate the hardware blend factor setting. This same function is used
+ * for source and destination of both alpha and RGB.
+ *
+ * \returns
+ * The hardware register value for the specified blend factor. This value
+ * will need to be shifted into the correct position for either source or
+ * destination factor.
+ */
static int translate_blend_factor( GLenum factor )
{
switch(factor) {
}
}
-static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
+
+/**
+ * Sets both the blend equation (called "function" in i830 docs) and the
+ * blend function (called "factor" in i830 docs). This is done in a single
+ * function because some blend equations (i.e., \c GL_MIN and \c GL_MAX)
+ * change the interpretation of the blend function.
+ */
+static void i830_set_blend_state( GLcontext * ctx )
{
i830ContextPtr i830 = I830_CONTEXT(ctx);
- int iab = i830->state.Ctx[I830_CTXREG_IALPHAB];
- int s1 = i830->state.Ctx[I830_CTXREG_STATE1];
+ int funcA;
+ int funcRGB;
+ int eqnA;
+ int eqnRGB;
+ int iab;
+ int s1;
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
+ funcRGB = SRC_BLND_FACT( translate_blend_factor( ctx->Color.BlendSrcRGB ) )
+ | DST_BLND_FACT( translate_blend_factor( ctx->Color.BlendDstRGB ) );
- iab &= ~(SRC_DST_ABLEND_MASK|ENABLE_INDPT_ALPHA_BLEND);
- s1 &= ~SRC_DST_BLND_MASK;
-
- iab |= (ENABLE_SRC_ABLEND_FACTOR|ENABLE_DST_ABLEND_FACTOR);
- s1 |= (ENABLE_SRC_BLND_FACTOR|ENABLE_DST_BLND_FACTOR);
+ switch(ctx->Color.BlendEquationRGB) {
+ case GL_FUNC_ADD:
+ eqnRGB = BLENDFUNC_ADD;
+ break;
+ case GL_MIN:
+ eqnRGB = BLENDFUNC_MIN;
+ funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
+ break;
+ case GL_MAX:
+ eqnRGB = BLENDFUNC_MAX;
+ funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
+ break;
+ case GL_FUNC_SUBTRACT:
+ eqnRGB = BLENDFUNC_SUB;
+ break;
+ case GL_FUNC_REVERSE_SUBTRACT:
+ eqnRGB = BLENDFUNC_RVRSE_SUB;
+ break;
+ default:
+ fprintf( stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n",
+ __func__, __LINE__, ctx->Color.BlendEquationRGB );
+ return;
+ }
+
+
+ funcA = SRC_ABLEND_FACT( translate_blend_factor( ctx->Color.BlendSrcA ) )
+ | DST_ABLEND_FACT( translate_blend_factor( ctx->Color.BlendDstA ) );
- if (ctx->Color.BlendEquationRGB == GL_MIN ||
- ctx->Color.BlendEquationRGB == GL_MAX) {
- sfactorA = sfactorRGB = dfactorA = dfactorRGB = GL_ONE;
+ switch(ctx->Color.BlendEquationA) {
+ case GL_FUNC_ADD:
+ eqnA = BLENDFUNC_ADD;
+ break;
+ case GL_MIN:
+ eqnA = BLENDFUNC_MIN;
+ funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
+ break;
+ case GL_MAX:
+ eqnA = BLENDFUNC_MAX;
+ funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
+ break;
+ case GL_FUNC_SUBTRACT:
+ eqnA = BLENDFUNC_SUB;
+ break;
+ case GL_FUNC_REVERSE_SUBTRACT:
+ eqnA = BLENDFUNC_RVRSE_SUB;
+ break;
+ default:
+ fprintf( stderr, "[%s:%u] Invalid alpha blend equation (0x%04x).\n",
+ __func__, __LINE__, ctx->Color.BlendEquationA );
+ return;
}
- iab |= SRC_ABLEND_FACT(translate_blend_factor(sfactorA));
- iab |= DST_ABLEND_FACT(translate_blend_factor(dfactorA));
- s1 |= SRC_BLND_FACT(translate_blend_factor(sfactorRGB));
- s1 |= DST_BLND_FACT(translate_blend_factor(dfactorRGB));
+ iab = eqnA | funcA
+ | _3DSTATE_INDPT_ALPHA_BLEND_CMD
+ | ENABLE_SRC_ABLEND_FACTOR | ENABLE_DST_ABLEND_FACTOR
+ | ENABLE_ALPHA_BLENDFUNC;
+ s1 = eqnRGB | funcRGB
+ | _3DSTATE_MODES_1_CMD
+ | ENABLE_SRC_BLND_FACTOR | ENABLE_DST_BLND_FACTOR
+ | ENABLE_COLR_BLND_FUNC;
- if (sfactorA != sfactorRGB || dfactorA != dfactorRGB)
+ if ( (eqnA | funcA) != (eqnRGB | funcRGB) )
iab |= ENABLE_INDPT_ALPHA_BLEND;
else
iab |= DISABLE_INDPT_ALPHA_BLEND;
i830->state.Ctx[I830_CTXREG_IALPHAB] = iab;
i830->state.Ctx[I830_CTXREG_STATE1] = s1;
}
+
+ /* This will catch a logicop blend equation. It will also ensure
+ * independant alpha blend is really in the correct state (either enabled
+ * or disabled) if blending is already enabled.
+ */
+
+ i830EvalLogicOpBlendState(ctx);
+
+ if (0) {
+ fprintf(stderr, "[%s:%u] STATE1: 0x%08x IALPHAB: 0x%08x blend is %sabled\n",
+ __func__, __LINE__,
+ i830->state.Ctx[I830_CTXREG_STATE1],
+ i830->state.Ctx[I830_CTXREG_IALPHAB],
+ (ctx->Color.BlendEnabled) ? "en" : "dis");
+ }
+}
+
+
+static void i830BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB,
+ GLenum modeA)
+{
+ if (INTEL_DEBUG&DEBUG_DRI)
+ fprintf(stderr, "%s -> %s, %s\n", __FUNCTION__,
+ _mesa_lookup_enum_by_nr(modeRGB),
+ _mesa_lookup_enum_by_nr(modeA));
+
+ (void) modeRGB;
+ (void) modeA;
+ i830_set_blend_state( ctx );
+}
+
+
+static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
+ GLenum dfactorRGB, GLenum sfactorA,
+ GLenum dfactorA )
+{
+ if (INTEL_DEBUG&DEBUG_DRI)
+ fprintf(stderr, "%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__,
+ _mesa_lookup_enum_by_nr(sfactorRGB),
+ _mesa_lookup_enum_by_nr(dfactorRGB),
+ _mesa_lookup_enum_by_nr(sfactorA),
+ _mesa_lookup_enum_by_nr(dfactorA));
+
+ (void) sfactorRGB;
+ (void) dfactorRGB;
+ (void) sfactorA;
+ (void) dfactorA;
+ i830_set_blend_state( ctx );
}
}
-GLuint i830SetBlend_GL1_2(i830ContextPtr i830, int blendUnit,
- GLenum envMode, GLenum format, GLuint texel_op,
- GLuint *state, const GLfloat *factor)
+/**
+ * Calculate the hardware instuctions to setup the current texture enviromnemt
+ * settings. Since \c gl_texture_unit::_CurrentCombine is used, both
+ * "classic" texture enviroments and GL_ARB_texture_env_combine type texture
+ * environments are treated identically.
+ *
+ * \todo
+ * This function should return \c GLboolean. When \c GL_FALSE is returned,
+ * it means that an environment is selected that the hardware cannot do. This
+ * is the way the Radeon and R200 drivers work.
+ *
+ * \todo
+ * Looking at i830_3d_regs.h, it seems the i830 can do part of
+ * GL_ATI_texture_env_combine3. It can handle using \c GL_ONE and
+ * \c GL_ZERO as combine inputs (which the code already supports). It can
+ * also handle the \c GL_MODULATE_ADD_ATI mode. Is it worth investigating
+ * partial support for the extension?
+ */
+GLuint
+i830SetTexEnvCombine(i830ContextPtr i830,
+ const struct gl_tex_env_combine_state * combine,
+ GLint blendUnit,
+ GLuint texel_op,
+ GLuint *state,
+ const GLfloat *factor )
{
- if(INTEL_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s %s %s texel_op(0x%x)\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(envMode),
- texel_op);
-
- switch(envMode) {
- case GL_REPLACE:
- switch(format) {
- case GL_ALPHA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- return 4;
-
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 4;
-
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- return 4;
-
- default:
- /* Always set to passthru if something is funny */
- return pass_through( state, blendUnit );
- }
-
- case GL_MODULATE:
- switch(format) {
- case GL_ALPHA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 5;
-
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 5;
-
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 6;
-
- default:
- /* Always set to passthru if something is funny */
- return pass_through( state, blendUnit );
- }
-
- case GL_DECAL:
- switch(format) {
- case GL_RGB:
- case GL_YCBCR_MESA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 4;
-
- case GL_RGBA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_REPLICATE_ALPHA |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 6;
- default:
- /* Always set to passthru if something is funny */
- return pass_through( state, blendUnit );
- }
-
- case GL_BLEND:
- switch(format) {
- case GL_ALPHA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 5;
-
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return emit_factor( blendUnit, state, 6, factor );
-
- case GL_INTENSITY:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[6] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- state[7] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return emit_factor( blendUnit, state, 8, factor );
-
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_BLEND);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_FACTOR_N);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[6] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return emit_factor( blendUnit, state, 7, factor );
-
- default:
- /* Always set to passthru if something is funny */
- return pass_through( state, blendUnit );
- }
-
- case GL_ADD:
- switch(format) {
- case GL_ALPHA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 5;
-
- case GL_LUMINANCE:
- case GL_RGB:
- case GL_YCBCR_MESA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 5;
-
- case GL_INTENSITY:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 6;
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ADD);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_MODULATE);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[4] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- texel_op);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- return 6;
-
- default:
- /* Always set to passthru if something is funny */
- return pass_through( state, blendUnit );
- }
+ const GLuint numColorArgs = combine->_NumArgsRGB;
+ const GLuint numAlphaArgs = combine->_NumArgsA;
- default:
- /* Always set to passthru if something is funny */
- return pass_through( state, blendUnit );
- }
-}
-
-static GLuint i830SetTexEnvCombine(i830ContextPtr i830,
- const struct gl_texture_unit *texUnit,
- GLint blendUnit,
- GLuint texel_op,
- GLuint *state,
- const GLfloat *factor )
-{
GLuint blendop;
GLuint ablendop;
GLuint args_RGB[3];
GLuint alpha_shift;
GLboolean need_factor = 0;
int i;
+ unsigned used;
+ static const GLuint tex_blend_rgb[3] = {
+ TEXPIPE_COLOR | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
+ TEXPIPE_COLOR | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
+ TEXPIPE_COLOR | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
+ };
+ static const GLuint tex_blend_a[3] = {
+ TEXPIPE_ALPHA | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
+ TEXPIPE_ALPHA | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
+ TEXPIPE_ALPHA | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
+ };
+ static const GLuint op_rgb[4] = {
+ 0,
+ TEXBLENDARG_INV_ARG,
+ TEXBLENDARG_REPLICATE_ALPHA,
+ TEXBLENDARG_REPLICATE_ALPHA | TEXBLENDARG_INV_ARG,
+ };
if(INTEL_DEBUG&DEBUG_TEXTURE)
fprintf(stderr, "%s\n", __FUNCTION__);
* scale factor, but the ARB version (and the version in OpenGL
* 1.3) does.
*/
- switch (texUnit->Combine.ModeRGB) {
+ switch (combine->ModeRGB) {
case GL_DOT3_RGB_EXT:
- alpha_shift = texUnit->Combine.ScaleShiftA;
+ alpha_shift = combine->ScaleShiftA;
rgb_shift = 0;
break;
break;
default:
- rgb_shift = texUnit->Combine.ScaleShiftRGB;
- alpha_shift = texUnit->Combine.ScaleShiftA;
+ rgb_shift = combine->ScaleShiftRGB;
+ alpha_shift = combine->ScaleShiftA;
break;
}
- switch(texUnit->Combine.ModeRGB) {
+ switch(combine->ModeRGB) {
case GL_REPLACE:
blendop = TEXBLENDOP_ARG1;
break;
/* Handle RGB args */
for(i = 0; i < 3; i++) {
- switch(texUnit->Combine.SourceRGB[i]) {
+ switch(combine->SourceRGB[i]) {
case GL_TEXTURE:
args_RGB[i] = texel_op;
break;
+ case GL_TEXTURE0:
+ case GL_TEXTURE1:
+ case GL_TEXTURE2:
+ case GL_TEXTURE3:
+ args_RGB[i] = GetTexelOp( combine->SourceRGB[i] - GL_TEXTURE0 );
+ break;
case GL_CONSTANT:
args_RGB[i] = TEXBLENDARG_FACTOR_N;
need_factor = 1;
return pass_through( state, blendUnit );
}
- switch(texUnit->Combine.OperandRGB[i]) {
+ switch(combine->OperandRGB[i]) {
case GL_SRC_COLOR:
args_RGB[i] |= 0;
break;
* Note - the global factor is set up with alpha == .5, so
* the alpha part of the DOT4 calculation should be zero.
*/
- if ( texUnit->Combine.ModeRGB == GL_DOT3_RGBA_EXT ||
- texUnit->Combine.ModeRGB == GL_DOT3_RGBA ) {
+ if ( combine->ModeRGB == GL_DOT3_RGBA_EXT ||
+ combine->ModeRGB == GL_DOT3_RGBA ) {
ablendop = TEXBLENDOP_DOT4;
args_A[0] = TEXBLENDARG_FACTOR; /* the global factor */
args_A[1] = TEXBLENDARG_FACTOR;
args_A[2] = TEXBLENDARG_FACTOR;
}
else {
- switch(texUnit->Combine.ModeA) {
+ switch(combine->ModeA) {
case GL_REPLACE:
ablendop = TEXBLENDOP_ARG1;
break;
/* Handle A args */
for(i = 0; i < 3; i++) {
- switch(texUnit->Combine.SourceA[i]) {
+ switch(combine->SourceA[i]) {
case GL_TEXTURE:
args_A[i] = texel_op;
break;
+ case GL_TEXTURE0:
+ case GL_TEXTURE1:
+ case GL_TEXTURE2:
+ case GL_TEXTURE3:
+ args_A[i] = GetTexelOp( combine->SourceA[i] - GL_TEXTURE0 );
+ break;
case GL_CONSTANT:
args_A[i] = TEXBLENDARG_FACTOR_N;
need_factor = 1;
return pass_through( state, blendUnit );
}
- switch(texUnit->Combine.OperandA[i]) {
+ switch(combine->OperandA[i]) {
case GL_SRC_ALPHA:
args_A[i] |= 0;
break;
*/
- /* Build color pipeline */
-
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_MODIFY_PARMS |
- blendop);
- state[1] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- args_RGB[0]);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- args_RGB[1]);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- args_RGB[2]);
+ /* Build color & alpha pipelines */
+
+ used = 0;
+ state[used++] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
+ TEXPIPE_COLOR |
+ ENABLE_TEXOUTPUT_WRT_SEL |
+ TEXOP_OUTPUT_CURRENT |
+ DISABLE_TEX_CNTRL_STAGE |
+ TEXOP_MODIFY_PARMS |
+ blendop);
+ state[used++] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
+ TEXPIPE_ALPHA |
+ ENABLE_TEXOUTPUT_WRT_SEL |
+ TEXOP_OUTPUT_CURRENT |
+ TEXOP_MODIFY_PARMS |
+ ablendop);
+
+ for ( i = 0 ; i < numColorArgs ; i++ ) {
+ state[used++] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
+ tex_blend_rgb[i] | args_RGB[i]);
+ }
- /* Build Alpha pipeline */
- state[4] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_MODIFY_PARMS |
- ablendop);
- state[5] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- args_A[0]);
- state[6] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- args_A[1]);
- state[7] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG0 |
- TEXBLENDARG_MODIFY_PARMS |
- args_A[2]);
+ for ( i = 0 ; i < numAlphaArgs ; i++ ) {
+ state[used++] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
+ tex_blend_a[i] | args_A[i]);
+ }
if (need_factor)
- return emit_factor( blendUnit, state, 8, factor );
+ return emit_factor( blendUnit, state, used, factor );
else
- return 8;
+ return used;
}
/* Update i830->state.TexBlend
*/
- if (texUnit->EnvMode == GL_COMBINE) {
- tmp_sz = i830SetTexEnvCombine(i830, texUnit, blendUnit,
- GetTexelOp(unit), tmp,
- texUnit->EnvColor );
- }
- else {
- tmp_sz = i830SetBlend_GL1_2(i830, blendUnit, texUnit->EnvMode,
- t->intel.image[0][0].internalFormat,
- GetTexelOp(unit), tmp,
- texUnit->EnvColor );
- }
+ tmp_sz = i830SetTexEnvCombine(i830, texUnit->_CurrentCombine, blendUnit,
+ GetTexelOp(unit), tmp,
+ texUnit->EnvColor );
if (last_stage)
tmp[0] |= TEXOP_LAST_STAGE;