No longer derive 'ati_fragment_shader' from 'program' class. Only the
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 19 Nov 2005 16:43:04 +0000 (16:43 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 19 Nov 2005 16:43:04 +0000 (16:43 +0000)
program->Id and program->RefCount fields were used and ATI fragment shaders
didn't have too much in common with ARB/NV vertex/fragment programs anyway.

src/mesa/drivers/dri/r300/r300_shader.c
src/mesa/main/context.c
src/mesa/main/mtypes.h
src/mesa/main/state.c
src/mesa/shader/atifragshader.c
src/mesa/shader/atifragshader.h
src/mesa/shader/program.c
src/mesa/shader/program.h
src/mesa/swrast/s_atifragshader.c

index a5549947f9d762cd2ea54ae3451c5b116f989bb8..f10b40a2228dd23f002e815e3397bd418bfd31b3 100644 (file)
@@ -61,9 +61,12 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
                        fp=CALLOC_STRUCT(fragment_program);
                        return _mesa_init_fragment_program(ctx, fp, target, id);
 #endif
+#if 00
+                /* _mesa_new_ati_fragment_shader() is now called instead */
                case GL_FRAGMENT_SHADER_ATI:
                        afs=CALLOC_STRUCT(ati_fragment_shader);
                        return _mesa_init_ati_fragment_shader(ctx, afs, target, id);
+#endif
                default:
                        _mesa_problem(ctx, "Bad target in r300NewProgram");
        }
index b25300a0b0e22dab19dd4ea3990dce616a4f8415..8fd9af760ef251c9c03815b367d84f9bf3d8d9c7 100644 (file)
 #include "histogram.h"
 #include "hint.h"
 #include "hash.h"
+#include "atifragshader.h"
 #include "light.h"
 #include "lines.h"
 #include "macros.h"
@@ -692,7 +693,8 @@ alloc_shared_state( GLcontext *ctx )
       goto cleanup;
 #endif
 #if FEATURE_ATI_fragment_shader
-   ss->DefaultFragmentShader = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, 0);
+   ss->ATIShaders = _mesa_NewHashTable();
+   ss->DefaultFragmentShader = _mesa_new_ati_fragment_shader(ctx, 0);
    if (!ss->DefaultFragmentShader)
       goto cleanup;
 #endif
@@ -760,7 +762,7 @@ alloc_shared_state( GLcontext *ctx )
 #endif
 #if FEATURE_ATI_fragment_shader
    if (ss->DefaultFragmentShader)
-      ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentShader);
+      _mesa_delete_ati_fragment_shader(ctx, ss->DefaultFragmentShader);
 #endif
 #if FEATURE_ARB_vertex_buffer_object
    if (ss->BufferObjects)
@@ -867,7 +869,7 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
    _mesa_delete_program(ctx, ss->DefaultFragmentProgram);
 #endif
 #if FEATURE_ATI_fragment_shader
-   _mesa_delete_program(ctx, ss->DefaultFragmentShader);
+   _mesa_free(ss->DefaultFragmentShader);
 #endif
 
 #if FEATURE_ARB_vertex_buffer_object
index ec21bdce467212d5555dc2a24a9ad5ff9dec49a6..4841e6a1515d44165d1e1215f3116a222103cd22 100644 (file)
@@ -1699,7 +1699,7 @@ struct gl_evaluators
 
 
 /**
- * NV_fragment_program runtime state
+ * State used during execution of fragment programs.
  */
 struct fp_machine
 {
@@ -1709,21 +1709,6 @@ struct fp_machine
    GLuint CondCodes[4];
 };
 
