st/mesa: use correct pipe functions to create tess shaders
authorMarek Olšák <marek.olsak@amd.com>
Thu, 11 Feb 2016 15:40:54 +0000 (16:40 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 11 Feb 2016 15:56:28 +0000 (16:56 +0100)
Broken by one of my cleanups. Spotted by luck.

Radeonsi doesn't care, because all shader create callbacks go to the same
function.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_program.c
src/mesa/state_tracker/st_program.h

index 23b7abfc1c55d9c1e35de851763008713c871e3e..c8650a5899ad8227d0790e285144045bbb7e9d9a 100644 (file)
@@ -172,7 +172,8 @@ update_gp( struct st_context *st )
    stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
    assert(stgp->Base.Base.Target == GL_GEOMETRY_PROGRAM_NV);
 
-   st->gp_variant = st_get_basic_variant(st, &stgp->tgsi, &stgp->variants);
+   st->gp_variant = st_get_basic_variant(st, PIPE_SHADER_GEOMETRY,
+                                         &stgp->tgsi, &stgp->variants);
 
    st_reference_geomprog(st, &st->gp, stgp);
 
@@ -204,7 +205,8 @@ update_tcp( struct st_context *st )
    sttcp = st_tessctrl_program(st->ctx->TessCtrlProgram._Current);
    assert(sttcp->Base.Base.Target == GL_TESS_CONTROL_PROGRAM_NV);
 
-   st->tcp_variant = st_get_basic_variant(st, &sttcp->tgsi, &sttcp->variants);
+   st->tcp_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL,
+                                          &sttcp->tgsi, &sttcp->variants);
 
    st_reference_tesscprog(st, &st->tcp, sttcp);
 
@@ -236,7 +238,8 @@ update_tep( struct st_context *st )
    sttep = st_tesseval_program(st->ctx->TessEvalProgram._Current);
    assert(sttep->Base.Base.Target == GL_TESS_EVALUATION_PROGRAM_NV);
 
-   st->tep_variant = st_get_basic_variant(st, &sttep->tgsi, &sttep->variants);
+   st->tep_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL,
+                                          &sttep->tgsi, &sttep->variants);
 
    st_reference_tesseprog(st, &st->tep, sttep);
 
index 624586e6d67db6d58b38100490c2e3cfaa7b84df..5bd626f861055853ff179951fd06913b65388d40 100644 (file)
@@ -1271,6 +1271,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 pipe_shader_state *tgsi,
                      struct st_basic_variant **variants)
 {
@@ -1293,7 +1294,22 @@ st_get_basic_variant(struct st_context *st,
       v = CALLOC_STRUCT(st_basic_variant);
       if (v) {
          /* fill in new variant */
-         v->driver_shader = pipe->create_gs_state(pipe, tgsi);
+         switch (pipe_shader) {
+         case PIPE_SHADER_TESS_CTRL:
+            v->driver_shader = pipe->create_tcs_state(pipe, tgsi);
+            break;
+         case PIPE_SHADER_TESS_EVAL:
+            v->driver_shader = pipe->create_tes_state(pipe, tgsi);
+            break;
+         case PIPE_SHADER_GEOMETRY:
+            v->driver_shader = pipe->create_gs_state(pipe, tgsi);
+            break;
+         default:
+            assert(!"unhandled shader type");
+            free(v);
+            return NULL;
+         }
+
          v->key = key;
 
          /* insert into list */
@@ -1587,19 +1603,19 @@ st_precompile_shader_variant(struct st_context *st,
 
    case GL_TESS_CONTROL_PROGRAM_NV: {
       struct st_tessctrl_program *p = (struct st_tessctrl_program *)prog;
-      st_get_basic_variant(st, &p->tgsi, &p->variants);
+      st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL, &p->tgsi, &p->variants);
       break;
    }
 
    case GL_TESS_EVALUATION_PROGRAM_NV: {
       struct st_tesseval_program *p = (struct st_tesseval_program *)prog;
-      st_get_basic_variant(st, &p->tgsi, &p->variants);
+      st_get_basic_variant(st, PIPE_SHADER_TESS_EVAL, &p->tgsi, &p->variants);
       break;
    }
 
    case GL_GEOMETRY_PROGRAM_NV: {
       struct st_geometry_program *p = (struct st_geometry_program *)prog;
-      st_get_basic_variant(st, &p->tgsi, &p->variants);
+      st_get_basic_variant(st, PIPE_SHADER_GEOMETRY, &p->tgsi, &p->variants);
       break;
    }
 
index 7717d02cd3f61e4f6df6161ad540dffa65922540..74f3def6095e33b181c0ab1c59f9716172cab672 100644 (file)
@@ -352,6 +352,7 @@ st_get_fp_variant(struct st_context *st,
 
 extern struct st_basic_variant *
 st_get_basic_variant(struct st_context *st,
+                     unsigned pipe_shader,
                      struct pipe_shader_state *tgsi,
                      struct st_basic_variant **variants);