[Mesa-dev] [PATCH 01/17] st/mesa: remove struct st_tracked_state

Marek Olšák maraeo at gmail.com
Mon May 1 12:52:50 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

It contains only one member: the update function. Let's use the update
function directly.
---
 src/mesa/state_tracker/st_atom.c               | 11 ++--
 src/mesa/state_tracker/st_atom.h               |  9 +---
 src/mesa/state_tracker/st_atom_array.c         |  7 +--
 src/mesa/state_tracker/st_atom_atomicbuf.c     | 48 +++++------------
 src/mesa/state_tracker/st_atom_blend.c         |  9 +---
 src/mesa/state_tracker/st_atom_clip.c          |  7 +--
 src/mesa/state_tracker/st_atom_constbuf.c      | 75 +++++---------------------
 src/mesa/state_tracker/st_atom_depth.c         |  9 +---
 src/mesa/state_tracker/st_atom_framebuffer.c   | 10 +---
 src/mesa/state_tracker/st_atom_image.c         | 36 +++----------
 src/mesa/state_tracker/st_atom_list.h          | 28 +++++-----
 src/mesa/state_tracker/st_atom_msaa.c          | 12 +----
 src/mesa/state_tracker/st_atom_pixeltransfer.c |  9 +---
 src/mesa/state_tracker/st_atom_rasterizer.c    |  6 +--
 src/mesa/state_tracker/st_atom_sampler.c       | 49 +++++------------
 src/mesa/state_tracker/st_atom_scissor.c       | 16 ++----
 src/mesa/state_tracker/st_atom_shader.c        | 55 +++++--------------
 src/mesa/state_tracker/st_atom_stipple.c       | 12 ++---
 src/mesa/state_tracker/st_atom_storagebuf.c    | 36 +++----------
 src/mesa/state_tracker/st_atom_tess.c          |  9 +---
 src/mesa/state_tracker/st_atom_texture.c       | 54 +++++--------------
 src/mesa/state_tracker/st_atom_viewport.c      |  9 +---
 22 files changed, 118 insertions(+), 398 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index abbbd4d..b40ce1e 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -29,33 +29,34 @@
 #include <stdio.h>
 #include "main/glheader.h"
 #include "main/context.h"
 
 #include "pipe/p_defines.h"
 #include "st_context.h"
 #include "st_atom.h"
 #include "st_program.h"
 #include "st_manager.h"
 
+typedef void (*update_func_t)(struct st_context *st);
 
 /* The list state update functions. */
-static const struct st_tracked_state *atoms[] =
+static const update_func_t update_functions[] =
 {
-#define ST_STATE(FLAG, st_update) &st_update,
+#define ST_STATE(FLAG, st_update) st_update,
 #include "st_atom_list.h"
 #undef ST_STATE
 };
 
 
 void st_init_atoms( struct st_context *st )
 {
-   STATIC_ASSERT(ARRAY_SIZE(atoms) <= 64);
+   STATIC_ASSERT(ARRAY_SIZE(update_functions) <= 64);
 }
 
 
 void st_destroy_atoms( struct st_context *st )
 {
    /* no-op */
 }
 
 
 /* Too complex to figure out, just check every time:
@@ -219,17 +220,17 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
       return;
 
    dirty_lo = dirty;
    dirty_hi = dirty >> 32;
 
    /* Update states.
     *
     * Don't use u_bit_scan64, it may be slower on 32-bit.
     */
    while (dirty_lo)
-      atoms[u_bit_scan(&dirty_lo)]->update(st);
+      update_functions[u_bit_scan(&dirty_lo)](st);
    while (dirty_hi)
-      atoms[32 + u_bit_scan(&dirty_hi)]->update(st);
+      update_functions[32 + u_bit_scan(&dirty_hi)](st);
 
    /* Clear the render or compute state bits. */
    st->dirty &= ~pipeline_mask;
 }
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index 0145cef..663bc06 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -41,25 +41,20 @@ struct st_context;
 /**
  * Enumeration of state tracker pipelines.
  */
 enum st_pipeline {
    ST_PIPELINE_RENDER,
    ST_PIPELINE_CLEAR,
    ST_PIPELINE_UPDATE_FRAMEBUFFER,
    ST_PIPELINE_COMPUTE,
 };
 
-struct st_tracked_state {
-   void (*update)( struct st_context *st );
-};
-
-
 void st_init_atoms( struct st_context *st );
 void st_destroy_atoms( struct st_context *st );
 void st_validate_state( struct st_context *st, enum st_pipeline pipeline );
 GLuint st_compare_func_to_pipe(GLenum func);
 
 enum pipe_format
 st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
                       GLboolean normalized, GLboolean integer);
 
 
@@ -70,22 +65,22 @@ enum {
 #undef ST_STATE
 };
 
 /* Define ST_NEW_xxx values as static const uint64_t values.
  * We can't use an enum type because MSVC doesn't allow 64-bit enum values.
  */
 #define ST_STATE(FLAG, st_update) static const uint64_t FLAG = 1llu << FLAG##_INDEX;
 #include "st_atom_list.h"
 #undef ST_STATE
 
-/* Add extern struct declarations. */
-#define ST_STATE(FLAG, st_update) extern const struct st_tracked_state st_update;
+/* Declare function prototypes. */
+#define ST_STATE(FLAG, st_update) void st_update(struct st_context *st);
 #include "st_atom_list.h"
 #undef ST_STATE
 
 /* Combined state flags. */
 #define ST_NEW_SAMPLERS         (ST_NEW_VS_SAMPLERS | \
                                  ST_NEW_TCS_SAMPLERS | \
                                  ST_NEW_TES_SAMPLERS | \
                                  ST_NEW_GS_SAMPLERS | \
                                  ST_NEW_FS_SAMPLERS | \
                                  ST_NEW_CS_SAMPLERS)
diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c
index b638457..92485bd 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -619,21 +619,21 @@ setup_non_interleaved_attribs(struct st_context *st,
                                          array->Integer);
 
       init_velement_lowered(st, vp, velements, 0, src_format,
                             array->InstanceDivisor, bufidx,
                             array->Size, array->Doubles, &attr);
    }
 
    return TRUE;
 }
 
-static void update_array(struct st_context *st)
+void st_update_array(struct st_context *st)
 {
    struct gl_context *ctx = st->ctx;
    const struct gl_vertex_array **arrays = ctx->Array._DrawArrays;
    const struct st_vertex_program *vp;
    const struct st_vp_variant *vpv;
    struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
    struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
    unsigned num_vbuffers;
 
    st->vertex_array_out_of_memory = FALSE;
@@ -671,15 +671,10 @@ static void update_array(struct st_context *st)
 
    cso_set_vertex_buffers(st->cso_context, 0, num_vbuffers, vbuffer);
    if (st->last_num_vbuffers > num_vbuffers) {
       /* Unbind remaining buffers, if any. */
       cso_set_vertex_buffers(st->cso_context, num_vbuffers,
                              st->last_num_vbuffers - num_vbuffers, NULL);
    }
    st->last_num_vbuffers = num_vbuffers;
    cso_set_vertex_elements(st->cso_context, vpv->num_inputs, velements);
 }
