simplify code which access the current vertex/fragment shaders
authorBrian <brian.paul@tungstengraphics.com>
Mon, 29 Oct 2007 15:24:29 +0000 (09:24 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 29 Oct 2007 15:25:00 +0000 (09:25 -0600)
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_shader.c

index 80b8cae013e9ac69be0fbf15e9890c04fbf3c15c..bdc60244776cd9f8261f13a37d589751472152b4 100644 (file)
@@ -113,24 +113,6 @@ gl_filter_to_img_filter(GLenum filter)
 }
 
 
-static struct gl_fragment_program *
-current_fragment_program(GLcontext *ctx)
-{
-   struct gl_fragment_program *f;
-
-   if (ctx->Shader.CurrentProgram &&
-       ctx->Shader.CurrentProgram->LinkStatus &&
-       ctx->Shader.CurrentProgram->FragmentProgram) {
-      f = ctx->Shader.CurrentProgram->FragmentProgram;
-   }
-   else {
-      f = ctx->FragmentProgram._Current;
-      assert(f);
-   }
-   return f;
-}
-
-
 static void 
 update_samplers(struct st_context *st)
 {
@@ -186,8 +168,7 @@ update_samplers(struct st_context *st)
 
    /* mapping from sampler vars to texture units */
    {
-      struct gl_fragment_program *fprog = current_fragment_program(st->ctx);
-      const GLubyte *samplerUnits = fprog->Base.SamplerUnits;
+      struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
       uint sample_units[PIPE_MAX_SAMPLERS];
       uint s;
       for (s = 0; s < PIPE_MAX_SAMPLERS; s++) {
index 92ca22851edb89fe57d565b7b59fee47bd812d35..d4976941f9ad44106c0ddb7d04111cccd46a70b8 100644 (file)
@@ -264,30 +264,11 @@ update_linkage( struct st_context *st )
    /* find active shader and params -- Should be covered by
     * ST_NEW_VERTEX_PROGRAM
     */
-   if (st->ctx->Shader.CurrentProgram &&
-       st->ctx->Shader.CurrentProgram->LinkStatus &&
-       st->ctx->Shader.CurrentProgram->VertexProgram) {
-      struct gl_vertex_program *f
-         = st->ctx->Shader.CurrentProgram->VertexProgram;
-      stvp = st_vertex_program(f);
-   }
-   else {
-      assert(st->ctx->VertexProgram._Current);
-      stvp = st_vertex_program(st->ctx->VertexProgram._Current);
-   }
-
+   assert(st->ctx->VertexProgram._Current);
+   stvp = st_vertex_program(st->ctx->VertexProgram._Current);
 
-   if (st->ctx->Shader.CurrentProgram &&
-       st->ctx->Shader.CurrentProgram->LinkStatus &&
-       st->ctx->Shader.CurrentProgram->FragmentProgram) {
-      struct gl_fragment_program *f
-         = st->ctx->Shader.CurrentProgram->FragmentProgram;
-      stfp = st_fragment_program(f);
-   }
-   else {
-      assert(st->ctx->FragmentProgram._Current);
-      stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
-   }
+   assert(st->ctx->FragmentProgram._Current);
+   stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
 
    xvp = find_translated_vp(st, stvp, stfp);