[Mesa-dev] [PATCH 7/7] mesa/i965: eliminate gl_tess_ctrl_program and use new shared shader_info

Timothy Arceri timothy.arceri at collabora.com
Thu Oct 13 08:43:10 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_context.h           |  6 ++---
 src/mesa/drivers/dri/i965/brw_draw.c              |  2 +-
 src/mesa/drivers/dri/i965/brw_program.c           |  2 +-
 src/mesa/drivers/dri/i965/brw_tcs.c               | 32 ++++++++++-------------
 src/mesa/drivers/dri/i965/brw_tcs_surface_state.c |  2 +-
 src/mesa/drivers/dri/i965/brw_tes.c               | 20 +++++++-------
 src/mesa/drivers/dri/i965/gen7_hs_state.c         |  4 +--
 src/mesa/main/context.c                           |  2 +-
 src/mesa/main/mtypes.h                            | 12 +--------
 src/mesa/main/shaderapi.c                         |  4 +--
 src/mesa/main/state.c                             |  9 +++----
 src/mesa/program/prog_statevars.c                 |  2 +-
 src/mesa/program/program.c                        |  4 +--
 src/mesa/program/program.h                        | 23 ----------------
 src/mesa/state_tracker/st_atom.c                  |  2 +-
 src/mesa/state_tracker/st_atom_constbuf.c         |  2 +-
 src/mesa/state_tracker/st_atom_sampler.c          |  2 +-
 src/mesa/state_tracker/st_atom_shader.c           |  2 +-
 src/mesa/state_tracker/st_atom_texture.c          |  2 +-
 src/mesa/state_tracker/st_cb_program.c            | 10 +++----
 src/mesa/state_tracker/st_program.c               |  6 ++---
 src/mesa/state_tracker/st_program.h               |  6 ++---
 22 files changed, 57 insertions(+), 99 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index c92bb9f..9b7e184 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -337,7 +337,7 @@ struct brw_vertex_program {
 
 /** Subclass of Mesa tessellation control program */
 struct brw_tess_ctrl_program {
-   struct gl_tess_ctrl_program program;
+   struct gl_program program;
    unsigned id;  /**< serial no. to identify tess ctrl progs, never re-used */
 };
 
@@ -1008,7 +1008,7 @@ struct brw_context
     */
    const struct gl_vertex_program *vertex_program;
    const struct gl_geometry_program *geometry_program;
-   const struct gl_tess_ctrl_program *tess_ctrl_program;
+   const struct gl_program *tess_ctrl_program;
    const struct gl_tess_eval_program *tess_eval_program;
    const struct gl_fragment_program *fragment_program;
    const struct gl_compute_program *compute_program;
@@ -1730,7 +1730,7 @@ brw_vertex_program_const(const struct gl_vertex_program *p)
 }
 
 static inline struct brw_tess_ctrl_program *