-
-
-const struct st_tracked_state st_update_array = {
-   update_array						/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_atomicbuf.c b/src/mesa/state_tracker/st_atom_atomicbuf.c
index 11fb84f..171fecc 100644
--- a/src/mesa/state_tracker/st_atom_atomicbuf.c
+++ b/src/mesa/state_tracker/st_atom_atomicbuf.c
@@ -62,87 +62,63 @@ st_bind_atomics(struct st_context *st, struct gl_program *prog,
          sb.buffer = st_obj->buffer;
          sb.buffer_offset = binding->Offset;
          sb.buffer_size = st_obj->buffer->width0 - binding->Offset;
       }
 
       st->pipe->set_shader_buffers(st->pipe, shader_type,
                                    atomic->Binding, 1, &sb);
    }
 }
 
-static void
-bind_vs_atomics(struct st_context *st)
+void
+st_bind_vs_atomics(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
 
    st_bind_atomics(st, prog, PIPE_SHADER_VERTEX);
 }
 
-const struct st_tracked_state st_bind_vs_atomics = {
-   bind_vs_atomics
-};
-
-static void
-bind_fs_atomics(struct st_context *st)
+void
+st_bind_fs_atomics(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
 
    st_bind_atomics(st, prog, PIPE_SHADER_FRAGMENT);
 }
 
-const struct st_tracked_state st_bind_fs_atomics = {
-   bind_fs_atomics
-};
-
-static void
-bind_gs_atomics(struct st_context *st)
+void
+st_bind_gs_atomics(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
 
    st_bind_atomics(st, prog, PIPE_SHADER_GEOMETRY);
 }
 
-const struct st_tracked_state st_bind_gs_atomics = {
-   bind_gs_atomics
-};
-
-static void
-bind_tcs_atomics(struct st_context *st)
+void
+st_bind_tcs_atomics(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
 
    st_bind_atomics(st, prog, PIPE_SHADER_TESS_CTRL);
 }
 
-const struct st_tracked_state st_bind_tcs_atomics = {
-   bind_tcs_atomics
-};
-
-static void
-bind_tes_atomics(struct st_context *st)
+void
+st_bind_tes_atomics(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
 
    st_bind_atomics(st, prog, PIPE_SHADER_TESS_EVAL);
 }
 
-const struct st_tracked_state st_bind_tes_atomics = {
-   bind_tes_atomics
-};
-
-static void
-bind_cs_atomics(struct st_context *st)
+void
+st_bind_cs_atomics(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
 
    st_bind_atomics(st, prog, PIPE_SHADER_COMPUTE);
 }
-
-const struct st_tracked_state st_bind_cs_atomics = {
-   bind_cs_atomics
-};
diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index f76cfab..7428997 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -179,22 +179,22 @@ blend_per_rt(const struct gl_context *ctx)
       /* This can only happen if GL_EXT_draw_buffers2 is enabled */
       return GL_TRUE;
    }
    if (ctx->Color._BlendFuncPerBuffer || ctx->Color._BlendEquationPerBuffer) {
       /* this can only happen if GL_ARB_draw_buffers_blend is enabled */
       return GL_TRUE;
    }
    return GL_FALSE;
 }
 
-static void 
-update_blend( struct st_context *st )
+void
+st_update_blend( struct st_context *st )
 {
    struct pipe_blend_state *blend = &st->state.blend;
    const struct gl_context *ctx = st->ctx;
    unsigned num_state = 1;
    unsigned i, j;
 
    memset(blend, 0, sizeof(*blend));
 
    if (blend_per_rt(ctx) || colormask_per_rt(ctx)) {
       num_state = ctx->Const.MaxDrawBuffers;
@@ -276,15 +276,10 @@ update_blend( struct st_context *st )
    }
 
    cso_set_blend(st->cso_context, blend);
 
    {
       struct pipe_blend_color bc;
       COPY_4FV(bc.color, ctx->Color.BlendColorUnclamped);
       cso_set_blend_color(st->cso_context, &bc);
    }
 }
-
-
-const struct st_tracked_state st_update_blend = {
-   update_blend,					/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c
index 0df7985..0db3a5d 100644
--- a/src/mesa/state_tracker/st_atom_clip.c
+++ b/src/mesa/state_tracker/st_atom_clip.c
@@ -34,21 +34,21 @@
 #include "st_context.h"
 #include "pipe/p_context.h"
 #include "st_atom.h"
 #include "st_program.h"
 #include "util/u_debug.h"
 #include "cso_cache/cso_context.h"
 
 
 /* Second state atom for user clip planes:
  */
-static void update_clip( struct st_context *st )
+void st_update_clip( struct st_context *st )
 {
    struct pipe_clip_state clip;
    const struct gl_context *ctx = st->ctx;
    bool use_eye = FALSE;
 
    STATIC_ASSERT(sizeof(clip.ucp) <= sizeof(ctx->Transform._ClipUserPlane));
 
    /* if we have a vertex shader that writes clip vertex we need to pass
       the pre-projection transformed coordinates into the driver. */
    if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX])
@@ -59,15 +59,10 @@ static void update_clip( struct st_context *st )
     */
    memcpy(clip.ucp,
           use_eye ? ctx->Transform.EyeUserPlane
                   : ctx->Transform._ClipUserPlane, sizeof(clip.ucp));
 
    if (memcmp(&st->state.clip, &clip, sizeof(clip)) != 0) {
       st->state.clip = clip;
       st->pipe->set_clip_state(st->pipe, &clip);
    }
 }
-
-
-const struct st_tracked_state st_update_clip = {
-   update_clip						/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index d16f92e..9c04580 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -132,119 +132,92 @@ void st_upload_constants( struct st_context *st,
       st->state.constants[shader_type].ptr = NULL;
       st->state.constants[shader_type].size = 0;
       cso_set_constant_buffer(st->cso_context, shader_type, 0, NULL);
    }
 }
 
 
 /**
  * Vertex shader:
  */
-static void update_vs_constants(struct st_context *st )
+void st_update_vs_constants(struct st_context *st )
 {
    struct st_vertex_program *vp = st->vp;
    struct gl_program_parameter_list *params = vp->Base.Parameters;
 
    st_upload_constants( st, params, MESA_SHADER_VERTEX );
 }
 
-
-const struct st_tracked_state st_update_vs_constants = {
-   update_vs_constants					/* update */
-};
-
-
-
 /**
  * Fragment shader:
  */
-static void update_fs_constants(struct st_context *st )
+void st_update_fs_constants(struct st_context *st )
 {
    struct st_fragment_program *fp = st->fp;
    struct gl_program_parameter_list *params = fp->Base.Parameters;
 
    st_upload_constants( st, params, MESA_SHADER_FRAGMENT );
 }
 
 
-const struct st_tracked_state st_update_fs_constants = {
-   update_fs_constants					/* update */
-};
-
 /* Geometry shader:
  */
-static void update_gs_constants(struct st_context *st )
+void st_update_gs_constants(struct st_context *st )
 {
    struct st_geometry_program *gp = st->gp;
    struct gl_program_parameter_list *params;
 
    if (gp) {
       params = gp->Base.Parameters;
       st_upload_constants( st, params, MESA_SHADER_GEOMETRY );
    }
 }
 
-const struct st_tracked_state st_update_gs_constants = {
-   update_gs_constants					/* update */
-};
-
 /* Tessellation control shader:
  */