-/**
- * ATI_fragment_shader runtime state
- */
-#define ATI_FS_INPUT_PRIMARY 0
-#define ATI_FS_INPUT_SECONDARY 1
-
-/* 6 register sets - 2 inputs (primary, secondary) */
-struct atifs_machine
-{
-   GLfloat Registers[6][4];
-   GLfloat PrevPassRegisters[6][4];
-   GLfloat Inputs[2][4];
-   GLuint pass;
-};
-
 
 /**
  * Names of the various vertex/fragment program register files, etc.
@@ -1748,8 +1733,6 @@ enum register_file
 
 /** Vertex and fragment instructions */
 struct prog_instruction;
-struct atifs_instruction;
-struct atifs_setupinst;
 struct program_parameter_list;
 
 
@@ -1819,22 +1802,6 @@ struct fragment_program
    GLboolean UsesKill;
 };
 
-struct ati_fragment_shader
-{
-   struct program Base;
-   struct atifs_instruction *Instructions[2];
-   struct atifs_setupinst *SetupInst[2];
-   GLfloat Constants[8][4];
-   GLuint localConstDef;
-   GLubyte numArithInstr[2];
-   GLubyte regsAssigned[2];
-   GLubyte NumPasses;
-   GLubyte cur_pass;
-   GLubyte last_optype;
-   GLboolean interpinp1;
-   GLboolean isValid;
-   GLuint swizzlerq;
-};
 
 /**
  * State common to vertex and fragment programs.
@@ -1852,7 +1819,7 @@ struct gl_program_state
 struct gl_vertex_program_state
 {
    GLboolean Enabled;                  /**< GL_VERTEX_PROGRAM_NV */
-   GLboolean _Enabled;                 /**< Really enabled? */
+   GLboolean _Enabled;                 /**< Enabled and valid program? */
    GLboolean PointSizeEnabled;         /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */
    GLboolean TwoSideEnabled;           /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */
    struct vertex_program *Current;     /**< ptr to currently bound program */
