[Mesa-dev] [PATCH 5/7] mesa/st: pass st_compute_program to st_get_cp_variant

Rob Clark robdclark at gmail.com
Thu Sep 8 20:30:38 UTC 2016


Makes it more consistent with vp/fp variants, and will be needed in a
following patch.

Signed-off-by: Rob Clark <robdclark at gmail.com>
---
 src/mesa/state_tracker/st_atom_shader.c |  2 +-
 src/mesa/state_tracker/st_program.c     | 12 ++++++------
 src/mesa/state_tracker/st_program.h     |  3 +--
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index c2e4fc8..3cf8992 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -322,7 +322,7 @@ update_cp( struct st_context *st )
    assert(stcp->Base.Base.Target == GL_COMPUTE_PROGRAM_NV);
 
    key = st_get_basic_variant_key(st, &stcp->Base.Base);
-   st->cp_variant = st_get_cp_variant(st, &stcp->tgsi, &stcp->variants, &key);
+   st->cp_variant = st_get_cp_variant(st, stcp, &key);
 
    st_reference_compprog(st, &st->cp, stcp);
 
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 284cc22..41ccc20 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1685,15 +1685,15 @@ st_translate_compute_program(struct st_context *st,
  */
 struct st_basic_variant *
 st_get_cp_variant(struct st_context *st,
-                  struct pipe_compute_state *tgsi,
-                  struct st_basic_variant **variants,
+                  struct st_compute_program *stcp,
                   const struct st_basic_variant_key *key)
 {
    struct pipe_context *pipe = st->pipe;
+   struct pipe_compute_state *tgsi = &stcp->tgsi;
    struct st_basic_variant *v;
 
    /* Search for existing variant */
-   for (v = *variants; v; v = v->next) {
+   for (v = stcp->variants; v; v = v->next) {
       if (memcmp(&v->key, key, sizeof(*key)) == 0) {
          break;
       }
@@ -1708,8 +1708,8 @@ st_get_cp_variant(struct st_context *st,
          v->key = *key;
 
          /* insert into list */
-         v->next = *variants;
-         *variants = v;
+         v->next = stcp->variants;
+         stcp->variants = v;
       }
    }
 
@@ -1955,7 +1955,7 @@ st_precompile_shader_variant(struct st_context *st,
    case GL_COMPUTE_PROGRAM_NV: {
       struct st_compute_program *p = (struct st_compute_program *)prog;
       struct st_basic_variant_key key = st_get_basic_variant_key(st, prog);
-      st_get_cp_variant(st, &p->tgsi, &p->variants, &key);
+      st_get_cp_variant(st, p, &key);
       break;
    }
 
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index f4e572a..dd5a89b 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -447,8 +447,7 @@ st_get_fp_variant(struct st_context *st,
 
 extern struct st_basic_variant *
 st_get_cp_variant(struct st_context *st,
-                  struct pipe_compute_state *tgsi,
-                  struct st_basic_variant **variants,
+                  struct st_compute_program *p,
                   const struct st_basic_variant_key *key);
 
 extern struct st_basic_variant *
-- 
2.7.4



More information about the mesa-dev mailing list