-static void update_tcs_constants(struct st_context *st )
+void st_update_tcs_constants(struct st_context *st )
 {
    struct st_tessctrl_program *tcp = st->tcp;
    struct gl_program_parameter_list *params;
 
    if (tcp) {
       params = tcp->Base.Parameters;
       st_upload_constants( st, params, MESA_SHADER_TESS_CTRL );
    }
 }
 
-const struct st_tracked_state st_update_tcs_constants = {
-   update_tcs_constants					/* update */
-};
-
 /* Tessellation evaluation shader:
  */
-static void update_tes_constants(struct st_context *st )
+void st_update_tes_constants(struct st_context *st )
 {
    struct st_tesseval_program *tep = st->tep;
    struct gl_program_parameter_list *params;
 
    if (tep) {
       params = tep->Base.Parameters;
       st_upload_constants( st, params, MESA_SHADER_TESS_EVAL );
    }
 }
 
-const struct st_tracked_state st_update_tes_constants = {
-   update_tes_constants					/* update */
-};
-
 /* Compute shader:
  */
-static void update_cs_constants(struct st_context *st )
+void st_update_cs_constants(struct st_context *st )
 {
    struct st_compute_program *cp = st->cp;
    struct gl_program_parameter_list *params;
 
    if (cp) {
       params = cp->Base.Parameters;
       st_upload_constants( st, params, MESA_SHADER_COMPUTE );
    }
 }
 
-const struct st_tracked_state st_update_cs_constants = {
-   update_cs_constants					/* update */
-};
-
 static void st_bind_ubos(struct st_context *st, struct gl_program *prog,
                          unsigned shader_type)
 {
    unsigned i;
    struct pipe_constant_buffer cb = { 0 };
 
    if (!prog)
       return;
 
    for (i = 0; i < prog->info.num_ubos; i++) {
@@ -269,81 +242,57 @@ static void st_bind_ubos(struct st_context *st, struct gl_program *prog,
       }
       else {
          cb.buffer_offset = 0;
          cb.buffer_size = 0;
       }
 
       cso_set_constant_buffer(st->cso_context, shader_type, 1 + i, &cb);
    }
 }
 
-static void bind_vs_ubos(struct st_context *st)
+void st_bind_vs_ubos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
 
    st_bind_ubos(st, prog, PIPE_SHADER_VERTEX);
 }
 
-const struct st_tracked_state st_bind_vs_ubos = {
-   bind_vs_ubos
-};
-
-static void bind_fs_ubos(struct st_context *st)
+void st_bind_fs_ubos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
 
    st_bind_ubos(st, prog, PIPE_SHADER_FRAGMENT);
 }
 
-const struct st_tracked_state st_bind_fs_ubos = {
-   bind_fs_ubos
-};
-
-static void bind_gs_ubos(struct st_context *st)
+void st_bind_gs_ubos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
 
    st_bind_ubos(st, prog, PIPE_SHADER_GEOMETRY);
 }
 
-const struct st_tracked_state st_bind_gs_ubos = {
-   bind_gs_ubos
-};
-
-static void bind_tcs_ubos(struct st_context *st)
+void st_bind_tcs_ubos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
 
    st_bind_ubos(st, prog, PIPE_SHADER_TESS_CTRL);
 }
 
-const struct st_tracked_state st_bind_tcs_ubos = {
-   bind_tcs_ubos
-};
-
-static void bind_tes_ubos(struct st_context *st)
+void st_bind_tes_ubos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
 
    st_bind_ubos(st, prog, PIPE_SHADER_TESS_EVAL);
 }
 
-const struct st_tracked_state st_bind_tes_ubos = {
-   bind_tes_ubos
-};
-
-static void bind_cs_ubos(struct st_context *st)
+void st_bind_cs_ubos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
 
    st_bind_ubos(st, prog, PIPE_SHADER_COMPUTE);
 }
-
-const struct st_tracked_state st_bind_cs_ubos = {
-   bind_cs_ubos
-};
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index 7092c3f..432de4b 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -88,22 +88,22 @@ gl_stencil_op_to_pipe(GLenum func)
    case GL_DECR_WRAP:
       return PIPE_STENCIL_OP_DECR_WRAP;
    case GL_INVERT:
       return PIPE_STENCIL_OP_INVERT;
    default:
       assert("invalid GL token in gl_stencil_op_to_pipe()" == NULL);
       return 0;
    }
 }
 
-static void
-update_depth_stencil_alpha(struct st_context *st)
+void
+st_update_depth_stencil_alpha(struct st_context *st)
 {
    struct pipe_depth_stencil_alpha_state *dsa = &st->state.depth_stencil;
    struct pipe_stencil_ref sr;
    struct gl_context *ctx = st->ctx;
 
    memset(dsa, 0, sizeof(*dsa));
    memset(&sr, 0, sizeof(sr));
 
    if (ctx->DrawBuffer->Visual.depthBits > 0) {
       if (ctx->Depth.Test) {
@@ -152,15 +152,10 @@ update_depth_stencil_alpha(struct st_context *st)
    if (ctx->Color.AlphaEnabled &&
        !(ctx->DrawBuffer->_IntegerBuffers & 0x1)) {
       dsa->alpha.enabled = 1;
       dsa->alpha.func = st_compare_func_to_pipe(ctx->Color.AlphaFunc);
       dsa->alpha.ref_value = ctx->Color.AlphaRefUnclamped;
    }
 
    cso_set_depth_stencil_alpha(st->cso_context, dsa);
    cso_set_stencil_ref(st->cso_context, &sr);
 }
-
-
-const struct st_tracked_state st_update_depth_stencil_alpha = {
-   update_depth_stencil_alpha				/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 7435c00..9b15c88 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -97,22 +97,22 @@ framebuffer_quantize_num_samples(struct st_context *st, unsigned num_samples)
                                       PIPE_TEXTURE_2D, msaa_mode,
                                       PIPE_BIND_RENDER_TARGET))
          quantized_samples = msaa_mode;
    }
    return quantized_samples;
 }
 
 /**
  * Update framebuffer state (color, depth, stencil, etc. buffers)
  */
-static void
-update_framebuffer_state( struct st_context *st )
+void
+st_update_framebuffer_state( struct st_context *st )
 {
    struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer;
    struct gl_framebuffer *fb = st->ctx->DrawBuffer;
    struct st_renderbuffer *strb;
    GLuint i;
 
    st_flush_bitmap_cache(st);
    st_invalidate_readpix_cache(st);
 
    st->state.fb_orientation = st_fb_orientation(fb);
@@ -205,16 +205,10 @@ update_framebuffer_state( struct st_context *st )
    }
 #endif
 
    if (framebuffer->width == USHRT_MAX)
       framebuffer->width = 0;
    if (framebuffer->height == USHRT_MAX)
       framebuffer->height = 0;
 
    cso_set_framebuffer(st->cso_context, framebuffer);
 }