@@ -1881,13 +1848,13 @@ struct gl_vertex_program_state
 
 
 /**
- * State for GL_ARB/NV_fragment_program
+ * Context state for GL_ARB/NV_fragment_program
  */
 struct gl_fragment_program_state
 {
    GLboolean Enabled;                    /* GL_VERTEX_PROGRAM_NV */
-   GLboolean _Enabled;                   /* Really enabled? */
-   GLboolean _Active;                    /* Really really enabled? */
+   GLboolean _Enabled;                   /* Enabled and valid program? */
+   GLboolean _Active;
    struct fragment_program *Current;     /* ptr to currently bound program */
    struct fragment_program *_Current;    /* ptr to currently active program 
                                            (including internal programs) */
@@ -1904,19 +1871,63 @@ struct gl_fragment_program_state
 
 
 /**
- * State for GL_ATI_fragment_shader
+ * ATI_fragment_shader runtime state
+ */
+#define ATI_FS_INPUT_PRIMARY 0
+#define ATI_FS_INPUT_SECONDARY 1
+
+struct atifs_instruction;
+struct atifs_setupinst;
+
+/**
+ * State for executing ATI fragment shader.
+ */
+struct atifs_machine
+{
+   GLfloat Registers[6][4];         /** six temporary registers */
+   GLfloat PrevPassRegisters[6][4];
+   GLfloat Inputs[2][4];   /** Primary, secondary input colors */
+};
+
+
+/**
+ * ATI fragment shader
+ */
+struct ati_fragment_shader
+{
+   GLuint Id;
+   GLint RefCount;
+   struct atifs_instruction *Instructions[2];
+   struct atifs_setupinst *SetupInst[2];
+   GLfloat Constants[8][4];
+   GLbitfield LocalConstDef;  /** Indicates which constants have been set */
+   GLubyte numArithInstr[2];
+   GLubyte regsAssigned[2];
+   GLubyte NumPasses;         /** 1 or 2 */
+   GLubyte cur_pass;
+   GLubyte last_optype;
+   GLboolean interpinp1;
+   GLboolean isValid;
+   GLuint swizzlerq;
+};
+
+/**
+ * Context state for GL_ATI_fragment_shader
  */
 struct gl_ati_fragment_shader_state
 {
    GLboolean Enabled;
-   GLboolean _Enabled;
+   GLboolean _Enabled;                      /** enabled and valid shader? */
    GLboolean Compiling;
-   GLfloat globalConstants[8][4];
+   GLfloat GlobalConstants[8][4];
    struct atifs_machine Machine;            /* machine state */
    struct ati_fragment_shader *Current;
 };
 
 
+/**
+ * Occlusion/timer query object.
+ */
 struct gl_query_object
 {
    GLuint Id;
@@ -1926,6 +1937,9 @@ struct gl_query_object
 };
 
 
+/**
+ * Context state for query objects.
+ */
 struct gl_query_state
 {
    struct _mesa_HashTable *QueryObjects;
@@ -1934,6 +1948,9 @@ struct gl_query_state
 };
 
 
+/**
+ * Context state for vertex/fragment shaders.
+ */
 struct gl_shader_objects_state
 {
    struct gl2_program_intf **current_program;
@@ -1972,10 +1989,12 @@ struct gl_shared_state
 #if FEATURE_ARB_fragment_program
    struct program *DefaultFragmentProgram;
 #endif
+   /*@}*/
+
 #if FEATURE_ATI_fragment_shader
-   struct program *DefaultFragmentShader;
+   struct _mesa_HashTable *ATIShaders;
+   struct ati_fragment_shader *DefaultFragmentShader;
 #endif
-   /*@}*/
 
 #if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object
    struct _mesa_HashTable *BufferObjects;
index 7eb68db845a61e58566f3191b6bf5094a1fd3763..562a0c5a4513cd2066a001c06c13a2c000efbd3c 100644 (file)
@@ -934,7 +934,7 @@ update_program(GLcontext *ctx)
    ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
       && ctx->FragmentProgram.Current->Base.Instructions;
    ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
-      && ctx->ATIFragmentShader.Current->Base.Instructions;
+      && ctx->ATIFragmentShader.Current->Instructions;
       
    ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
    ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
index e16c029aa555ff3b10248859027ee2d1573ae6ac..d349a496dc718fc651fe45f4a3d23616bff860ea 100644 (file)
 
 #define MESA_DEBUG_ATI_FS 0
 
-extern struct program _mesa_DummyProgram;
+static struct ati_fragment_shader DummyShader;
+
+
+/**
+ * Allocate and initialize a new ATI fragment shader object.
+ */
+struct ati_fragment_shader *
+_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id)
+{
+   struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader);
+   (void) ctx;
+   if (s) {
+      s->Id = id;
+      s->RefCount = 1;
+   }
+   return s;
+}
+
+
+/**
+ * Delete the given ati fragment shader
+ */
+void
+_mesa_delete_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *s)
+{
+   GLuint i;
+   for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
+      if (s->Instructions[i])
+         _mesa_free(s->Instructions[i]);
+      if (s->SetupInst[i])
+         _mesa_free(s->SetupInst[i]);
+   }
+   _mesa_free(s);
+}
+
+
 
 static void
 new_arith_inst(struct ati_fragment_shader *prog)
@@ -165,9 +200,9 @@ _mesa_GenFragmentShadersATI(GLuint range)
       return 0;
    }
 
-   first = _mesa_HashFindFreeKeyBlock(ctx->Shared->Programs, range);
+   first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ATIShaders, range);
    for (i = 0; i < range; i++) {
-      _mesa_HashInsert(ctx->Shared->Programs, first + i, &_mesa_DummyProgram);
+      _mesa_HashInsert(ctx->Shared->ATIShaders, first + i, &DummyShader);
    }
 
    return first;
