Mesa (master): st/mesa: remove struct st_tracked_state

Marek Olšák mareko at kemper.freedesktop.org
Mon May 8 16:37:08 UTC 2017


Module: Mesa
Branch: master
Commit: d1ee2b37ffb5c4f8365592d7c548ccf50bd0f10a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1ee2b37ffb5c4f8365592d7c548ccf50bd0f10a

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Apr 30 00:42:16 2017 +0200

st/mesa: remove struct st_tracked_state

It contains only one member: the update function. Let's use the update
function directly.

Tested-by: Edmondo Tommasina <edmondo.tommasina at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 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 abbbd4d45a..b40ce1e339 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -36,11 +36,12 @@
 #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
 };
@@ -48,7 +49,7 @@ static const struct st_tracked_state *atoms[] =
 
 void st_init_atoms( struct st_context *st )
 {
-   STATIC_ASSERT(ARRAY_SIZE(atoms) <= 64);
+   STATIC_ASSERT(ARRAY_SIZE(update_functions) <= 64);
 }
 
 
@@ -226,9 +227,9 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
     * 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 0145cefd04..663bc06707 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -48,11 +48,6 @@ enum st_pipeline {
    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 );
@@ -77,8 +72,8 @@ enum {
 #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
 
diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c
index e58cedb26c..fb5c149898 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -626,7 +626,7 @@ setup_non_interleaved_attribs(struct st_context *st,
    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;
@@ -678,8 +678,3 @@ static void update_array(struct st_context *st)
    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 11fb84f111..171fecccb7 100644
--- a/src/mesa/state_tracker/st_atom_atomicbuf.c
+++ b/src/mesa/state_tracker/st_atom_atomicbuf.c
@@ -69,8 +69,8 @@ st_bind_atomics(struct st_context *st, struct gl_program *prog,
    }
 }
 
-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];
@@ -78,12 +78,8 @@ bind_vs_atomics(struct st_context *st)
    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];
@@ -91,12 +87,8 @@ bind_fs_atomics(struct st_context *st)
    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];
@@ -104,12 +96,8 @@ bind_gs_atomics(struct st_context *st)
    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];
@@ -117,12 +105,8 @@ bind_tcs_atomics(struct st_context *st)
    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];
@@ -130,19 +114,11 @@ bind_tes_atomics(struct st_context *st)
    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 f76cfab943..74289979c1 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -186,8 +186,8 @@ blend_per_rt(const struct gl_context *ctx)
    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;
@@ -283,8 +283,3 @@ update_blend( struct st_context *st )
       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 0df7985c09..0db3a5d543 100644