-
-
-const struct st_tracked_state st_update_framebuffer = {
-   update_framebuffer_state				/* update */
-};
-
diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c
index 077bafd..381eca1 100644
--- a/src/mesa/state_tracker/st_atom_image.c
+++ b/src/mesa/state_tracker/st_atom_image.c
@@ -132,81 +132,57 @@ st_bind_images(struct st_context *st, struct gl_program *prog,
    }
    cso_set_shader_images(st->cso_context, shader_type, 0,
                          prog->info.num_images, images);
    /* clear out any stale shader images */
    if (prog->info.num_images < c->MaxImageUniforms)
       cso_set_shader_images(
             st->cso_context, shader_type, prog->info.num_images,
             c->MaxImageUniforms - prog->info.num_images, NULL);
 }
 
-static void bind_vs_images(struct st_context *st)
+void st_bind_vs_images(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
 
    st_bind_images(st, prog, PIPE_SHADER_VERTEX);
 }
 
-const struct st_tracked_state st_bind_vs_images = {
-   bind_vs_images
-};
-
-static void bind_fs_images(struct st_context *st)
+void st_bind_fs_images(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
 
    st_bind_images(st, prog, PIPE_SHADER_FRAGMENT);
 }
 
-const struct st_tracked_state st_bind_fs_images = {
-   bind_fs_images
-};
-
-static void bind_gs_images(struct st_context *st)
+void st_bind_gs_images(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
 
    st_bind_images(st, prog, PIPE_SHADER_GEOMETRY);
 }
 
-const struct st_tracked_state st_bind_gs_images = {
-   bind_gs_images
-};
-
-static void bind_tcs_images(struct st_context *st)
+void st_bind_tcs_images(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
 
    st_bind_images(st, prog, PIPE_SHADER_TESS_CTRL);
 }
 
-const struct st_tracked_state st_bind_tcs_images = {
-   bind_tcs_images
-};
-
-static void bind_tes_images(struct st_context *st)
+void st_bind_tes_images(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
 
    st_bind_images(st, prog, PIPE_SHADER_TESS_EVAL);
 }
 
-const struct st_tracked_state st_bind_tes_images = {
-   bind_tes_images
-};
-
-static void bind_cs_images(struct st_context *st)
+void st_bind_cs_images(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
 
    st_bind_images(st, prog, PIPE_SHADER_COMPUTE);
 }
-
-const struct st_tracked_state st_bind_cs_images = {
-   bind_cs_images
-};
diff --git a/src/mesa/state_tracker/st_atom_list.h b/src/mesa/state_tracker/st_atom_list.h
index 4212dac..ca997af1 100644
--- a/src/mesa/state_tracker/st_atom_list.h
+++ b/src/mesa/state_tracker/st_atom_list.h
@@ -8,41 +8,41 @@ ST_STATE(ST_NEW_TES_STATE, st_update_tep)
 ST_STATE(ST_NEW_TCS_STATE, st_update_tcp)
 ST_STATE(ST_NEW_VS_STATE, st_update_vp)
 
 ST_STATE(ST_NEW_RASTERIZER, st_update_rasterizer)
 ST_STATE(ST_NEW_POLY_STIPPLE, st_update_polygon_stipple)
 ST_STATE(ST_NEW_VIEWPORT, st_update_viewport)
 ST_STATE(ST_NEW_SCISSOR, st_update_scissor)
 ST_STATE(ST_NEW_WINDOW_RECTANGLES, st_update_window_rectangles)
 ST_STATE(ST_NEW_BLEND, st_update_blend)
 
-ST_STATE(ST_NEW_VS_SAMPLER_VIEWS, st_update_vertex_texture)
-ST_STATE(ST_NEW_FS_SAMPLER_VIEWS, st_update_fragment_texture)
-ST_STATE(ST_NEW_GS_SAMPLER_VIEWS, st_update_geometry_texture)
-ST_STATE(ST_NEW_TCS_SAMPLER_VIEWS, st_update_tessctrl_texture)
-ST_STATE(ST_NEW_TES_SAMPLER_VIEWS, st_update_tesseval_texture)
+ST_STATE(ST_NEW_VS_SAMPLER_VIEWS, st_update_vertex_textures)
+ST_STATE(ST_NEW_FS_SAMPLER_VIEWS, st_update_fragment_textures)
+ST_STATE(ST_NEW_GS_SAMPLER_VIEWS, st_update_geometry_textures)
+ST_STATE(ST_NEW_TCS_SAMPLER_VIEWS, st_update_tessctrl_textures)
+ST_STATE(ST_NEW_TES_SAMPLER_VIEWS, st_update_tesseval_textures)
 
 /* Non-compute samplers. */
-ST_STATE(ST_NEW_VS_SAMPLERS, st_update_vertex_sampler) /* depends on update_*_texture for swizzle */
-ST_STATE(ST_NEW_TCS_SAMPLERS, st_update_tessctrl_sampler) /* depends on update_*_texture for swizzle */
-ST_STATE(ST_NEW_TES_SAMPLERS, st_update_tesseval_sampler) /* depends on update_*_texture for swizzle */
-ST_STATE(ST_NEW_GS_SAMPLERS, st_update_geometry_sampler) /* depends on update_*_texture for swizzle */
-ST_STATE(ST_NEW_FS_SAMPLERS, st_update_fragment_sampler) /* depends on update_*_texture for swizzle */
+ST_STATE(ST_NEW_VS_SAMPLERS, st_update_vertex_samplers) /* depends on update_*_texture for swizzle */
+ST_STATE(ST_NEW_TCS_SAMPLERS, st_update_tessctrl_samplers) /* depends on update_*_texture for swizzle */
+ST_STATE(ST_NEW_TES_SAMPLERS, st_update_tesseval_samplers) /* depends on update_*_texture for swizzle */
+ST_STATE(ST_NEW_GS_SAMPLERS, st_update_geometry_samplers) /* depends on update_*_texture for swizzle */
+ST_STATE(ST_NEW_FS_SAMPLERS, st_update_fragment_samplers) /* depends on update_*_texture for swizzle */
 
 ST_STATE(ST_NEW_VS_IMAGES, st_bind_vs_images)
 ST_STATE(ST_NEW_TCS_IMAGES, st_bind_tcs_images)
 ST_STATE(ST_NEW_TES_IMAGES, st_bind_tes_images)
 ST_STATE(ST_NEW_GS_IMAGES, st_bind_gs_images)
 ST_STATE(ST_NEW_FS_IMAGES, st_bind_fs_images)
 
-ST_STATE(ST_NEW_FB_STATE, st_update_framebuffer) /* depends on update_*_texture and bind_*_images */
-ST_STATE(ST_NEW_SAMPLE_MASK, st_update_msaa)
+ST_STATE(ST_NEW_FB_STATE, st_update_framebuffer_state) /* depends on update_*_texture and bind_*_images */
+ST_STATE(ST_NEW_SAMPLE_MASK, st_update_sample_mask)
 ST_STATE(ST_NEW_SAMPLE_SHADING, st_update_sample_shading)
 
 ST_STATE(ST_NEW_VS_CONSTANTS, st_update_vs_constants)
 ST_STATE(ST_NEW_TCS_CONSTANTS, st_update_tcs_constants)
 ST_STATE(ST_NEW_TES_CONSTANTS, st_update_tes_constants)
 ST_STATE(ST_NEW_GS_CONSTANTS, st_update_gs_constants)
 ST_STATE(ST_NEW_FS_CONSTANTS, st_update_fs_constants)
 
 ST_STATE(ST_NEW_VS_UBOS, st_bind_vs_ubos)
 ST_STATE(ST_NEW_TCS_UBOS, st_bind_tcs_ubos)
