[Mesa-dev] [PATCH 6/7] mesa/st: pass prog to st_get_basic_variant()

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


Needed in a following patch.

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

diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 3cf8992..f0970ae 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -229,7 +229,7 @@ update_gp( struct st_context *st )
    assert(stgp->Base.Base.Target == GL_GEOMETRY_PROGRAM_NV);
 
    key = st_get_basic_variant_key(st, &stgp->Base.Base);
-   st->gp_variant = st_get_basic_variant(st, PIPE_SHADER_GEOMETRY,
+   st->gp_variant = st_get_basic_variant(st, &stgp->Base.Base,
                                          &stgp->tgsi, &stgp->variants, &key);
 
    st_reference_geomprog(st, &st->gp, stgp);
@@ -260,7 +260,7 @@ update_tcp( struct st_context *st )
    assert(sttcp->Base.Base.Target == GL_TESS_CONTROL_PROGRAM_NV);
 
    key = st_get_basic_variant_key(st, &sttcp->Base.Base);
-   st->tcp_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL,
+   st->tcp_variant = st_get_basic_variant(st, &sttcp->Base.Base,
                                           &sttcp->tgsi, &sttcp->variants, &key);
 
    st_reference_tesscprog(st, &st->tcp, sttcp);
@@ -291,7 +291,7 @@ update_tep( struct st_context *st )
    assert(sttep->Base.Base.Target == GL_TESS_EVALUATION_PROGRAM_NV);
 
    key = st_get_basic_variant_key(st, &sttep->Base.Base);
-   st->tep_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL,
+   st->tep_variant = st_get_basic_variant(st, &sttep->Base.Base,
                                           &sttep->tgsi, &sttep->variants, &key);
 
    st_reference_tesseprog(st, &st->tep, sttep);
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 41ccc20..f8be835 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1531,7 +1531,7 @@ st_translate_geometry_program(struct st_context *st,
  */
 struct st_basic_variant *
 st_get_basic_variant(struct st_context *st,
-                     unsigned pipe_shader,
+                     struct gl_program *prog,
                      struct pipe_shader_state *tgsi,
                      struct st_basic_variant **variants,
                      const struct st_basic_variant_key *key)
@@ -1551,14 +1551,14 @@ st_get_basic_variant(struct st_context *st,
       v = CALLOC_STRUCT(st_basic_variant);
       if (v) {
          /* fill in new variant */
-         switch (pipe_shader) {
-         case PIPE_SHADER_TESS_CTRL:
+         switch (prog->Target) {
+         case GL_TESS_CONTROL_PROGRAM_NV:
             v->driver_shader = pipe->create_tcs_state(pipe, tgsi);
             break;
-         case PIPE_SHADER_TESS_EVAL:
+         case GL_TESS_EVALUATION_PROGRAM_NV:
             v->driver_shader = pipe->create_tes_state(pipe, tgsi);
             break;
-         case PIPE_SHADER_GEOMETRY:
+         case GL_GEOMETRY_PROGRAM_NV:
             v->driver_shader = pipe->create_gs_state(pipe, tgsi);
             break;
          default:
@@ -1924,21 +1924,21 @@ st_precompile_shader_variant(struct st_context *st,
    case GL_TESS_CONTROL_PROGRAM_NV: {
       struct st_tessctrl_program *p = (struct st_tessctrl_program *)prog;
       struct st_basic_variant_key key = st_get_basic_variant_key(st, prog);
-      st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, &p->tgsi, &p->variants, &key);
+      st_get_basic_variant(st, prog, &p->tgsi, &p->variants, &key);
       break;
    }
 
    case GL_TESS_EVALUATION_PROGRAM_NV: {
       struct st_tesseval_program *p = (struct st_tesseval_program *)prog;
       struct st_basic_variant_key key = st_get_basic_variant_key(st, prog);
-      st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, &p->tgsi, &p->variants, &key);
+      st_get_basic_variant(st, prog, &p->tgsi, &p->variants, &key);
       break;
    }
 
    case GL_GEOMETRY_PROGRAM_NV: {
       struct st_geometry_program *p = (struct st_geometry_program *)prog;
       struct st_basic_variant_key key = st_get_basic_variant_key(st, prog);
-      st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, &p->tgsi, &p->variants, &key);
+      st_get_basic_variant(st, prog, &p->tgsi, &p->variants, &key);
       break;
    }
 
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index dd5a89b..9cf492c 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -452,7 +452,7 @@ st_get_cp_variant(struct st_context *st,
 
 extern struct st_basic_variant *
 st_get_basic_variant(struct st_context *st,
-                     unsigned pipe_shader,
+                     struct gl_program *prog,
                      struct pipe_shader_state *tgsi,
                      struct st_basic_variant **variants,
                      const struct st_basic_variant_key *key);
-- 
2.7.4



More information about the mesa-dev mailing list