--- a/src/mesa/state_tracker/st_atom_clip.c
+++ b/src/mesa/state_tracker/st_atom_clip.c
@@ -41,7 +41,7 @@
 
 /* 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;
@@ -66,8 +66,3 @@ static void update_clip( struct st_context *st )
       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 d16f92e2ac..9c04580f08 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -139,7 +139,7 @@ void st_upload_constants( struct st_context *st,
 /**
  * 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;
@@ -147,17 +147,10 @@ static void update_vs_constants(struct st_context *st )
    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;
@@ -166,13 +159,9 @@ static void update_fs_constants(struct st_context *st )
 }
 
 
-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;
@@ -183,13 +172,9 @@ static void update_gs_constants(struct st_context *st )
    }
 }
 
-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;
@@ -200,13 +185,9 @@ static void update_tcs_constants(struct st_context *st )
    }
 }
 
-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;
@@ -217,13 +198,9 @@ static void update_tes_constants(struct st_context *st )
    }
 }
 
-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;
@@ -234,10 +211,6 @@ static void update_cs_constants(struct st_context *st )
    }
 }
 
-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)
 {
@@ -276,7 +249,7 @@ static void st_bind_ubos(struct st_context *st, struct gl_program *prog,
    }
 }
 
-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];
@@ -284,11 +257,7 @@ static void bind_vs_ubos(struct st_context *st)
    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];
@@ -296,11 +265,7 @@ static void bind_fs_ubos(struct st_context *st)
    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];
@@ -308,11 +273,7 @@ static void bind_gs_ubos(struct st_context *st)
    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];
@@ -320,11 +281,7 @@ static void bind_tcs_ubos(struct st_context *st)
    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];
@@ -332,18 +289,10 @@ static void bind_tes_ubos(struct st_context *st)
    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 7092c3f83e..432de4bde3 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -95,8 +95,8 @@ gl_stencil_op_to_pipe(GLenum func)
    }
 }
 
-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;
@@ -159,8 +159,3 @@ update_depth_stencil_alpha(struct st_context *st)
    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 7435c00a4f..9b15c88d84 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -104,8 +104,8 @@ framebuffer_quantize_num_samples(struct st_context *st, unsigned num_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;
@@ -212,9 +212,3 @@ update_framebuffer_state( struct st_context *st )
 
    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 077bafd09a..381eca191a 100644
--- a/src/mesa/state_tracker/st_atom_image.c
+++ b/src/mesa/state_tracker/st_atom_image.c
@@ -139,7 +139,7 @@ st_bind_images(struct st_context *st, struct gl_program *prog,
             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];
@@ -147,11 +147,7 @@ static void bind_vs_images(struct st_context *st)
    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];
@@ -159,11 +155,7 @@ static void bind_fs_images(struct st_context *st)
    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];
@@ -171,11 +163,7 @@ static void bind_gs_images(struct st_context *st)
    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];
@@ -183,11 +171,7 @@ static void bind_tcs_images(struct st_context *st)
    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];
@@ -195,18 +179,10 @@ static void bind_tes_images(struct st_context *st)
    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 4212dacfa9..ca997af124 100644
--- a/src/mesa/state_tracker/st_atom_list.h
+++ b/src/mesa/state_tracker/st_atom_list.h
@@ -15,18 +15,18 @@ 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)
@@ -34,8 +34,8 @@ 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)
@@ -70,8 +70,8 @@ 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)
diff --git a/src/mesa/state_tracker/st_atom_msaa.c b/src/mesa/state_tracker/st_atom_msaa.c
index 69aea6990a..c591faddd8 100644
--- a/src/mesa/state_tracker/st_atom_msaa.c
+++ b/src/mesa/state_tracker/st_atom_msaa.c
@@ -38,7 +38,7 @@
 
 /* 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;
@@ -72,7 +72,7 @@ static void update_sample_mask( struct st_context *st )
    }
 }
 
-static void update_sample_shading( struct st_context *st )
+void st_update_sample_shading( struct st_context *st )
 {
    if (!st->fp)
       return;
@@ -84,11 +84,3 @@ static void update_sample_shading( struct st_context *st )
 	 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 a2951a1d6b..9b99036071 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -84,8 +84,8 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
 /**
  * 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;
 
@@ -100,8 +100,3 @@ update_pixel_transfer(struct st_context *st)
       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 0b0e0457dd..42696b10a3 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -60,7 +60,7 @@ static GLuint translate_fill( GLenum mode )
 
 
 
-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;
@@ -292,7 +292,3 @@ static void update_raster_state( struct st_context *st )
 
    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 065d1df335..f33e334bb9 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -334,8 +334,8 @@ update_shader_samplers(struct st_context *st,
 }
 
 
-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;
 
@@ -348,8 +348,8 @@ update_vertex_samplers(struct st_context *st)
 }
 
 
-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;
 
@@ -364,8 +364,8 @@ update_tessctrl_samplers(struct st_context *st)
 }
 
 
-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;
 
@@ -380,8 +380,8 @@ update_tesseval_samplers(struct st_context *st)
 }
 
 
-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;
 
@@ -396,8 +396,8 @@ update_geometry_samplers(struct st_context *st)
 }
 
 
-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;
 
@@ -410,8 +410,8 @@ update_fragment_samplers(struct st_context *st)
 }
 
 
-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;
 
@@ -424,28 +424,3 @@ update_compute_samplers(struct st_context *st)
                              &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 fb478a3987..d3450be01e 100644
--- a/src/mesa/state_tracker/st_atom_scissor.c
+++ b/src/mesa/state_tracker/st_atom_scissor.c
@@ -41,8 +41,8 @@
 /**
  * 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;
@@ -99,8 +99,8 @@ update_scissor( struct st_context *st )
       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;
@@ -139,11 +139,3 @@ update_window_rectangles(struct st_context *st)
       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 ee97c69df3..0a72d14817 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -93,8 +93,8 @@ get_texture_target(struct gl_context *ctx, const unsigned unit)
  * 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;
@@ -137,18 +137,12 @@ update_fp( struct st_context *st )
 }
 
 
-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;
@@ -190,14 +184,8 @@ update_vp( struct st_context *st )
 }
 
 
-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;
 
@@ -219,14 +207,9 @@ update_gp( struct st_context *st )
                                   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;
 
@@ -248,14 +231,9 @@ update_tcp( struct st_context *st )
                                   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;
 
@@ -277,14 +255,9 @@ update_tep( struct st_context *st )
                                   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;
 
@@ -304,7 +277,3 @@ update_cp( struct st_context *st )
    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 5f7bf82c0b..87599f94d5 100644
--- a/src/mesa/state_tracker/st_atom_stipple.c
+++ b/src/mesa/state_tracker/st_atom_stipple.c
@@ -60,9 +60,9 @@ invert_stipple(GLuint dest[32], const GLuint src[32], GLuint winHeight)
 }
 
 
-
-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);
@@ -84,9 +84,3 @@ update_stipple( struct st_context *st )
       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 ec89f16383..43dd3000a3 100644
--- a/src/mesa/state_tracker/st_atom_storagebuf.c
+++ b/src/mesa/state_tracker/st_atom_storagebuf.c
@@ -90,7 +90,7 @@ st_bind_ssbos(struct st_context *st, struct gl_program *prog,
             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];
@@ -98,11 +98,7 @@ static void bind_vs_ssbos(struct st_context *st)
    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];
@@ -110,11 +106,7 @@ static void bind_fs_ssbos(struct st_context *st)
    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];
@@ -122,11 +114,7 @@ static void bind_gs_ssbos(struct st_context *st)
    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];
@@ -134,11 +122,7 @@ static void bind_tcs_ssbos(struct st_context *st)
    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];
@@ -146,18 +130,10 @@ static void bind_tes_ssbos(struct st_context *st)
    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 103e41d1ea..6cf3ff7339 100644
--- a/src/mesa/state_tracker/st_atom_tess.c
+++ b/src/mesa/state_tracker/st_atom_tess.c
@@ -37,8 +37,8 @@
 #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;
@@ -50,8 +50,3 @@ update_tess(struct st_context *st)
                         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 fa4b6448ea..a99bc1a188 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -199,8 +199,8 @@ update_textures(struct st_context *st,
 
 
 
-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;
 
@@ -215,8 +215,8 @@ update_vertex_textures(struct st_context *st)
 }
 
 
-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;
 
@@ -229,8 +229,8 @@ update_fragment_textures(struct st_context *st)
 }
 
 
-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;
 
@@ -245,8 +245,8 @@ update_geometry_textures(struct st_context *st)
 }
 
 
-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;
 
@@ -261,8 +261,8 @@ update_tessctrl_textures(struct st_context *st)
 }
 
 
-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;
 
@@ -277,8 +277,8 @@ update_tesseval_textures(struct st_context *st)
 }
 
 
-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;
 
@@ -291,33 +291,3 @@ update_compute_textures(struct st_context *st)
                       &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 8f750a9ff6..900f0617ca 100644
--- a/src/mesa/state_tracker/st_atom_viewport.c
+++ b/src/mesa/state_tracker/st_atom_viewport.c
@@ -39,8 +39,8 @@
  *  - 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;
@@ -80,8 +80,3 @@ update_viewport( struct st_context *st )
    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 */
-};




More information about the mesa-commit mailing list