@@ -63,17 +63,17 @@ ST_STATE(ST_NEW_FS_SSBOS, st_bind_fs_ssbos)
 ST_STATE(ST_NEW_GS_SSBOS, st_bind_gs_ssbos)
 
 ST_STATE(ST_NEW_PIXEL_TRANSFER, st_update_pixel_transfer)
 ST_STATE(ST_NEW_TESS_STATE, st_update_tess)
 
 /* this must be done after the vertex program update */
 ST_STATE(ST_NEW_VERTEX_ARRAYS, st_update_array)
 
 /* Compute states must be last. */
 ST_STATE(ST_NEW_CS_STATE, st_update_cp)
-ST_STATE(ST_NEW_CS_SAMPLER_VIEWS, st_update_compute_texture)
-ST_STATE(ST_NEW_CS_SAMPLERS, st_update_compute_sampler) /* depends on update_compute_texture for swizzle */
+ST_STATE(ST_NEW_CS_SAMPLER_VIEWS, st_update_compute_textures)
+ST_STATE(ST_NEW_CS_SAMPLERS, st_update_compute_samplers) /* depends on update_compute_texture for swizzle */
 ST_STATE(ST_NEW_CS_CONSTANTS, st_update_cs_constants)
 ST_STATE(ST_NEW_CS_UBOS, st_bind_cs_ubos)
 ST_STATE(ST_NEW_CS_ATOMICS, st_bind_cs_atomics)
 ST_STATE(ST_NEW_CS_SSBOS, st_bind_cs_ssbos)
 ST_STATE(ST_NEW_CS_IMAGES, st_bind_cs_images)
diff --git a/src/mesa/state_tracker/st_atom_msaa.c b/src/mesa/state_tracker/st_atom_msaa.c
index 69aea69..c591fad 100644
--- a/src/mesa/state_tracker/st_atom_msaa.c
+++ b/src/mesa/state_tracker/st_atom_msaa.c
@@ -31,21 +31,21 @@
 #include "pipe/p_context.h"
 #include "st_atom.h"
 #include "st_program.h"
 
 #include "cso_cache/cso_context.h"
 #include "util/u_framebuffer.h"
 
 
 /* Update the sample mask for MSAA.
  */
-static void update_sample_mask( struct st_context *st )
+void st_update_sample_mask( struct st_context *st )
 {
    unsigned sample_mask = 0xffffffff;
    struct pipe_framebuffer_state *framebuffer = &st->state.framebuffer;
    /* dependency here on bound surface (or rather, sample count) is worrying */
    unsigned sample_count = util_framebuffer_get_num_samples(framebuffer);
 
    if (st->ctx->Multisample.Enabled && sample_count > 1) {
       /* unlike in gallium/d3d10 the mask is only active if msaa is enabled */
       if (st->ctx->Multisample.SampleCoverage) {
          unsigned nr_bits;
@@ -65,30 +65,22 @@ static void update_sample_mask( struct st_context *st )
    }
 
    /* mask off unused bits or don't care? */
 
    if (sample_mask != st->state.sample_mask) {
       st->state.sample_mask = sample_mask;
       cso_set_sample_mask(st->cso_context, sample_mask);
    }
 }
 
-static void update_sample_shading( struct st_context *st )
+void st_update_sample_shading( struct st_context *st )
 {
    if (!st->fp)
       return;
 
    if (!st->ctx->Extensions.ARB_sample_shading)
       return;
 
    cso_set_min_samples(
 	 st->cso_context,
          _mesa_get_min_invocations_per_fragment(st->ctx, &st->fp->Base, false));
 }
-
-const struct st_tracked_state st_update_msaa = {
-   update_sample_mask					/* update */
-};
-
-const struct st_tracked_state st_update_sample_shading = {
-   update_sample_shading				/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index a2951a1..9b99036 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -77,31 +77,26 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
          *(dest + k) = uc.ui[0];
       }
    }
 
    pipe_transfer_unmap(pipe, transfer);
 }
 
 /**
  * Upload the pixel transfer color map texture.
  */
-static void
-update_pixel_transfer(struct st_context *st)
+void
+st_update_pixel_transfer(struct st_context *st)
 {
    struct gl_context *ctx = st->ctx;
 
    if (ctx->Pixel.MapColorFlag) {
       /* create the colormap/texture now if not already done */
       if (!st->pixel_xfer.pixelmap_texture) {
          st->pixel_xfer.pixelmap_texture = st_create_color_map_texture(ctx);
          st->pixel_xfer.pixelmap_sampler_view =
             st_create_texture_sampler_view(st->pipe,
                                            st->pixel_xfer.pixelmap_texture);
       }
       load_color_map_texture(ctx, st->pixel_xfer.pixelmap_texture);
    }
 }
-
-
-const struct st_tracked_state st_update_pixel_transfer = {
-   update_pixel_transfer				/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 0b0e045..42696b1 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -53,21 +53,21 @@ static GLuint translate_fill( GLenum mode )
    case GL_FILL_RECTANGLE_NV:
       return PIPE_POLYGON_MODE_FILL_RECTANGLE;
    default:
       assert(0);
       return 0;
    }
 }
 
 
 
-static void update_raster_state( struct st_context *st )
+void st_update_rasterizer( struct st_context *st )
 {
    struct gl_context *ctx = st->ctx;
    struct pipe_rasterizer_state *raster = &st->state.rasterizer;
    const struct gl_program *vertProg = ctx->VertexProgram._Current;
    const struct gl_program *fragProg = ctx->FragmentProgram._Current;
 
    memset(raster, 0, sizeof(*raster));
 
    /* _NEW_POLYGON, _NEW_BUFFERS
     */
@@ -285,14 +285,10 @@ static void update_raster_state( struct st_context *st )
          raster->cull_face |= PIPE_FACE_BACK;
    }
 
    /* _NEW_TRANSFORM */
    raster->depth_clip = !ctx->Transform.DepthClamp;
    raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
    raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
 
    cso_set_rasterizer(st->cso_context, raster);
 }
-
-const struct st_tracked_state st_update_rasterizer = {
-   update_raster_state     /* update function */
-};
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 065d1df..f33e334 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -327,125 +327,100 @@ update_shader_samplers(struct st_context *st,
          break;
       }
 
       *num_samplers = MAX2(*num_samplers, extra + 1);
    }
 
    cso_set_samplers(st->cso_context, shader_stage, *num_samplers, states);
 }
 
 
-static void
-update_vertex_samplers(struct st_context *st)
+void
+st_update_vertex_samplers(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    update_shader_samplers(st,
                           PIPE_SHADER_VERTEX,
                           ctx->VertexProgram._Current,
                           ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
                           st->state.samplers[PIPE_SHADER_VERTEX],
                           &st->state.num_samplers[PIPE_SHADER_VERTEX]);
 }
 
 
-static void
-update_tessctrl_samplers(struct st_context *st)
+void
+st_update_tessctrl_samplers(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->TessCtrlProgram._Current) {
       update_shader_samplers(st,
                              PIPE_SHADER_TESS_CTRL,
                              ctx->TessCtrlProgram._Current,
                              ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits,
                              st->state.samplers[PIPE_SHADER_TESS_CTRL],
                              &st->state.num_samplers[PIPE_SHADER_TESS_CTRL]);
    }
 }
 
 