-brw_tess_ctrl_program(struct gl_tess_ctrl_program *p)
+brw_tess_ctrl_program(struct gl_program *p)
 {
    return (struct brw_tess_ctrl_program *) p;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 5d176ef..5485de3 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -458,7 +458,7 @@ brw_try_draw_prims(struct gl_context *ctx,
    brw->tes.base.sampler_count = ctx->TessEvalProgram._Current ?
       util_last_bit(ctx->TessEvalProgram._Current->Base.SamplersUsed) : 0;
    brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?
-      util_last_bit(ctx->TessCtrlProgram._Current->Base.SamplersUsed) : 0;
+      util_last_bit(ctx->TessCtrlProgram._Current->SamplersUsed) : 0;
    brw->vs.base.sampler_count =
       util_last_bit(ctx->VertexProgram._Current->Base.SamplersUsed);
 
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index a41f36e..4e0df5a 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -168,7 +168,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
       if (prog) {
          prog->id = get_new_program_id(brw->screen);
 
-         return _mesa_init_gl_program(&prog->program.Base, target, id);
+         return _mesa_init_gl_program(&prog->program, target, id);
       } else {
          return NULL;
       }
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 0f03fab..08cf413 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -178,7 +178,7 @@ brw_codegen_tcs_prog(struct brw_context *brw,
    double start_time = 0;
 
    if (tcp) {
-      nir = tcp->program.Base.nir;
+      nir = tcp->program.nir;
    } else {
       /* Create a dummy nir_shader.  We won't actually use NIR code to
        * generate assembly (it's easier to generate assembly directly),
@@ -211,14 +211,14 @@ brw_codegen_tcs_prog(struct brw_context *brw,
 
    if (tcs) {
       brw_assign_common_binding_table_offsets(MESA_SHADER_TESS_CTRL, devinfo,
-                                              shader_prog, &tcp->program.Base,
+                                              shader_prog, &tcp->program,
                                               &prog_data.base.base, 0);
 
       prog_data.base.base.image_param =
          rzalloc_array(NULL, struct brw_image_param, tcs->NumImages);
       prog_data.base.base.nr_image_params = tcs->NumImages;
 
-      brw_nir_setup_glsl_uniforms(nir, shader_prog, &tcp->program.Base,
+      brw_nir_setup_glsl_uniforms(nir, shader_prog, &tcp->program,
                                   &prog_data.base.base,
                                   compiler->scalar_stage[MESA_SHADER_TESS_CTRL]);
    } else {
@@ -316,24 +316,21 @@ void
 brw_tcs_populate_key(struct brw_context *brw,
                      struct brw_tcs_prog_key *key)
 {
-   uint64_t per_vertex_slots =
-      brw->tess_eval_program->Base.nir->info->inputs_read;
-   uint32_t per_patch_slots =
-      brw->tess_eval_program->Base.nir->info->patch_inputs_read;
-
    struct brw_tess_ctrl_program *tcp =
       (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
    struct brw_tess_eval_program *tep =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
-   struct gl_program *prog = &tcp->program.Base;
+   struct gl_program *tes_prog = &tep->program;
+
+   uint64_t per_vertex_slots = tes_prog->info.inputs_read;
+   uint32_t per_patch_slots = tes_prog->info.patch_inputs_read;
 
    memset(key, 0, sizeof(*key));
 
-   if (brw->tess_ctrl_program) {
-      per_vertex_slots |=
-         brw->tess_ctrl_program->Base.nir->info->outputs_written;
-      per_patch_slots |=
-         brw->tess_ctrl_program->Base.nir->info->patch_outputs_written;
+   if (tcp) {
+      struct gl_program *prog = &tcp->program;
+      per_vertex_slots |= prog->info.outputs_written;
+      per_patch_slots |= prog->info.patch_outputs_written;
    }
 
    if (brw->gen < 8 || !tcp)
@@ -353,9 +350,9 @@ brw_tcs_populate_key(struct brw_context *brw,
       key->program_string_id = tcp->id;
 
       /* _NEW_TEXTURE */
-      brw_populate_sampler_prog_key_data(&brw->ctx, prog, &key->tex);
+      brw_populate_sampler_prog_key_data(&brw->ctx, &tcp->program, &key->tex);
    } else {
-      key->outputs_written = tep->program.Base.nir->info->inputs_read;
+      key->outputs_written = tes_prog->info.inputs_read;
    }
 }
 
@@ -403,8 +400,7 @@ brw_tcs_precompile(struct gl_context *ctx,
    struct brw_stage_prog_data *old_prog_data = brw->tcs.base.prog_data;
    bool success;
 
-   struct gl_tess_ctrl_program *tcp = (struct gl_tess_ctrl_program *)prog;
-   struct brw_tess_ctrl_program *btcp = brw_tess_ctrl_program(tcp);
+   struct brw_tess_ctrl_program *btcp = brw_tess_ctrl_program(prog);
    const struct gl_linked_shader *tes =
       shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL];
 
diff --git a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
index 5021e10..e91488f 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
@@ -52,7 +52,7 @@ brw_upload_tcs_pull_constants(struct brw_context *brw)
 
    _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_TESS_CTRL);
    /* _NEW_PROGRAM_CONSTANTS */
-   brw_upload_pull_constants(brw, BRW_NEW_TCS_CONSTBUF, &tcp->program.Base,
+   brw_upload_pull_constants(brw, BRW_NEW_TCS_CONSTBUF, &tcp->program,
                              stage_state, prog_data);
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 59e4d50..fe03816 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -233,16 +233,15 @@ void
 brw_tes_populate_key(struct brw_context *brw,
                      struct brw_tes_prog_key *key)
 {
-
-   uint64_t per_vertex_slots =
-      brw->tess_eval_program->Base.nir->info->inputs_read;
-   uint32_t per_patch_slots =
-      brw->tess_eval_program->Base.nir->info->patch_inputs_read;
-
+   struct brw_tess_ctrl_program *tcp =
+      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
    struct brw_tess_eval_program *tep =
       (struct brw_tess_eval_program *) brw->tess_eval_program;
    struct gl_program *prog = &tep->program.Base;
 
+   uint64_t per_vertex_slots = prog->info.inputs_read;
+   uint32_t per_patch_slots = prog->info.patch_inputs_read;
+
    memset(key, 0, sizeof(*key));
 
    key->program_string_id = tep->id;
@@ -251,11 +250,10 @@ brw_tes_populate_key(struct brw_context *brw,
     * TES (possibly for cross-thread communication).  These need to
     * be stored in the Patch URB Entry as well.
     */
-   if (brw->tess_ctrl_program) {
-      per_vertex_slots |=
-         brw->tess_ctrl_program->Base.nir->info->outputs_written;
-      per_patch_slots |=
-         brw->tess_ctrl_program->Base.nir->info->patch_outputs_written;
+   if (tcp) {
+      struct gl_program *tcp_prog = &tcp->program;
+      per_vertex_slots |= tcp_prog->info.outputs_written;
+      per_patch_slots |= tcp_prog->info.patch_outputs_written;
    }
 
    /* Ignore gl_TessLevelInner/Outer - we treat them as system values,
diff --git a/src/mesa/drivers/dri/i965/gen7_hs_state.c b/src/mesa/drivers/dri/i965/gen7_hs_state.c
index f16af28..290aea2 100644
--- a/src/mesa/drivers/dri/i965/gen7_hs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_hs_state.c
@@ -41,8 +41,8 @@ gen7_upload_tcs_push_constants(struct brw_context *brw)
       const struct brw_stage_prog_data *prog_data = brw->tcs.base.prog_data;
 
       _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_TESS_CTRL);
-      gen6_upload_push_constants(brw, &tcp->program.Base, prog_data,
-                                      stage_state, AUB_TRACE_VS_CONSTANTS);
+      gen6_upload_push_constants(brw, &tcp->program, prog_data, stage_state,
+                                 AUB_TRACE_VS_CONSTANTS);
    }
 
    gen7_upload_constant_state(brw, stage_state, active, _3DSTATE_CONSTANT_HS);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 47fd4a0..1e4f87d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1297,7 +1297,7 @@ _mesa_free_context_data( struct gl_context *ctx )
    _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
    _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL);
 
-   _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._Current, NULL);
+   _mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current, NULL);
    _mesa_reference_tesseprog(ctx, &ctx->TessEvalProgram._Current, NULL);
    _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL);
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c025040..a869a24 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1998,16 +1998,6 @@ struct gl_vertex_program
 };
 
 
-/** Tessellation control program object */
-struct gl_tess_ctrl_program
-{
-   struct gl_program Base;   /**< base class */
-
-   /* output layout */
-   GLint VerticesOut;
-};
-
-
 /** Tessellation evaluation program object */
 struct gl_tess_eval_program
 {
@@ -2138,7 +2128,7 @@ struct gl_vertex_program_state
 struct gl_tess_ctrl_program_state
 {
    /** Currently bound and valid shader. */
-   struct gl_tess_ctrl_program *_Current;
+   struct gl_program *_Current;
 
    GLint patch_vertices;
    GLfloat patch_default_outer_level[4];
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index c40bb2d..531f8fa 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2165,9 +2165,7 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
       dst->CullDistanceArraySize = src->Vert.CullDistanceArraySize;
       break;
    case MESA_SHADER_TESS_CTRL: {
-      struct gl_tess_ctrl_program *dst_tcp =
-         (struct gl_tess_ctrl_program *) dst;
-      dst_tcp->VerticesOut = src->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
+      dst->info.tcs.vertices_out = src->_LinkedShaders[MESA_SHADER_TESS_CTRL]->
          info.TessCtrl.VerticesOut;
       break;
    }
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index bf6035e..59d3664 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -110,7 +110,7 @@ update_program(struct gl_context *ctx)
    const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
    const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
    const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current;
-   const struct gl_tess_ctrl_program *prevTCP = ctx->TessCtrlProgram._Current;
+   const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
    const struct gl_tess_eval_program *prevTEP = ctx->TessEvalProgram._Current;
    const struct gl_compute_program *prevCP = ctx->ComputeProgram._Current;
    GLbitfield new_state = 0x0;
@@ -208,13 +208,12 @@ update_program(struct gl_context *ctx)
    if (tcsProg && tcsProg->LinkStatus
        && tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]) {
       /* Use GLSL tessellation control shader */
-      _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._Current,
-         gl_tess_ctrl_program(
-            tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program));
+      _mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current,
+          tcsProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program);
    }
    else {
       /* No tessellation control program */
-      _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._Current, NULL);
+      _mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current, NULL);
    }
 
    /* Examine vertex program after fragment program as
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 6e6007e..2ac7b56 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -604,7 +604,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
 
       case STATE_TES_PATCH_VERTICES_IN:
          if (ctx->TessCtrlProgram._Current)
-            val[0].i = ctx->TessCtrlProgram._Current->VerticesOut;
+            val[0].i = ctx->TessCtrlProgram._Current->info.tcs.vertices_out;
          else
             val[0].i = ctx->TessCtrlProgram.patch_vertices;
          return;
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 6767216..f89a833 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -228,8 +228,8 @@ _mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
       return _mesa_init_gl_program(&prog->Base, target, id);
    }
    case GL_TESS_CONTROL_PROGRAM_NV: {
-      struct gl_tess_ctrl_program *prog = CALLOC_STRUCT(gl_tess_ctrl_program);
-      return _mesa_init_gl_program(&prog->Base, target, id);
+      struct gl_program *prog = CALLOC_STRUCT(gl_program);
+      return _mesa_init_gl_program(prog, target, id);
    }
    case GL_TESS_EVALUATION_PROGRAM_NV: {
       struct gl_tess_eval_program *prog = CALLOC_STRUCT(gl_tess_eval_program);
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index 09e6928..d937f82 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -125,16 +125,6 @@ _mesa_reference_compprog(struct gl_context *ctx,
                            (struct gl_program *) prog);
 }
 
-
-static inline void
-_mesa_reference_tesscprog(struct gl_context *ctx,
-                         struct gl_tess_ctrl_program **ptr,
-                         struct gl_tess_ctrl_program *prog)
-{
-   _mesa_reference_program(ctx, (struct gl_program **) ptr,
-                           (struct gl_program *) prog);
-}
-
 static inline void
 _mesa_reference_tesseprog(struct gl_context *ctx,
                          struct gl_tess_eval_program **ptr,
@@ -267,19 +257,6 @@ gl_compute_program_const(const struct gl_program *prog)
    return (const struct gl_compute_program *) prog;
 }
 
-static inline struct gl_tess_ctrl_program *
-gl_tess_ctrl_program(struct gl_program *prog)
-{
-   return (struct gl_tess_ctrl_program *) prog;
-}
-
-static inline const struct gl_tess_ctrl_program *
-gl_tess_ctrl_program_const(const struct gl_program *prog)
-{
-   return (const struct gl_tess_ctrl_program *) prog;
-}
-
-
 static inline struct gl_tess_eval_program *
 gl_tess_eval_program(struct gl_program *prog)
 {
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 94e012a..497ba82 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -70,7 +70,7 @@ static void check_program_state( struct st_context *st )
    struct st_fragment_program *old_fp = st->fp;
 
    struct gl_vertex_program *new_vp = ctx->VertexProgram._Current;
-   struct gl_tess_ctrl_program *new_tcp = ctx->TessCtrlProgram._Current;
+   struct gl_program *new_tcp = ctx->TessCtrlProgram._Current;
    struct gl_tess_eval_program *new_tep = ctx->TessEvalProgram._Current;
    struct gl_geometry_program *new_gp = ctx->GeometryProgram._Current;
    struct gl_fragment_program *new_fp = ctx->FragmentProgram._Current;
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 8882582..90d4ffb 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -195,7 +195,7 @@ static void update_tcs_constants(struct st_context *st )
    struct gl_program_parameter_list *params;
 
    if (tcp) {
-      params = tcp->Base.Base.Parameters;
+      params = tcp->Base.Parameters;
       st_upload_constants( st, params, MESA_SHADER_TESS_CTRL );
    }
 }
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 065df6d..76b355c 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -344,7 +344,7 @@ update_samplers(struct st_context *st)
    if (ctx->TessCtrlProgram._Current) {
       update_shader_samplers(st,
                              PIPE_SHADER_TESS_CTRL,
-                             &ctx->TessCtrlProgram._Current->Base,
+                             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]);
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 2f700a2..0df0770 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -254,7 +254,7 @@ update_tcp( struct st_context *st )
    }
 
    sttcp = st_tessctrl_program(st->ctx->TessCtrlProgram._Current);
-   assert(sttcp->Base.Base.Target == GL_TESS_CONTROL_PROGRAM_NV);
+   assert(sttcp->Base.Target == GL_TESS_CONTROL_PROGRAM_NV);
 
    st->tcp_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL,
                                           &sttcp->tgsi, &sttcp->variants);
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index c8ae62c..fbd73d6 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -253,7 +253,7 @@ update_tessctrl_textures(struct st_context *st)
    if (ctx->TessCtrlProgram._Current) {
       update_textures(st,
                       MESA_SHADER_TESS_CTRL,
-                      &ctx->TessCtrlProgram._Current->Base,
+                      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]);
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 1fd5019..c85f0ef 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -71,7 +71,7 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
    }
    case GL_TESS_CONTROL_PROGRAM_NV: {
       struct st_tessctrl_program *prog = ST_CALLOC_STRUCT(st_tessctrl_program);
-      return _mesa_init_gl_program(&prog->Base.Base, target, id);
+      return _mesa_init_gl_program(&prog->Base, target, id);
    }
    case GL_TESS_EVALUATION_PROGRAM_NV: {
       struct st_tesseval_program *prog = ST_CALLOC_STRUCT(st_tesseval_program);
@@ -134,8 +134,8 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
          struct st_tessctrl_program *sttcp =
             (struct st_tessctrl_program *) prog;
 
-         st_release_basic_variants(st, sttcp->Base.Base.Target,
-                                   &sttcp->variants, &sttcp->tgsi);
+         st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,
+                                   &sttcp->tgsi);
 
          if (sttcp->glsl_to_tgsi)
             free_glsl_to_tgsi_visitor(sttcp->glsl_to_tgsi);
@@ -221,8 +221,8 @@ st_program_string_notify( struct gl_context *ctx,
       struct st_tessctrl_program *sttcp =
          (struct st_tessctrl_program *) prog;
 
-      st_release_basic_variants(st, sttcp->Base.Base.Target,
-                                &sttcp->variants, &sttcp->tgsi);
+      st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,
+                                &sttcp->tgsi);
       if (!st_translate_tessctrl_program(st, sttcp))
          return false;
 
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 91887dc..6f6e0e5 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1596,10 +1596,10 @@ st_translate_tessctrl_program(struct st_context *st,
       return false;
 
    ureg_property(ureg, TGSI_PROPERTY_TCS_VERTICES_OUT,
-                 sttcp->Base.VerticesOut);
+                 sttcp->Base.info.tcs.vertices_out);
 
-   st_translate_program_common(st, &sttcp->Base.Base, sttcp->glsl_to_tgsi,
-                               ureg, PIPE_SHADER_TESS_CTRL, &sttcp->tgsi);
+   st_translate_program_common(st, &sttcp->Base, sttcp->glsl_to_tgsi, ureg,
+                               PIPE_SHADER_TESS_CTRL, &sttcp->tgsi);
 
    free_glsl_to_tgsi_visitor(sttcp->glsl_to_tgsi);
    sttcp->glsl_to_tgsi = NULL;
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index ea55d47..b801891 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -260,11 +260,11 @@ struct st_geometry_program
 
 
 /**
- * Derived from Mesa gl_tess_ctrl_program:
+ * Derived from Mesa gl_program:
  */
 struct st_tessctrl_program
 {
-   struct gl_tess_ctrl_program Base;  /**< The Mesa tess ctrl program */
+   struct gl_program Base;  /**< The Mesa tess ctrl program */
    struct pipe_shader_state tgsi;
    struct glsl_to_tgsi_visitor* glsl_to_tgsi;
    uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
@@ -321,7 +321,7 @@ st_geometry_program( struct gl_geometry_program *gp )
 }
 
 static inline struct st_tessctrl_program *
-st_tessctrl_program( struct gl_tess_ctrl_program *tcp )
+st_tessctrl_program( struct gl_program *tcp )
 {
    return (struct st_tessctrl_program *)tcp;
 }
-- 
2.7.4



More information about the mesa-dev mailing list