@@ -176,9 +211,9 @@ _mesa_GenFragmentShadersATI(GLuint range)
 void GLAPIENTRY
 _mesa_BindFragmentShaderATI(GLuint id)
 {
-   struct program *prog;
    GET_CURRENT_CONTEXT(ctx);
    struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current;
+   struct ati_fragment_shader *newProg;
 
    if (ctx->ATIFragmentShader.Compiling) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFragmentShaderATI(insideShader)");
@@ -187,41 +222,43 @@ _mesa_BindFragmentShaderATI(GLuint id)
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM);
 
-   if (curProg->Base.Id == id) {
+   if (curProg->Id == id) {
       return;
    }
 
-   if (curProg->Base.Id != 0) {
-      curProg->Base.RefCount--;
-      if (curProg->Base.RefCount <= 0) {
-        _mesa_HashRemove(ctx->Shared->Programs, id);
+   /* unbind current */
+   if (curProg->Id != 0) {
+      curProg->RefCount--;
+      if (curProg->RefCount <= 0) {
+        _mesa_HashRemove(ctx->Shared->ATIShaders, id);
       }
    }
 
-   /* Go bind */
+   /* find new shader */
    if (id == 0) {
-      prog = ctx->Shared->DefaultFragmentShader;
+      newProg = ctx->Shared->DefaultFragmentShader;
    }
    else {
-      prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id);
-      if (!prog || prog == &_mesa_DummyProgram) {
+      newProg = (struct ati_fragment_shader *)
+         _mesa_HashLookup(ctx->Shared->ATIShaders, id);
+      if (!newProg || newProg == &DummyShader) {
         /* allocate a new program now */
-        prog = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, id);
-        if (!prog) {
+        newProg = _mesa_new_ati_fragment_shader(ctx, id);
+        if (!newProg) {
            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI");
            return;
         }
-        _mesa_HashInsert(ctx->Shared->Programs, id, prog);
+        _mesa_HashInsert(ctx->Shared->ATIShaders, id, newProg);
       }
 
    }
 
    /* do actual bind */
-   ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) prog;
+   ctx->ATIFragmentShader.Current = newProg;
 
    ASSERT(ctx->ATIFragmentShader.Current);
-   if (prog)
-      prog->RefCount++;
+   if (newProg)
+      newProg->RefCount++;
 
    /*if (ctx->Driver.BindProgram)
       ctx->Driver.BindProgram(ctx, target, prog); */
@@ -238,38 +275,29 @@ _mesa_DeleteFragmentShaderATI(GLuint id)
    }
 
    if (id != 0) {
-      struct program *prog = (struct program *)
-        _mesa_HashLookup(ctx->Shared->Programs, id);
-      if (prog == &_mesa_DummyProgram) {
-        _mesa_HashRemove(ctx->Shared->Programs, id);
+      struct ati_fragment_shader *prog = (struct ati_fragment_shader *)
+        _mesa_HashLookup(ctx->Shared->ATIShaders, id);
+      if (prog == &DummyShader) {
+        _mesa_HashRemove(ctx->Shared->ATIShaders, id);
       }
       else if (prog) {
         if (ctx->ATIFragmentShader.Current &&
-            ctx->ATIFragmentShader.Current->Base.Id == id) {
+            ctx->ATIFragmentShader.Current->Id == id) {
             FLUSH_VERTICES(ctx, _NEW_PROGRAM);
            _mesa_BindFragmentShaderATI(0);
         }
       }
-#if 0
-      if (!prog->DeletePending) {
-        prog->DeletePending = GL_TRUE;
-        prog->RefCount--;
-      }
-      if (prog->RefCount <= 0) {
-        _mesa_HashRemove(ctx->Shared->Programs, id);
-        ctx->Driver.DeleteProgram(ctx, prog);
-      }
-#else
+
       /* The ID is immediately available for re-use now */
-      _mesa_HashRemove(ctx->Shared->Programs, id);
+      _mesa_HashRemove(ctx->Shared->ATIShaders, id);
       prog->RefCount--;
       if (prog->RefCount <= 0) {
-        ctx->Driver.DeleteProgram(ctx, prog);
+         _mesa_free(prog);
       }
-#endif
    }
 }
 
+
 void GLAPIENTRY
 _mesa_BeginFragmentShaderATI(void)
 {
@@ -307,7 +335,7 @@ _mesa_BeginFragmentShaderATI(void)
    }
 
 /* can't rely on calloc for initialization as it's possible to redefine a shader (?) */
-   ctx->ATIFragmentShader.Current->localConstDef = 0;
+   ctx->ATIFragmentShader.Current->LocalConstDef = 0;
    ctx->ATIFragmentShader.Current->numArithInstr[0] = 0;
    ctx->ATIFragmentShader.Current->numArithInstr[1] = 0;
    ctx->ATIFragmentShader.Current->regsAssigned[0] = 0;
@@ -720,10 +748,10 @@ _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value)
    if (ctx->ATIFragmentShader.Compiling) {
       struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current;
       COPY_4V(curProg->Constants[dstindex], value);
-      curProg->localConstDef |= 1 << dstindex;
+      curProg->LocalConstDef |= 1 << dstindex;
    }
    else {
       FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-      COPY_4V(ctx->ATIFragmentShader.globalConstants[dstindex], value);
+      COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value);
    }
 }