-static void
-update_tesseval_samplers(struct st_context *st)
+void
+st_update_tesseval_samplers(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->TessEvalProgram._Current) {
       update_shader_samplers(st,
                              PIPE_SHADER_TESS_EVAL,
                              ctx->TessEvalProgram._Current,
                              ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
                              st->state.samplers[PIPE_SHADER_TESS_EVAL],
                              &st->state.num_samplers[PIPE_SHADER_TESS_EVAL]);
    }
 }
 
 
-static void
-update_geometry_samplers(struct st_context *st)
+void
+st_update_geometry_samplers(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->GeometryProgram._Current) {
       update_shader_samplers(st,
                              PIPE_SHADER_GEOMETRY,
                              ctx->GeometryProgram._Current,
                              ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits,
                              st->state.samplers[PIPE_SHADER_GEOMETRY],
                              &st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
    }
 }
 
 
-static void
-update_fragment_samplers(struct st_context *st)
+void
+st_update_fragment_samplers(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    update_shader_samplers(st,
                           PIPE_SHADER_FRAGMENT,
                           ctx->FragmentProgram._Current,
                           ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
                           st->state.samplers[PIPE_SHADER_FRAGMENT],
                           &st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
 }
 
 
-static void
-update_compute_samplers(struct st_context *st)
+void
+st_update_compute_samplers(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->ComputeProgram._Current) {
       update_shader_samplers(st,
                              PIPE_SHADER_COMPUTE,
                              ctx->ComputeProgram._Current,
                              ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
                              st->state.samplers[PIPE_SHADER_COMPUTE],
                              &st->state.num_samplers[PIPE_SHADER_COMPUTE]);
    }
 }
-
-
-const struct st_tracked_state st_update_vertex_sampler = {
-   update_vertex_samplers				/* update */
-};
-
-const struct st_tracked_state st_update_tessctrl_sampler = {
-   update_tessctrl_samplers				/* update */
-};
-
-const struct st_tracked_state st_update_tesseval_sampler = {
-   update_tesseval_samplers				/* update */
-};
-
-const struct st_tracked_state st_update_geometry_sampler = {
-   update_geometry_samplers				/* update */
-};
-
-const struct st_tracked_state st_update_fragment_sampler = {
-   update_fragment_samplers				/* update */
-};
-
-const struct st_tracked_state st_update_compute_sampler = {
-   update_compute_samplers				/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c
index fb478a3..d3450be 100644
--- a/src/mesa/state_tracker/st_atom_scissor.c
+++ b/src/mesa/state_tracker/st_atom_scissor.c
@@ -34,22 +34,22 @@
 #include "main/macros.h"
 #include "main/framebuffer.h"
 #include "st_context.h"
 #include "pipe/p_context.h"
 #include "st_atom.h"
 
 
 /**
  * Scissor depends on the scissor box, and the framebuffer dimensions.
  */
-static void
-update_scissor( struct st_context *st )
+void
+st_update_scissor( struct st_context *st )
 {
    struct pipe_scissor_state scissor[PIPE_MAX_VIEWPORTS];
    const struct gl_context *ctx = st->ctx;
    const struct gl_framebuffer *fb = ctx->DrawBuffer;
    const unsigned int fb_width = _mesa_geometric_width(fb);
    const unsigned int fb_height = _mesa_geometric_height(fb);
    GLint miny, maxy;
    unsigned i;
    bool changed = false;
 
@@ -92,22 +92,22 @@ update_scissor( struct st_context *st )
       if (memcmp(&scissor[i], &st->state.scissor[i], sizeof(scissor[0])) != 0) {
          /* state has changed */
          st->state.scissor[i] = scissor[i];  /* struct copy */
          changed = true;
       }
    }
    if (changed)
       st->pipe->set_scissor_states(st->pipe, 0, ctx->Const.MaxViewports, scissor); /* activate */
 }
 
-static void
-update_window_rectangles(struct st_context *st)
+void
+st_update_window_rectangles(struct st_context *st)
 {
    struct pipe_scissor_state new_rects[PIPE_MAX_WINDOW_RECTANGLES];
    const struct gl_context *ctx = st->ctx;
    const struct gl_scissor_attrib *scissor = &ctx->Scissor;
    unsigned i;
    bool changed = false;
    unsigned num_rects = scissor->NumWindowRects;
    bool include = scissor->WindowRectMode == GL_INCLUSIVE_EXT;
 
    if (ctx->DrawBuffer == ctx->WinSysDrawBuffer) {
@@ -132,18 +132,10 @@ update_window_rectangles(struct st_context *st)
       changed = true;
    }
    if (st->state.window_rects.include != include) {
       st->state.window_rects.include = include;
       changed = true;
    }
    if (changed)
       st->pipe->set_window_rectangles(
             st->pipe, include, num_rects, new_rects);
 }
-
-const struct st_tracked_state st_update_scissor = {
-   update_scissor					/* update */
-};
-
-const struct st_tracked_state st_update_window_rectangles = {
-   update_window_rectangles				/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index ee97c69..0a72d14 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -86,22 +86,22 @@ get_texture_target(struct gl_context *ctx, const unsigned unit)
       debug_assert(0);
       return TGSI_TEXTURE_1D;
    }
 }
 
 
 /**
  * Update fragment program state/atom.  This involves translating the
  * Mesa fragment program into a gallium fragment program and binding it.
  */
-static void
-update_fp( struct st_context *st )
+void
+st_update_fp( struct st_context *st )
 {
    struct st_fragment_program *stfp;
    struct st_fp_variant_key key;
 
    assert(st->ctx->FragmentProgram._Current);
    stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
    assert(stfp->Base.Target == GL_FRAGMENT_PROGRAM_ARB);
 
    memset(&key, 0, sizeof(key));
    key.st = st->has_shareable_shaders ? NULL : st;
@@ -130,32 +130,26 @@ update_fp( struct st_context *st )
 
    st->fp_variant = st_get_fp_variant(st, stfp, &key);
 
    st_reference_fragprog(st, &st->fp, stfp);
 
    cso_set_fragment_shader_handle(st->cso_context,
                                   st->fp_variant->driver_shader);
 }
 
 
-const struct st_tracked_state st_update_fp = {
-   update_fp  					/* update */
-};
-
-
-
 /**
  * Update vertex program state/atom.  This involves translating the
  * Mesa vertex program into a gallium fragment program and binding it.
  */
-static void
-update_vp( struct st_context *st )
+void
+st_update_vp( struct st_context *st )
 {
    struct st_vertex_program *stvp;
    struct st_vp_variant_key key;
 
    /* find active shader and params -- Should be covered by
     * ST_NEW_VERTEX_PROGRAM
     */
    assert(st->ctx->VertexProgram._Current);
    stvp = st_vertex_program(st->ctx->VertexProgram._Current);
    assert(stvp->Base.Target == GL_VERTEX_PROGRAM_ARB);
@@ -183,28 +177,22 @@ update_vp( struct st_context *st )
 
    st_reference_vertprog(st, &st->vp, stvp);
 
    cso_set_vertex_shader_handle(st->cso_context, 
                                 st->vp_variant->driver_shader);
 
    st->vertex_result_to_slot = stvp->result_to_output;
 }
 
 
