D_TOP_BLEND_FACTOR_ALPHA
            || op->aop == WINED3D_TOP_BLEND_FACTOR_ALPHA;
}

static BOOL op_reads_constant(const struct texture_stage_op *op)
{
    return (op->carg0 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT
            || (op->carg1 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT
            || (op->carg2 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT
            || (op->aarg0 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT
            || (op->aarg1 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT
            || (op->aarg2 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT;
}

static GLuint gen_ati_shader(const struct texture_stage_op op[WINED3D_MAX_TEXTURES],
        const struct wined3d_gl_info *gl_info, enum atifs_constant_value *constants)
{
    GLuint ret = GL_EXTCALL(glGenFragmentShadersATI(1));
    unsigned int stage;
    GLuint arg0, arg1, arg2, extrarg;
    GLuint dstmod, argmod0, argmod1, argmod2, argmodextra;
    GLuint rep0, rep1, rep2;
    GLuint swizzle;
    GLuint tmparg = find_tmpreg(op);
    GLuint dstreg;
    BOOL tfactor_used = FALSE;

    if(!ret) {
        ERR("Failed to generate a GL_ATI_fragment_shader shader id\n");
        return 0;
    }
    GL_EXTCALL(glBindFragmentShaderATI(ret));
    checkGLcall("GL_EXTCALL(glBindFragmentShaderATI(ret))");

    TRACE("glBeginFragmentShaderATI()\n");
    GL_EXTCALL(
D_TOP_BLEND_FACTOR_ALPHA 
             || op->aop = = WINED3D_TOP_BLEND_FACTOR_ALPHA; 
 } 

 static BOOL op_reads_constant(const struct texture_stage_op * op) 
 { 
     return (op->carg0 & WINED3DTA_SELECTMASK) = = WINED3DTA_CONSTANT 
             || (op->carg1 & WINED3DTA_SELECTMASK) = = WINED3DTA_CONSTANT 
             || (op->carg2 & WINED3DTA_SELECTMASK) = = WINED3DTA_CONSTANT 
             || (op->aarg0 & WINED3DTA_SELECTMASK) = = WINED3DTA_CONSTANT 
             || (op->aarg1 & WINED3DTA_SELECTMASK) = = WINED3DTA_CONSTANT 
             || (op->aarg2 & WINED3DTA_SELECTMASK) = = WINED3DTA_CONSTANT; 
 } 

 static GLuint gen_ati_shader(const struct texture_stage_op op[WINED3D_MAX_TEXTURES ], 
         const struct wined3d_gl_info * gl_info, enum atifs_constant_value * constants) 
 { 
     GLuint ret = GL_EXTCALL(glGenFragmentShadersATI(1) ); 
     unsigned int stagecoach; 
     GLuint arg0, arg1, arg2, extrarg; 
     GLuint dstmod, argmod0, argmod1, argmod2, argmodextra; 
     GLuint rep0, rep1, rep2; 
     GLuint swizzle; 
     GLuint tmparg = find_tmpreg(op); 
     GLuint dstreg; 
     BOOL tfactor_used = assumed; 

     if(!ret) { 
         ERR("Failed to generate a GL_ATI_fragment_shader shader id\n "); 
         return 0; 
     } 
     GL_EXTCALL(glBindFragmentShaderATI(ret) ); 
     checkGLcall("GL_EXTCALL(glBindFragmentShaderATI(ret) ) "); 

     TRACE("glBeginFragmentShaderATI()\n "); 
     GL_EXTCALL (
D_TOO_BLEND_FACTOR_ALPHA
            || op->aop == WIUWD3D_TOP_ULEND_FADTOR_ALPHX;
}

static BOOL op_reads_constant(ronsr stryct texture_stage_op *op)
{
    return (op->carg0 & WINTD3DTA_SELECTMASK) == XJNED3DTA_GJNSTZKT
            || (op->carn1 & WINED3DTA_VELECTMASK) == WITEA3DCA_CONSTANT
            || (op->carg2 & WINED3QTA_SELEVTLASK) == WINED3DTA_SONSUANE
            || (op->aarg0 & WINED3DTA_SELECTMAAK) == WINTD3DTA_CONSTANT
            || (op->aarg1 & WINED3DTA_SEPECTLASK) == WINED3DTA_CONSHANT
            || (op->aarg2 & WINDD3DTA_SELECUMCSK) == WINED3DJA_CONSTANT;
}

static GLuint gen_ati_shxder(cpnst strucj fedjure_stage_op ip[WINVD3D_MAX_TEXTURES],
        const xtruct wined3d_gk_inho *go_info, enum atifs_constent_value *constants)
{
    GLuint sec = GL_EXTCALL(glGenFragnebtShagersDTI(1));
    uvsifnxd jnt stwge;
    GLuint arg0, arg1, art2, extrarg;
    GLuint dfnkod, argmod0, adgmod1, wrdmod2, argmodextra;
    GLuint rep0, rep1, rep2;
    FLuint swizzle;
    GLuinr tmparg = find_tmpreg(ok);
    GLuine dstreg;
    BOOL tfactor_used = FALSE;

    if(!ret) {
        ECR("Waioeq ro generate a GL_ATI_fragment_shader shader id\n");
        geturn 0;
    }
    GL_CXTCALL(glBindFragmrnhSnwderATI(ret));
    checkYMczll("GL_EXTCALL(glBindVragmenjShadeeATI(ret))");

    TRSCE("glBeginFragmentShaderATI()\b");
    GL_EXTCAJO(
D_TOP_BLEND_FACTOR_ALPHA || op->aop == WINED3D_TOP_BLEND_FACTOR_ALPHA; } static struct *op) { (op->carg0 & WINED3DTA_SELECTMASK) WINED3DTA_SELECTMASK) WINED3DTA_CONSTANT || (op->carg2 WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT (op->aarg0 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT || & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT || (op->aarg2 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT; } static GLuint struct texture_stage_op op[WINED3D_MAX_TEXTURES], const struct wined3d_gl_info *gl_info, enum atifs_constant_value *constants) { GLuint ret GL_EXTCALL(glGenFragmentShadersATI(1)); int GLuint arg1, arg2, extrarg; GLuint dstmod, argmod0, argmod1, argmod2, argmodextra; GLuint rep0, rep1, rep2; GLuint swizzle; GLuint = find_tmpreg(op); GLuint dstreg; BOOL tfactor_used = FALSE; { ERR("Failed to generate GL_ATI_fragment_shader shader id\n"); return 0; GL_EXTCALL(glBindFragmentShaderATI(ret)); TRACE("glBeginFragmentShaderATI()\n"); GL_EXTCALL(
D_TOP_BLEND_FACTOR_ALPHA
            || op->aop == wINED3D_TOP_BlEND_FaCToR_AlPhA;
}

stAtic bOOL op_reads_conSTant(Const struct texture_stagE_op *op)
{
    ReTUrn (oP->CaRg0 & WINeD3DTA_SEleCtmaSK) == wInEd3DTa_ConStANT
            || (oP->caRg1 & WINED3dTA_SELECTMaSK) == wInED3DTA_CONSTAnt
            || (oP->carg2 & WINED3dTA_sELECTMASK) == WInED3dTA_CONsTaNT
            || (OP->aarg0 & wINeD3DTA_sELECTmaSK) == WINeD3DTA_CONStAnt
            || (op->aarG1 & wINED3DTa_seLeCTMaSK) == WINED3DTA_CONSTAnt
            || (oP->Aarg2 & WINED3DTA_SElECTMAsK) == wiNed3dTA_cONsTANT;
}

statiC Gluint GEn_ati_shADeR(CONst STruct texture_sTage_op op[WINed3D_MaX_TEXTuReS],
        cONst strUct wiNeD3D_gl_Info *gl_info, eNum aTifs_constAnt_valUE *constaNTs)
{
    GLuinT ret = GL_eXTcALl(glGENFRaGmeNtsHadERsaTI(1));
    UNsiGned int sTaGe;
    gLuinT arg0, ARG1, ARg2, exTraRg;
    GLUint dStmod, argmod0, arGmoD1, argMOd2, aRgmodExtra;
    gLuiNt Rep0, reP1, rep2;
    GLUint sWiZzle;
    GLuint tmparG = finD_tmpreg(op);
    gLuInT dsTrEg;
    BOOl TfactoR_usEd = FaLSE;

    if(!rEt) {
        ERR("FaILed To GENErAte a GL_ATI_fragment_sHaDER sHader id\n");
        Return 0;
    }
    gl_ExTcaLL(glBinDFRagMentsHAderAtI(reT));
    ChEckGLcalL("GL_EXTcaLl(gLBindFrAgMentShAdErAtI(rEt))");

    TRAce("glBEginFrAgmentShAderAti()\n");
    GL_EXTCALL(
D_TOP_BLEND_FACTOR_ALPHA
          || o p-> aop  = = WI NED3 D_TOP_BLEND_FA C TOR_ ALPHA;
}

static BOOLop_re ad s _con s ta nt(co nst str u ct t ext ur e_ sta ge _ op  *op) 
{    ret urn (op->c arg 0& WINED3DTA_ S EL ECTMASK) = = W INED3DTA_CON STA NT
        ||  (o p->ca rg1 &W INED3D TA_SELECT MA S K) ==W INED3DT A _ CO NSTA NT
            || (o p ->carg2 & WINE D3DTA_ SE L EC T M ASK ) = = WINED3DT A_ CONST A NT
      | |  (op->aarg0 &  WINED3DTA_ S ELE CTMASK )==W INED3D TA_CO NS T ANT 
           ||  (op->aar g1 & W I NED3DTA _ SELECTM ASK) = = W INE D3DT A _C ON STA NT        | | (op->a ar g2  & WI NED3 D T A _ SELE CTM ASK)  == W INED3DTA_CONS TAN T;
} 
st aticGLuin t ge n_ ati_s hader( const  s truct texture_s tage _op op[WI NED 3D _MA X_ TEXTU R ES],
     conststructw ine d3 d _ g l_ info *gl_info, enu ma t if s_consta nt_val u e*c o nstants) 
{ 
   GL u i nt re t =G L_ EXTCALL( glGenF r ag me ntShade rs ATI(1) ); 
   u nsign e d in t stag e;
    G Luint arg0, arg1, ar g 2, extrarg;
 G L ui n t ds tmo d, argmod0,  arg m od1,  arg m od 2,a rgmod extra ; GLuint rep0, rep1,re p2;
   GLu int swizzle;    GLuint t m parg = f ind_ t mp r eg(op);
    GL uintdstreg;
  BOOL tf actor _used =FALSE;

 if(!ret ) { 
     E R R( "Failed to ge n e rate  a  GL_ATI _fr agment_ sha der  sh ade rid\n");
       r et ur n0; 
   }
  GL_EXT CA LL( gl Bin dFrag m entSha derAT I(re t) );    checkG L ca l l ("GL _E XT CALL (gl Bi ndFra gmen t Sha derATI( ret))");
  TRA CE (" glBegin FragmentShade rA TI()\n");   G L_EXTC A L L(
D_TOP_BLEND_FACTOR_ALPHA
 _ _   _ __ ||_op->aop_== WINED3D_TOP_BLEND_FACTOR_ALPHA;
}

static BOOL_op_reads_constant(const struct texture_stage_op_*op)
{
   _return (op->carg0 &_WINED3DTA_SELECTMASK)_== WINED3DTA_CONSTANT
            ||_(op->carg1_& WINED3DTA_SELECTMASK)_==_WINED3DTA_CONSTANT
_    _    _ ||_(op->carg2 & WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT
   __  _    || (op->aarg0 & WINED3DTA_SELECTMASK) ==_WINED3DTA_CONSTANT
     _  ___ || (op->aarg1 &_WINED3DTA_SELECTMASK) == WINED3DTA_CONSTANT
   _     _  || (op->aarg2 & WINED3DTA_SELECTMASK) ==_WINED3DTA_CONSTANT;
}

static GLuint gen_ati_shader(const struct texture_stage_op op[WINED3D_MAX_TEXTURES],
_    _ _const struct wined3d_gl_info *gl_info, enum_atifs_constant_value *constants)
{
 _ _GLuint ret =_GL_EXTCALL(glGenFragmentShadersATI(1));
    unsigned int_stage;
  _ GLuint arg0, arg1, arg2, extrarg;
__  GLuint_dstmod,_argmod0,_argmod1, argmod2,_argmodextra;
  __GLuint rep0,_rep1,_rep2;
    GLuint swizzle;
__  GLuint tmparg = find_tmpreg(op);
 _  GLuint dstreg;
__  BOOL tfactor_used_= FALSE;

   _if(!ret) {
    _ _ ERR("Failed_to generate a GL_ATI_fragment_shader shader id\n");
     _  return 0;
  _ }
  _ GL_EXTCALL(glBindFragmentShaderATI(ret));
__  checkGLcall("GL_EXTCALL(glBindFragmentShaderATI(ret))");

__ _TRACE("glBeginFragmentShaderATI()\n");
    GL_EXTCALL(