index 9621502ca669895eecef4cdc1840151a397ace03..32fb3a80190cfa4c9d536a598d8107b943b61f89 100644 (file)
@@ -57,6 +57,15 @@ struct atifs_setupinst
    GLenum swizzle;
 };
 
+
+extern struct ati_fragment_shader *
+_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id);
+
+extern void
+_mesa_delete_ati_fragment_shader(GLcontext *ctx,
+                                 struct ati_fragment_shader *s);
+
+
 extern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range);
 
 extern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id);
index 6e0805c3cb2d1ac161558b2c1e166a3c512b7d8b..28b982b6ea70c8ed55146b49a9882476bfb0a517 100644 (file)
@@ -88,11 +88,12 @@ _mesa_init_program(GLcontext *ctx)
    ctx->FragmentProgram.Current->Base.RefCount++;
 #endif
 
+   /* XXX probably move this stuff */
 #if FEATURE_ATI_fragment_shader
    ctx->ATIFragmentShader.Enabled = GL_FALSE;
    ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
    assert(ctx->ATIFragmentShader.Current);
-   ctx->ATIFragmentShader.Current->Base.RefCount++;
+   ctx->ATIFragmentShader.Current->RefCount++;
 #endif
 }
 
@@ -117,11 +118,13 @@ _mesa_free_program_data(GLcontext *ctx)
          ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base));
    }
 #endif
+   /* XXX probably move this stuff */
 #if FEATURE_ATI_fragment_shader
    if (ctx->ATIFragmentShader.Current) {
-      ctx->ATIFragmentShader.Current->Base.RefCount--;
-      if (ctx->ATIFragmentShader.Current->Base.RefCount <= 0)
-       ctx->Driver.DeleteProgram(ctx, &(ctx->ATIFragmentShader.Current->Base));
+      ctx->ATIFragmentShader.Current->RefCount--;
+      if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
+         _mesa_free(ctx->ATIFragmentShader.Current);
+      }
    }
 #endif
    _mesa_free((void *) ctx->Program.ErrorString);
@@ -234,21 +237,6 @@ _mesa_init_vertex_program( GLcontext *ctx, struct vertex_program *prog,
       return NULL;
 }
 