-const struct st_tracked_state st_update_vp = {
-   update_vp						/* update */
-};
-
-
-
-static void
-update_gp( struct st_context *st )
+void
+st_update_gp( struct st_context *st )
 {
    struct st_geometry_program *stgp;
 
    if (!st->ctx->GeometryProgram._Current) {
       cso_set_geometry_shader_handle(st->cso_context, NULL);
       st_reference_geomprog(st, &st->gp, NULL);
       return;
    }
 
    stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
@@ -212,28 +200,23 @@ update_gp( struct st_context *st )
 
    st->gp_variant = st_get_basic_variant(st, PIPE_SHADER_GEOMETRY,
                                          &stgp->tgsi, &stgp->variants);
 
    st_reference_geomprog(st, &st->gp, stgp);
 
    cso_set_geometry_shader_handle(st->cso_context,
                                   st->gp_variant->driver_shader);
 }
 
-const struct st_tracked_state st_update_gp = {
-   update_gp  				/* update */
-};
-
 
-
-static void
-update_tcp( struct st_context *st )
+void
+st_update_tcp( struct st_context *st )
 {
    struct st_tessctrl_program *sttcp;
 
    if (!st->ctx->TessCtrlProgram._Current) {
       cso_set_tessctrl_shader_handle(st->cso_context, NULL);
       st_reference_tesscprog(st, &st->tcp, NULL);
       return;
    }
 
    sttcp = st_tessctrl_program(st->ctx->TessCtrlProgram._Current);
@@ -241,28 +224,23 @@ update_tcp( struct st_context *st )
 
    st->tcp_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL,
                                           &sttcp->tgsi, &sttcp->variants);
 
    st_reference_tesscprog(st, &st->tcp, sttcp);
 
    cso_set_tessctrl_shader_handle(st->cso_context,
                                   st->tcp_variant->driver_shader);
 }
 
-const struct st_tracked_state st_update_tcp = {
-   update_tcp  				/* update */
-};
-
-
 
-static void
-update_tep( struct st_context *st )
+void
+st_update_tep( struct st_context *st )
 {
    struct st_tesseval_program *sttep;
 
    if (!st->ctx->TessEvalProgram._Current) {
       cso_set_tesseval_shader_handle(st->cso_context, NULL);
       st_reference_tesseprog(st, &st->tep, NULL);
       return;
    }
 
    sttep = st_tesseval_program(st->ctx->TessEvalProgram._Current);
@@ -270,41 +248,32 @@ update_tep( struct st_context *st )
 
    st->tep_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL,
                                           &sttep->tgsi, &sttep->variants);
 
    st_reference_tesseprog(st, &st->tep, sttep);
 
    cso_set_tesseval_shader_handle(st->cso_context,
                                   st->tep_variant->driver_shader);
 }
 
-const struct st_tracked_state st_update_tep = {
-   update_tep  				/* update */
-};
 
-
-
-static void
-update_cp( struct st_context *st )
+void
+st_update_cp( struct st_context *st )
 {
    struct st_compute_program *stcp;
 
    if (!st->ctx->ComputeProgram._Current) {
       cso_set_compute_shader_handle(st->cso_context, NULL);
       st_reference_compprog(st, &st->cp, NULL);
       return;
    }
 
    stcp = st_compute_program(st->ctx->ComputeProgram._Current);
    assert(stcp->Base.Target == GL_COMPUTE_PROGRAM_NV);
 
    st->cp_variant = st_get_cp_variant(st, &stcp->tgsi, &stcp->variants);
 
    st_reference_compprog(st, &st->cp, stcp);
 
    cso_set_compute_shader_handle(st->cso_context,
                                  st->cp_variant->driver_shader);
 }
-
-const struct st_tracked_state st_update_cp = {
-   update_cp  				/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_stipple.c b/src/mesa/state_tracker/st_atom_stipple.c
index 5f7bf82..87599f9 100644
--- a/src/mesa/state_tracker/st_atom_stipple.c
+++ b/src/mesa/state_tracker/st_atom_stipple.c
@@ -53,23 +53,23 @@ static void
 invert_stipple(GLuint dest[32], const GLuint src[32], GLuint winHeight)
 {
    GLuint i;
 
    for (i = 0; i < 32; i++) {
       dest[i] = src[(winHeight - 1 - i) & 0x1f];
    }
 }
 
 
-
-static void
-update_stipple( struct st_context *st )
+/** Update the stipple when the pattern or window height changes */
+void
+st_update_polygon_stipple( struct st_context *st )
 {
    const struct gl_context *ctx = st->ctx;
    const GLuint sz = sizeof(st->state.poly_stipple);
    assert(sz == sizeof(ctx->PolygonStipple));
 
    if (memcmp(st->state.poly_stipple, ctx->PolygonStipple, sz)) {
       /* state has changed */
       struct pipe_poly_stipple newStipple;
 
       memcpy(st->state.poly_stipple, ctx->PolygonStipple, sz);
@@ -77,16 +77,10 @@ update_stipple( struct st_context *st )
       if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
          memcpy(newStipple.stipple, ctx->PolygonStipple, sizeof(newStipple.stipple));
       } else {
          invert_stipple(newStipple.stipple, ctx->PolygonStipple,
                         ctx->DrawBuffer->Height);
       }
 
       st->pipe->set_polygon_stipple(st->pipe, &newStipple);
    }
 }
-
-
-/** Update the stipple when the pattern or window height changes */
-const struct st_tracked_state st_update_polygon_stipple = {
-   update_stipple					/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c
index ec89f16..43dd300 100644
--- a/src/mesa/state_tracker/st_atom_storagebuf.c
+++ b/src/mesa/state_tracker/st_atom_storagebuf.c
@@ -83,81 +83,57 @@ st_bind_ssbos(struct st_context *st, struct gl_program *prog,
                                 prog->info.num_ssbos, buffers);
    /* clear out any stale shader buffers */
    if (prog->info.num_ssbos < c->MaxShaderStorageBlocks)
       st->pipe->set_shader_buffers(
             st->pipe, shader_type,
             c->MaxAtomicBuffers + prog->info.num_ssbos,
             c->MaxShaderStorageBlocks - prog->info.num_ssbos,
             NULL);
 }
 
-static void bind_vs_ssbos(struct st_context *st)
+void st_bind_vs_ssbos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
 
    st_bind_ssbos(st, prog, PIPE_SHADER_VERTEX);
 }
 
-const struct st_tracked_state st_bind_vs_ssbos = {
-   bind_vs_ssbos
-};
-
-static void bind_fs_ssbos(struct st_context *st)
+void st_bind_fs_ssbos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
 
    st_bind_ssbos(st, prog, PIPE_SHADER_FRAGMENT);
 }
 
-const struct st_tracked_state st_bind_fs_ssbos = {
-   bind_fs_ssbos
-};
-
-static void bind_gs_ssbos(struct st_context *st)
+void st_bind_gs_ssbos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
 
    st_bind_ssbos(st, prog, PIPE_SHADER_GEOMETRY);
 }
 
