removed ifdef'ed out code (to whom it may concern: it can be found in dri/tdfx driver)
authorDaniel Borca <dborca@users.sourceforge.net>
Mon, 20 Dec 2004 08:19:28 +0000 (08:19 +0000)
committerDaniel Borca <dborca@users.sourceforge.net>
Mon, 20 Dec 2004 08:19:28 +0000 (08:19 +0000)
src/mesa/drivers/glide/fxsetup.h

index 071b234a54a4c8a04eebe0ea5e7c6f140aa5e6ef..9d337d4b0dbb88d481c364edce74b7344927827c 100644 (file)
@@ -560,401 +560,7 @@ fxSetupTextureEnvNapalm_NoLock(GLcontext * ctx, GLuint textureset, GLuint tmu, G
          (((GLuint)(envColor[2] * 255.0f)) << 16) |
          (((GLuint)(envColor[3] * 255.0f)) << 24));
       break;
-#if 0
-        {
-            FxU32 A_RGB, B_RGB, C_RGB, D_RGB;
-            FxU32 Amode_RGB, Bmode_RGB;
-            FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB;
-            FxU32 Shift_RGB;
-            FxU32 A_A, B_A, C_A, D_A;
-            FxU32 Amode_A, Bmode_A;
-            FxBool Cinv_A, Dinv_A, Ginv_A;
-            FxU32 Shift_A;
-
-           /*
-            *
-            * In the formulas below, we write:
-            *  o "1(x)" for the identity function applied to x,
-            *    so 1(x) = x.
-            *  o "0(x)" for the constant function 0, so
-            *    0(x) = 0 for all values of x.
-            *
-            * Calculate the color combination.
-            */
-            Shift_RGB = texUnit->CombineScaleShiftRGB;
-            Shift_A = texUnit->CombineScaleShiftA;
-            switch (texUnit->CombineModeRGB) {
-            case GL_REPLACE:
-               /*
-                * The formula is: Arg0
-                * We implement this by the formula:
-                *   (Arg0 + 0(0))*(1-0) + 0
-                */
-                TEXENV_SETUP_ARG_RGB(A_RGB,
-                                     texUnit->CombineSourceRGB[0],
-                                     texUnit->CombineOperandRGB[0],
-                                     incomingRGB, incomingAlpha);
-                TEXENV_SETUP_MODE_RGB(Amode_RGB,
-                                      texUnit->CombineOperandRGB[0]);
-                B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
-                Bmode_RGB = GR_FUNC_MODE_ZERO;
-                Cinv_RGB = FXTRUE;
-                Dinv_RGB = Ginv_RGB = FXFALSE;
-                break;
-            case GL_MODULATE:
-               /*
-                * The formula is: Arg0 * Arg1
-                *
-                * We implement this by the formula
-                *   (Arg0 + 0(0)) * Arg1 + 0(0)
-                */
-                TEXENV_SETUP_ARG_RGB(A_RGB,
-                                     texUnit->CombineSourceRGB[0],
-                                     texUnit->CombineOperandRGB[0],
-                                     incomingRGB, incomingAlpha);
-                TEXENV_SETUP_MODE_RGB(Amode_RGB,
-                                      texUnit->CombineOperandRGB[0]);
-                B_RGB = GR_CMBX_ZERO;
-                Bmode_RGB = GR_CMBX_ZERO;
-                TEXENV_SETUP_ARG_RGB(C_RGB,
-                                     texUnit->CombineSourceRGB[1],
-                                     texUnit->CombineOperandRGB[1],
-                                     incomingRGB, incomingAlpha);
-                Cinv_RGB = TEXENV_OPERAND_INVERTED
-                               (texUnit->CombineOperandRGB[1]);
-                D_RGB = GR_CMBX_ZERO;
-                Dinv_RGB = Ginv_RGB = FXFALSE;
-                break;
-            case GL_ADD:
-               /*
-                * The formula is Arg0 + Arg1
-                */
-                TEXENV_SETUP_ARG_RGB(A_RGB,
-                                     texUnit->CombineSourceRGB[0],
-                                     texUnit->CombineOperandRGB[0],
-                                     incomingRGB, incomingAlpha);
-                TEXENV_SETUP_MODE_RGB(Amode_RGB,
-                                      texUnit->CombineOperandRGB[0]);
-                TEXENV_SETUP_ARG_RGB(B_RGB,
-                                     texUnit->CombineSourceRGB[1],
-                                     texUnit->CombineOperandRGB[1],
-                                     incomingRGB, incomingAlpha);
-                TEXENV_SETUP_MODE_RGB(Bmode_RGB,
-                                      texUnit->CombineOperandRGB[1]);
-                C_RGB = D_RGB = GR_CMBX_ZERO;
-                Cinv_RGB = FXTRUE;
-                Dinv_RGB = Ginv_RGB = FXFALSE;
-                break;
-            case GL_ADD_SIGNED_EXT:
-               /*
-                * The formula is: Arg0 + Arg1 - 0.5.
-                * We compute this by calculating:
-                *      (Arg0 - 1/2) + Arg1         if op0 is SRC_{COLOR,ALPHA}
-                *      Arg0 + (Arg1 - 1/2)         if op1 is SRC_{COLOR,ALPHA}
-                * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
-                * we cannot implement the formula properly.
-                */
-                TEXENV_SETUP_ARG_RGB(A_RGB,
-                                     texUnit->CombineSourceRGB[0],
-                                     texUnit->CombineOperandRGB[0],
-                                     incomingRGB, incomingAlpha);
-                TEXENV_SETUP_ARG_RGB(B_RGB,
-                                     texUnit->CombineSourceRGB[1],
-                                     texUnit->CombineOperandRGB[1],
-                                     incomingRGB, incomingAlpha);
-                if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) {
-                   /*
-                    * A is not inverted.  So, choose it.
-                    */
-                    Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
-                    if (!TEXENV_OPERAND_INVERTED
-                            (texUnit->CombineOperandRGB[1])) {
-                        Bmode_RGB = GR_FUNC_MODE_X;
-                    }
-                    else {
-                        Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
-                    }
-                }
-                else {
-                   /*
-                    * A is inverted, so try to subtract 1/2
-                    * from B.
-                    */
-                    Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
-                    if (!TEXENV_OPERAND_INVERTED
-                            (texUnit->CombineOperandRGB[1])) {
-                        Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
-                    }
-                    else {
-                       /*
-                        * Both are inverted.  This is the case
-                        * we cannot handle properly.  We just
-                        * choose to not add the - 1/2.
-                        */
-                        Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
-                        return GL_FALSE;
-                    }
-                }
-                C_RGB = D_RGB = GR_CMBX_ZERO;
-                Cinv_RGB = FXTRUE;
-                Dinv_RGB = Ginv_RGB = FXFALSE;
-                break;
-            case GL_INTERPOLATE_EXT:
-               /*
-                * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
-                * We compute this by the formula:
-                *            (Arg0 - Arg1) * Arg2 + Arg1
-                *               == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
-                *               == Arg0 * Arg2 + Arg1 * (1 - Arg2)
-                * However, if both Arg1 is ONE_MINUS_X, the HW does
-                * not support it properly.
-                */
-                TEXENV_SETUP_ARG_RGB(A_RGB,
-                                     texUnit->CombineSourceRGB[0],
-                                     texUnit->CombineOperandRGB[0],
-                                     incomingRGB, incomingAlpha);
-                TEXENV_SETUP_MODE_RGB(Amode_RGB,
-                                      texUnit->CombineOperandRGB[0]);
-                TEXENV_SETUP_ARG_RGB(B_RGB,
-                                     texUnit->CombineSourceRGB[1],
-                                     texUnit->CombineOperandRGB[1],
-                                     incomingRGB, incomingAlpha);
-                if (TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) {
-                   /*
-                    * This case is wrong.
-                    */
-                   Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
-                   return GL_FALSE;
-                }
-                else {
-                    Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
-                }
-               /*
-                * The Source/Operand for the C value must
-                * specify some kind of alpha value.
-                */
-                TEXENV_SETUP_ARG_A(C_RGB,
-                                   texUnit->CombineSourceRGB[2],
-                                   texUnit->CombineOperandRGB[2],
-                                   incomingAlpha);
-                Cinv_RGB = FXFALSE;
-                D_RGB = GR_CMBX_B;
-                Dinv_RGB = Ginv_RGB = FXFALSE;
-                break;
-            default:
-               /*
-                * This is here mostly to keep from getting
-                * a compiler warning about these not being set.
-                * However, this should set all the texture values
-                * to zero.
-                */
-                A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
-                Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X;
-                Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE;
-                break;
-            }
-           /*
-            * Calculate the alpha combination.
-            */
-            switch (texUnit->CombineModeA) {
-            case GL_REPLACE:
-               /*
-                * The formula is: Arg0
-                * We implement this by the formula:
-                *   (Arg0 + 0(0))*(1-0) + 0
-                */
-                TEXENV_SETUP_ARG_A(A_A,
-                                   texUnit->CombineSourceA[0],
-                                   texUnit->CombineOperandA[0],
-                                   incomingAlpha);
-                TEXENV_SETUP_MODE_A(Amode_A,
-                                    texUnit->CombineOperandA[0]);
-                B_A = GR_CMBX_ITALPHA;
-                Bmode_A = GR_FUNC_MODE_ZERO;
-                C_A = D_A = GR_CMBX_ZERO;
-                Cinv_A = FXTRUE;
-                Dinv_A = Ginv_A = FXFALSE;
-                break;
-            case GL_MODULATE:
-               /*
-                * The formula is: Arg0 * Arg1
-                *
-                * We implement this by the formula
-                *   (Arg0 + 0(0)) * Arg1 + 0(0)
-                */
-                TEXENV_SETUP_ARG_A(A_A,
-                                   texUnit->CombineSourceA[0],
-                                   texUnit->CombineOperandA[0],
-                                   incomingAlpha);
-                TEXENV_SETUP_MODE_A(Amode_A,
-                                    texUnit->CombineOperandA[0]);
-                B_A = GR_CMBX_ZERO;
-                Bmode_A = GR_CMBX_ZERO;
-                TEXENV_SETUP_ARG_A(C_A,
-                                   texUnit->CombineSourceA[1],
-                                   texUnit->CombineOperandA[1],
-                                   incomingAlpha);
-                Cinv_A = TEXENV_OPERAND_INVERTED
-                               (texUnit->CombineOperandA[1]);
-                D_A = GR_CMBX_ZERO;
-                Dinv_A = Ginv_A = FXFALSE;
-                break;
-            case GL_ADD:
-               /*
-                * The formula is Arg0 + Arg1
-                */
-                TEXENV_SETUP_ARG_A(A_A,
-                                   texUnit->CombineSourceA[0],
-                                   texUnit->CombineOperandA[0],
-                                   incomingAlpha);
-                TEXENV_SETUP_MODE_A(Amode_A,
-                                    texUnit->CombineOperandA[0]);
-                TEXENV_SETUP_ARG_A(B_A,
-                                   texUnit->CombineSourceA[1],
-                                   texUnit->CombineOperandA[1],
-                                   incomingAlpha);
-                TEXENV_SETUP_MODE_A(Bmode_A,
-                                    texUnit->CombineOperandA[1]);
-                C_A = D_A = GR_CMBX_ZERO;
-                Cinv_A = FXTRUE;
-                Dinv_A = Ginv_A = FXFALSE;
-                break;
-            case GL_ADD_SIGNED_EXT:
-               /*
-                * The formula is: Arg0 + Arg1 - 0.5.
-                * We compute this by calculating:
-                *      (Arg0 - 1/2) + Arg1         if op0 is SRC_{COLOR,ALPHA}
-                *      Arg0 + (Arg1 - 1/2)         if op1 is SRC_{COLOR,ALPHA}
-                * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
-                * we cannot implement the formula properly.
-                */
-                TEXENV_SETUP_ARG_A(A_A,
-                                   texUnit->CombineSourceA[0],
-                                   texUnit->CombineOperandA[0],
-                                   incomingAlpha);
-                TEXENV_SETUP_ARG_A(B_A,
-                                   texUnit->CombineSourceA[1],
-                                   texUnit->CombineOperandA[1],
-                                   incomingAlpha);
-                if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) {
-                   /*
-                    * A is not inverted.  So, choose it.
-                    */
-                    Amode_A = GR_FUNC_MODE_X_MINUS_HALF;
-                    if (!TEXENV_OPERAND_INVERTED
-                            (texUnit->CombineOperandA[1])) {
-                        Bmode_A = GR_FUNC_MODE_X;
-                    } else {
-                        Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
-                    }
-                } else {
-                   /*
-                    * A is inverted, so try to subtract 1/2
-                    * from B.
-                    */
-                    Amode_A = GR_FUNC_MODE_ONE_MINUS_X;
-                    if (!TEXENV_OPERAND_INVERTED
-                            (texUnit->CombineOperandA[1])) {
-                        Bmode_A = GR_FUNC_MODE_X_MINUS_HALF;
-                    } else {
-                       /*
-                        * Both are inverted.  This is the case
-                        * we cannot handle properly.  We just
-                        * choose to not add the - 1/2.
-                        */
-                        Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
-                        return GL_FALSE;
-                    }
-                }
-                C_A = D_A = GR_CMBX_ZERO;
-                Cinv_A = FXTRUE;
-                Dinv_A = Ginv_A = FXFALSE;
-                break;
-            case GL_INTERPOLATE_EXT:
-               /*
-                * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
-                * We compute this by the formula:
-                *            (Arg0 - Arg1) * Arg2 + Arg1
-                *               == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
-                *               == Arg0 * Arg2 + Arg1 * (1 - Arg2)
-                * However, if both Arg1 is ONE_MINUS_X, the HW does
-                * not support it properly.
-                */
-                TEXENV_SETUP_ARG_A(A_A,
-                                   texUnit->CombineSourceA[0],
-                                   texUnit->CombineOperandA[0],
-                                   incomingAlpha);
-                TEXENV_SETUP_MODE_A(Amode_A,
-                                    texUnit->CombineOperandA[0]);
-                TEXENV_SETUP_ARG_A(B_A,
-                                   texUnit->CombineSourceA[1],
-                                   texUnit->CombineOperandA[1],
-                                   incomingAlpha);
-                if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) {
-                    Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
-                }
-                else {
-                   /*
-                    * This case is wrong.
-                    */
-                    Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
-                    return GL_FALSE;
-                }
-               /*
-                * The Source/Operand for the C value must
-                * specify some kind of alpha value.
-                */
-                TEXENV_SETUP_ARG_A(C_A,
-                                   texUnit->CombineSourceA[2],
-                                   texUnit->CombineOperandA[2],
-                                   incomingAlpha);
-                Cinv_A = FXFALSE;
-                D_A = GR_CMBX_B;
-                Dinv_A = Ginv_A = FXFALSE;
-                break;
-            default:
-               /*
-                * This is here mostly to keep from getting
-                * a compiler warning about these not being set.
-                * However, this should set all the alpha values
-                * to one.
-                */
-                A_A = B_A = C_A = D_A = GR_CMBX_ZERO;
-                Amode_A = Bmode_A = GR_FUNC_MODE_X;
-                Cinv_A = Dinv_A = FXFALSE;
-                Ginv_A = FXTRUE;
-                break;
-            }
-           /*
-            * Save the parameters.
-            */
-            env->Color.SourceA = A_RGB;
-            env->Color.ModeA = Amode_RGB;
-            env->Color.SourceB = B_RGB;
-            env->Color.ModeB = Bmode_RGB;
-            env->Color.SourceC = C_RGB;
-            env->Color.InvertC = Cinv_RGB;
-            env->Color.SourceD = D_RGB;
-            env->Color.InvertD = Dinv_RGB;
-            env->Color.Shift = Shift_RGB;
-            env->Color.Invert = Ginv_RGB;
-            env->Alpha.SourceA = A_A;
-            env->Alpha.ModeA = Amode_A;
-            env->Alpha.SourceB = B_A;
-            env->Alpha.ModeB = Bmode_A;
-            env->Alpha.SourceC = C_A;
-            env->Alpha.InvertC = Cinv_A;
-            env->Alpha.SourceD = D_A;
-            env->Alpha.InvertD = Dinv_A;
-            env->Alpha.Shift = Shift_A;
-            env->Alpha.Invert = Ginv_A;
-            env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F,
-                                        texUnit->EnvColor[1] * 255.0F,
-                                        texUnit->EnvColor[2] * 255.0F,
-                                        texUnit->EnvColor[3] * 255.0F);
-        }
-        break;
-#endif
+
    default:
       if (TDFX_DEBUG & VERBOSE_DRIVER) {
         fprintf(stderr, "fxSetupTextureEnvNapalm_NoLock: %x Texture.EnvMode not yet supported\n",