-/**
- * Initialize a new ATI fragment shader object.
- */
-struct program *
-_mesa_init_ati_fragment_shader( GLcontext *ctx,
-                                struct ati_fragment_shader *prog,
-                                GLenum target, GLuint id )
-{
-   if (prog) 
-      return _mesa_init_program_struct( ctx, &prog->Base, target, id );
-   else
-      return NULL;
-}
-
-
 
 /**
  * Allocate and initialize a new fragment/vertex program object but
@@ -273,10 +261,6 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id)
    case GL_FRAGMENT_PROGRAM_ARB:
       return _mesa_init_fragment_program( ctx, CALLOC_STRUCT(fragment_program),
                                          target, id );
-   case GL_FRAGMENT_SHADER_ATI:
-      return _mesa_init_ati_fragment_shader( ctx, CALLOC_STRUCT(ati_fragment_shader),
-                                         target, id );
-
    default:
       _mesa_problem(ctx, "bad target in _mesa_new_program");
       return NULL;
@@ -311,17 +295,6 @@ _mesa_delete_program(GLcontext *ctx, struct program *prog)
    if (prog->Parameters)
       _mesa_free_parameter_list(prog->Parameters);
 
-   if (prog->Target == GL_FRAGMENT_SHADER_ATI) {
-      struct ati_fragment_shader *atifs = (struct ati_fragment_shader *)prog;
-      GLuint i;
-      for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
-        if (atifs->Instructions[i])
-           _mesa_free(atifs->Instructions[i]);
-        if (atifs->SetupInst[i])
-           _mesa_free(atifs->SetupInst[i]);
-      }
-   }
-
    _mesa_free(prog);
 }
 
index ab72f457eeb3c92438d939616f9f324c37a80cd3..a1ee3349dce343666f83fa91ef4fbf56a62c428b 100644 (file)
@@ -105,11 +105,6 @@ _mesa_init_fragment_program(GLcontext *ctx,
                             struct fragment_program *prog,
                             GLenum target, GLuint id);
 
-extern struct program *
-_mesa_init_ati_fragment_shader(GLcontext *ctx,
-                               struct ati_fragment_shader *prog,
-                               GLenum target, GLuint id );
-
 extern struct program *
 _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id);
 
index 0c695ca854d301a1df3bd894a168ca0d841ca485..36ada5fa304e2fb9e913cd4f33fa6fa8ead3d131 100644 (file)
@@ -28,8 +28,6 @@
 #include "program.h"
 
 #include "s_atifragshader.h"
-#include "s_nvfragprog.h"
-#include "s_span.h"
 
 
 /**
@@ -346,12 +344,12 @@ execute_shader(GLcontext * ctx,
                  SETUP_SRC_REG(optype, i,
                                machine->Registers[index - GL_REG_0_ATI]);
               else if (index >= GL_CON_0_ATI && index <= GL_CON_7_ATI) {
-                 if (shader->localConstDef & (1 << (index - GL_CON_0_ATI))) {
+                 if (shader->LocalConstDef & (1 << (index - GL_CON_0_ATI))) {
                     SETUP_SRC_REG(optype, i,
                                shader->Constants[index - GL_CON_0_ATI]);
                  } else {
                     SETUP_SRC_REG(optype, i,
-                               ctx->ATIFragmentShader.globalConstants[index - GL_CON_0_ATI]);
+                               ctx->ATIFragmentShader.GlobalConstants[index - GL_CON_0_ATI]);
                  }
               }
               else if (index == GL_ONE)
@@ -557,7 +555,6 @@ init_machine(GLcontext * ctx, struct atifs_machine *machine,
    for (i = 0; i < 6; i++) {
       for (j = 0; j < 4; j++)
         ctx->ATIFragmentShader.Machine.Registers[i][j] = 0.0;
-
    }
 
    ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][0] =
@@ -577,8 +574,6 @@ init_machine(GLcontext * ctx, struct atifs_machine *machine,
       CHAN_TO_FLOAT(span->array->spec[col][2]);
    ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][3] =
       CHAN_TO_FLOAT(span->array->spec[col][3]);
-
-   ctx->ATIFragmentShader.Machine.pass = 0;
 }
 
 
@@ -615,10 +610,7 @@ _swrast_exec_fragment_shader(GLcontext * ctx, struct sw_span *span)
            UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]);
         }
       }
-
    }
 
-
    ctx->_CurrentProgram = 0;
-
 }