-const struct st_tracked_state st_bind_gs_ssbos = {
-   bind_gs_ssbos
-};
-
-static void bind_tcs_ssbos(struct st_context *st)
+void st_bind_tcs_ssbos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
 
    st_bind_ssbos(st, prog, PIPE_SHADER_TESS_CTRL);
 }
 
-const struct st_tracked_state st_bind_tcs_ssbos = {
-   bind_tcs_ssbos
-};
-
-static void bind_tes_ssbos(struct st_context *st)
+void st_bind_tes_ssbos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
 
    st_bind_ssbos(st, prog, PIPE_SHADER_TESS_EVAL);
 }
 
-const struct st_tracked_state st_bind_tes_ssbos = {
-   bind_tes_ssbos
-};
-
-static void bind_cs_ssbos(struct st_context *st)
+void st_bind_cs_ssbos(struct st_context *st)
 {
    struct gl_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
 
    st_bind_ssbos(st, prog, PIPE_SHADER_COMPUTE);
 }
-
-const struct st_tracked_state st_bind_cs_ssbos = {
-   bind_cs_ssbos
-};
diff --git a/src/mesa/state_tracker/st_atom_tess.c b/src/mesa/state_tracker/st_atom_tess.c
index 103e41d..6cf3ff7 100644
--- a/src/mesa/state_tracker/st_atom_tess.c
+++ b/src/mesa/state_tracker/st_atom_tess.c
@@ -30,28 +30,23 @@
  *   Marek Olšák <maraeo at gmail.com>
  */
 
 
 #include "main/macros.h"
 #include "st_context.h"
 #include "pipe/p_context.h"
 #include "st_atom.h"
 
 
-static void
-update_tess(struct st_context *st)
+void
+st_update_tess(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
    struct pipe_context *pipe = st->pipe;
 
    if (!pipe->set_tess_state)
       return;
 
    pipe->set_tess_state(pipe,
                         ctx->TessCtrlProgram.patch_default_outer_level,
                         ctx->TessCtrlProgram.patch_default_inner_level);
 }
-
-
-const struct st_tracked_state st_update_tess = {
-   update_tess                  /* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index fa4b644..a99bc1a 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -192,132 +192,102 @@ update_textures(struct st_context *st,
    }
 
    cso_set_sampler_views(st->cso_context,
                          shader_stage,
                          *num_textures,
                          sampler_views);
 }
 
 
 
-static void
-update_vertex_textures(struct st_context *st)
+void
+st_update_vertex_textures(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits > 0) {
       update_textures(st,
                       MESA_SHADER_VERTEX,
                       ctx->VertexProgram._Current,
                       ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
                       st->state.sampler_views[PIPE_SHADER_VERTEX],
                       &st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
    }
 }
 
 
-static void
-update_fragment_textures(struct st_context *st)
+void
+st_update_fragment_textures(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    update_textures(st,
                    MESA_SHADER_FRAGMENT,
                    ctx->FragmentProgram._Current,
                    ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
                    st->state.sampler_views[PIPE_SHADER_FRAGMENT],
                    &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
 }
 
 
-static void
-update_geometry_textures(struct st_context *st)
+void
+st_update_geometry_textures(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->GeometryProgram._Current) {
       update_textures(st,
                       MESA_SHADER_GEOMETRY,
                       ctx->GeometryProgram._Current,
                       ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits,
                       st->state.sampler_views[PIPE_SHADER_GEOMETRY],
                       &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]);
    }
 }
 
 
-static void
-update_tessctrl_textures(struct st_context *st)
+void
+st_update_tessctrl_textures(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->TessCtrlProgram._Current) {
       update_textures(st,
                       MESA_SHADER_TESS_CTRL,
                       ctx->TessCtrlProgram._Current,
                       ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits,
                       st->state.sampler_views[PIPE_SHADER_TESS_CTRL],
                       &st->state.num_sampler_views[PIPE_SHADER_TESS_CTRL]);
    }
 }
 
 
-static void
-update_tesseval_textures(struct st_context *st)
+void
+st_update_tesseval_textures(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->TessEvalProgram._Current) {
       update_textures(st,
                       MESA_SHADER_TESS_EVAL,
                       ctx->TessEvalProgram._Current,
                       ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
                       st->state.sampler_views[PIPE_SHADER_TESS_EVAL],
                       &st->state.num_sampler_views[PIPE_SHADER_TESS_EVAL]);
    }
 }
 
 
-static void
-update_compute_textures(struct st_context *st)
+void
+st_update_compute_textures(struct st_context *st)
 {
    const struct gl_context *ctx = st->ctx;
 
    if (ctx->ComputeProgram._Current) {
       update_textures(st,
                       MESA_SHADER_COMPUTE,
                       ctx->ComputeProgram._Current,
                       ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
                       st->state.sampler_views[PIPE_SHADER_COMPUTE],
                       &st->state.num_sampler_views[PIPE_SHADER_COMPUTE]);
    }
 }
-
-
-const struct st_tracked_state st_update_fragment_texture = {
-   update_fragment_textures				/* update */
-};
-
-
-const struct st_tracked_state st_update_vertex_texture = {
-   update_vertex_textures				/* update */
-};
-
-
-const struct st_tracked_state st_update_geometry_texture = {
-   update_geometry_textures				/* update */
-};
-
-
-const struct st_tracked_state st_update_tessctrl_texture = {
-   update_tessctrl_textures				/* update */
-};
-
-
-const struct st_tracked_state st_update_tesseval_texture = {
-   update_tesseval_textures				/* update */
-};
-
-
-const struct st_tracked_state st_update_compute_texture = {
-   update_compute_textures				/* update */
-};
diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c
index 8f750a9..900f061 100644
--- a/src/mesa/state_tracker/st_atom_viewport.c
+++ b/src/mesa/state_tracker/st_atom_viewport.c
@@ -32,22 +32,22 @@
 #include "st_atom.h"
 #include "pipe/p_context.h"
 #include "cso_cache/cso_context.h"
 
 /**
  * Update the viewport transformation matrix.  Depends on:
  *  - viewport pos/size
  *  - depthrange
  *  - window pos/size or FBO size
  */
-static void
-update_viewport( struct st_context *st )
+void
+st_update_viewport( struct st_context *st )
 {
    struct gl_context *ctx = st->ctx;
    GLfloat yScale, yBias;
    unsigned i;
    /* _NEW_BUFFERS
     */
    if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
       /* Drawing to a window.  The corresponding gallium surface uses
        * Y=0=TOP but OpenGL is Y=0=BOTTOM.  So we need to invert the viewport.
        */
@@ -73,15 +73,10 @@ update_viewport( struct st_context *st )
 
       st->state.viewport[i].translate[0] = translate[0];
       st->state.viewport[i].translate[1] = translate[1] * yScale + yBias;
       st->state.viewport[i].translate[2] = translate[2];
    }
 
    cso_set_viewport(st->cso_context, &st->state.viewport[0]);
    if (ctx->Const.MaxViewports > 1)
       st->pipe->set_viewport_states(st->pipe, 1, ctx->Const.MaxViewports - 1, &st->state.viewport[1]);
 }
-
-
-const struct st_tracked_state st_update_viewport = {
-   update_viewport					/* update */
-};
-- 
2.7.4



More information about the mesa-dev mailing list