<div dir="ltr"><div><div><div><div><div>I want to make a few comments on how this series is structured.  This is not the way I would have done it and I think the way you structured it makes it substantially less rebasable than it could be and a bit harder to review.  The way *I* would have done this would be something like the following:<br><br></div><div> 1) Move shader_info to common code (patches 1-2)<br></div><div> 2) Add a shader_info pointer to gl_program (patch 6), break the fill shader_info stuff from glsl_to_nir into its own function, and call it from somewhere such that it always gets filled out.<br></div> 3) Add new fields to shader_info *and* make sure they get filled out from other GLSL information<br></div> 4) Convert i965 over to the new shader_info<br></div> 5) Convert gallium over to the new shader_info<br></div> 6) Make GLSL fill out shader_info directly and nuke the old shader metadata.<br></div><div> 7) Delete the shader_info fill-out function.<br></div><div><br></div>Something along these lines would go a long way towards avoiding the "mega patch" problem where each patch touches 4 or 5 different components.  It also makes it clearer to review because you don't add fields and then the reviewer goes "Wait, where does this get set?  Oh, in another patch".  I'm not necessarily saying that you have to go back and change your patches.  It's more a suggestion for if you end up doing a v3 or another refactor along these lines in the future.<br><div><div><div><div><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 17, 2016 at 11:12 PM, Timothy Arceri <span dir="ltr"><<a href="mailto:timothy.arceri@collabora.com" target="_blank">timothy.arceri@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>context.h           |  6 ++---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>draw.c              |  2 +-<br>
 src/mesa/drivers/dri/i965/brw_<wbr>program.c           |  2 +-<br>
 src/mesa/drivers/dri/i965/brw_<wbr>tcs.c               | 32 ++++++++++-------------<br>
 src/mesa/drivers/dri/i965/brw_<wbr>tcs_surface_state.c |  2 +-<br>
 src/mesa/drivers/dri/i965/brw_<wbr>tes.c               | 20 +++++++-------<br>
 src/mesa/drivers/dri/i965/<wbr>gen7_hs_state.c         |  4 +--<br>
 src/mesa/main/context.c                           |  2 +-<br>
 src/mesa/main/mtypes.h                            | 12 +--------<br>
 src/mesa/main/shaderapi.c                         |  4 +--<br>
 src/mesa/main/state.c                             | 11 ++++----<br>
 src/mesa/program/prog_<wbr>statevars.c                 |  2 +-<br>
 src/mesa/program/program.c                        |  4 +--<br>
 src/mesa/program/program.h                        | 23 ----------------<br>
 src/mesa/state_tracker/st_<wbr>atom.c                  |  2 +-<br>
 src/mesa/state_tracker/st_<wbr>atom_constbuf.c         |  2 +-<br>
 src/mesa/state_tracker/st_<wbr>atom_sampler.c          |  2 +-<br>
 src/mesa/state_tracker/st_<wbr>atom_shader.c           |  2 +-<br>
 src/mesa/state_tracker/st_<wbr>atom_texture.c          |  2 +-<br>
 src/mesa/state_tracker/st_cb_<wbr>program.c            | 10 +++----<br>
 src/mesa/state_tracker/st_<wbr>program.c               |  6 ++---<br>
 src/mesa/state_tracker/st_<wbr>program.h               |  6 ++---<br>
 22 files changed, 58 insertions(+), 100 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_context.h b/src/mesa/drivers/dri/i965/<wbr>brw_context.h<br>
index c92bb9f..9b7e184 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_context.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_context.h<br>
@@ -337,7 +337,7 @@ struct brw_vertex_program {<br>
<br>
 /** Subclass of Mesa tessellation control program */<br>
 struct brw_tess_ctrl_program {<br>
-   struct gl_tess_ctrl_program program;<br>
+   struct gl_program program;<br>
    unsigned id;  /**< serial no. to identify tess ctrl progs, never re-used */<br>
 };<br>
<br>
@@ -1008,7 +1008,7 @@ struct brw_context<br>
     */<br>
    const struct gl_vertex_program *vertex_program;<br>
    const struct gl_geometry_program *geometry_program;<br>
-   const struct gl_tess_ctrl_program *tess_ctrl_program;<br>
+   const struct gl_program *tess_ctrl_program;<br>
    const struct gl_tess_eval_program *tess_eval_program;<br>
    const struct gl_fragment_program *fragment_program;<br>
    const struct gl_compute_program *compute_program;<br>
@@ -1730,7 +1730,7 @@ brw_vertex_program_const(const struct gl_vertex_program *p)<br>
 }<br>
<br>
 static inline struct brw_tess_ctrl_program *<br>
-brw_tess_ctrl_program(struct gl_tess_ctrl_program *p)<br>
+brw_tess_ctrl_program(struct gl_program *p)<br>
 {<br>
    return (struct brw_tess_ctrl_program *) p;<br>
 }<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_draw.c b/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
index 5d176ef..5485de3 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
@@ -458,7 +458,7 @@ brw_try_draw_prims(struct gl_context *ctx,<br>
    brw->tes.base.sampler_count = ctx->TessEvalProgram._Current ?<br>
       util_last_bit(ctx-><wbr>TessEvalProgram._Current-><wbr>Base.SamplersUsed) : 0;<br>
    brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?<br>
-      util_last_bit(ctx-><wbr>TessCtrlProgram._Current-><wbr>Base.SamplersUsed) : 0;<br>
+      util_last_bit(ctx-><wbr>TessCtrlProgram._Current-><wbr>SamplersUsed) : 0;<br>
    brw->vs.base.sampler_count =<br>
       util_last_bit(ctx-><wbr>VertexProgram._Current->Base.<wbr>SamplersUsed);<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_program.c b/src/mesa/drivers/dri/i965/<wbr>brw_program.c<br>
index a41f36e..4e0df5a 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_program.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_program.c<br>
@@ -168,7 +168,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,<br>
       if (prog) {<br>
          prog->id = get_new_program_id(brw-><wbr>screen);<br>
<br>
-         return _mesa_init_gl_program(&prog-><wbr>program.Base, target, id);<br>
+         return _mesa_init_gl_program(&prog-><wbr>program, target, id);<br>
       } else {<br>
          return NULL;<br>
       }<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c b/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c<br>
index 0f03fab..08cf413 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c<br>
@@ -178,7 +178,7 @@ brw_codegen_tcs_prog(struct brw_context *brw,<br>
    double start_time = 0;<br>
<br>
    if (tcp) {<br>
-      nir = tcp->program.Base.nir;<br>
+      nir = tcp->program.nir;<br>
    } else {<br>
       /* Create a dummy nir_shader.  We won't actually use NIR code to<br>
        * generate assembly (it's easier to generate assembly directly),<br>
@@ -211,14 +211,14 @@ brw_codegen_tcs_prog(struct brw_context *brw,<br>
<br>
    if (tcs) {<br>
       brw_assign_common_binding_<wbr>table_offsets(MESA_SHADER_<wbr>TESS_CTRL, devinfo,<br>
-                                              shader_prog, &tcp->program.Base,<br>
+                                              shader_prog, &tcp->program,<br>
                                               &prog_data.base.base, 0);<br>
<br>
       prog_data.base.base.image_<wbr>param =<br>
          rzalloc_array(NULL, struct brw_image_param, tcs->NumImages);<br>
       prog_data.base.base.nr_image_<wbr>params = tcs->NumImages;<br>
<br>
-      brw_nir_setup_glsl_uniforms(<wbr>nir, shader_prog, &tcp->program.Base,<br>
+      brw_nir_setup_glsl_uniforms(<wbr>nir, shader_prog, &tcp->program,<br>
                                   &prog_data.base.base,<br>
                                   compiler->scalar_stage[MESA_<wbr>SHADER_TESS_CTRL]);<br>
    } else {<br>
@@ -316,24 +316,21 @@ void<br>
 brw_tcs_populate_key(struct brw_context *brw,<br>
                      struct brw_tcs_prog_key *key)<br>
 {<br>
-   uint64_t per_vertex_slots =<br>
-      brw->tess_eval_program->Base.<wbr>nir->info->inputs_read;<br>
-   uint32_t per_patch_slots =<br>
-      brw->tess_eval_program->Base.<wbr>nir->info->patch_inputs_read;<br>
-<br>
    struct brw_tess_ctrl_program *tcp =<br>
       (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;<br>
    struct brw_tess_eval_program *tep =<br>
       (struct brw_tess_eval_program *) brw->tess_eval_program;<br>
-   struct gl_program *prog = &tcp->program.Base;<br>
+   struct gl_program *tes_prog = &tep->program;<br>
+<br>
+   uint64_t per_vertex_slots = tes_prog->info.inputs_read;<br>
+   uint32_t per_patch_slots = tes_prog->info.patch_inputs_<wbr>read;<br>
<br>
    memset(key, 0, sizeof(*key));<br>
<br>
-   if (brw->tess_ctrl_program) {<br>
-      per_vertex_slots |=<br>
-         brw->tess_ctrl_program->Base.<wbr>nir->info->outputs_written;<br>
-      per_patch_slots |=<br>
-         brw->tess_ctrl_program->Base.<wbr>nir->info->patch_outputs_<wbr>written;<br>
+   if (tcp) {<br>
+      struct gl_program *prog = &tcp->program;<br>
+      per_vertex_slots |= prog->info.outputs_written;<br>
+      per_patch_slots |= prog->info.patch_outputs_<wbr>written;<br>
    }<br>
<br>
    if (brw->gen < 8 || !tcp)<br>
@@ -353,9 +350,9 @@ brw_tcs_populate_key(struct brw_context *brw,<br>
       key->program_string_id = tcp->id;<br>
<br>
       /* _NEW_TEXTURE */<br>
-      brw_populate_sampler_prog_key_<wbr>data(&brw->ctx, prog, &key->tex);<br>
+      brw_populate_sampler_prog_key_<wbr>data(&brw->ctx, &tcp->program, &key->tex);<br>
    } else {<br>
-      key->outputs_written = tep->program.Base.nir->info-><wbr>inputs_read;<br>
+      key->outputs_written = tes_prog->info.inputs_read;<br>
    }<br>
 }<br>
<br>
@@ -403,8 +400,7 @@ brw_tcs_precompile(struct gl_context *ctx,<br>
    struct brw_stage_prog_data *old_prog_data = brw->tcs.base.prog_data;<br>
    bool success;<br>
<br>
-   struct gl_tess_ctrl_program *tcp = (struct gl_tess_ctrl_program *)prog;<br>
-   struct brw_tess_ctrl_program *btcp = brw_tess_ctrl_program(tcp);<br>
+   struct brw_tess_ctrl_program *btcp = brw_tess_ctrl_program(prog);<br>
    const struct gl_linked_shader *tes =<br>
       shader_prog->_LinkedShaders[<wbr>MESA_SHADER_TESS_EVAL];<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/<wbr>brw_tcs_surface_state.c<br>
index 5021e10..e91488f 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_tcs_surface_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_tcs_surface_state.c<br>
@@ -52,7 +52,7 @@ brw_upload_tcs_pull_constants(<wbr>struct brw_context *brw)<br>
<br>
    _mesa_shader_write_subroutine_<wbr>indices(&brw->ctx, MESA_SHADER_TESS_CTRL);<br>
    /* _NEW_PROGRAM_CONSTANTS */<br>
-   brw_upload_pull_constants(brw, BRW_NEW_TCS_CONSTBUF, &tcp->program.Base,<br>
+   brw_upload_pull_constants(brw, BRW_NEW_TCS_CONSTBUF, &tcp->program,<br>
                              stage_state, prog_data);<br>
 }<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_tes.c b/src/mesa/drivers/dri/i965/<wbr>brw_tes.c<br>
index 59e4d50..fe03816 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_tes.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_tes.c<br>
@@ -233,16 +233,15 @@ void<br>
 brw_tes_populate_key(struct brw_context *brw,<br>
                      struct brw_tes_prog_key *key)<br>
 {<br>
-<br>
-   uint64_t per_vertex_slots =<br>
-      brw->tess_eval_program->Base.<wbr>nir->info->inputs_read;<br>
-   uint32_t per_patch_slots =<br>
-      brw->tess_eval_program->Base.<wbr>nir->info->patch_inputs_read;<br>
-<br>
+   struct brw_tess_ctrl_program *tcp =<br>
+      (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;<br>
    struct brw_tess_eval_program *tep =<br>
       (struct brw_tess_eval_program *) brw->tess_eval_program;<br>
    struct gl_program *prog = &tep->program.Base;<br>
<br>
+   uint64_t per_vertex_slots = prog->info.inputs_read;<br>
+   uint32_t per_patch_slots = prog->info.patch_inputs_read;<br>
+<br>
    memset(key, 0, sizeof(*key));<br>
<br>
    key->program_string_id = tep->id;<br>
@@ -251,11 +250,10 @@ brw_tes_populate_key(struct brw_context *brw,<br>
     * TES (possibly for cross-thread communication).  These need to<br>
     * be stored in the Patch URB Entry as well.<br>
     */<br>
-   if (brw->tess_ctrl_program) {<br>
-      per_vertex_slots |=<br>
-         brw->tess_ctrl_program->Base.<wbr>nir->info->outputs_written;<br>
-      per_patch_slots |=<br>
-         brw->tess_ctrl_program->Base.<wbr>nir->info->patch_outputs_<wbr>written;<br>
+   if (tcp) {<br>
+      struct gl_program *tcp_prog = &tcp->program;<br>
+      per_vertex_slots |= tcp_prog->info.outputs_<wbr>written;<br>
+      per_patch_slots |= tcp_prog->info.patch_outputs_<wbr>written;<br>
    }<br>
<br>
    /* Ignore gl_TessLevelInner/Outer - we treat them as system values,<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>gen7_hs_state.c b/src/mesa/drivers/dri/i965/<wbr>gen7_hs_state.c<br>
index f16af28..290aea2 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>gen7_hs_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>gen7_hs_state.c<br>
@@ -41,8 +41,8 @@ gen7_upload_tcs_push_<wbr>constants(struct brw_context *brw)<br>
       const struct brw_stage_prog_data *prog_data = brw->tcs.base.prog_data;<br>
<br>
       _mesa_shader_write_subroutine_<wbr>indices(&brw->ctx, MESA_SHADER_TESS_CTRL);<br>
-      gen6_upload_push_constants(<wbr>brw, &tcp->program.Base, prog_data,<br>
-                                      stage_state, AUB_TRACE_VS_CONSTANTS);<br>
+      gen6_upload_push_constants(<wbr>brw, &tcp->program, prog_data, stage_state,<br>
+                                 AUB_TRACE_VS_CONSTANTS);<br>
    }<br>
<br>
    gen7_upload_constant_state(<wbr>brw, stage_state, active, _3DSTATE_CONSTANT_HS);<br>
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c<br>
index 47fd4a0..1e4f87d 100644<br>
--- a/src/mesa/main/context.c<br>
+++ b/src/mesa/main/context.c<br>
@@ -1297,7 +1297,7 @@ _mesa_free_context_data( struct gl_context *ctx )<br>
    _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);<br>
    _mesa_reference_vertprog(ctx, &ctx->VertexProgram._<wbr>TnlProgram, NULL);<br>
<br>
-   _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._<wbr>Current, NULL);<br>
+   _mesa_reference_program(ctx, &ctx->TessCtrlProgram._<wbr>Current, NULL);<br>
    _mesa_reference_tesseprog(ctx, &ctx->TessEvalProgram._<wbr>Current, NULL);<br>
    _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._<wbr>Current, NULL);<br>
<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index 3a517f2..9191130 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -1998,16 +1998,6 @@ struct gl_vertex_program<br>
 };<br>
<br>
<br>
-/** Tessellation control program object */<br>
-struct gl_tess_ctrl_program<br>
-{<br>
-   struct gl_program Base;   /**< base class */<br>
-<br>
-   /* output layout */<br>
-   GLint VerticesOut;<br>
-};<br>
-<br>
-<br>
 /** Tessellation evaluation program object */<br>
 struct gl_tess_eval_program<br>
 {<br>
@@ -2138,7 +2128,7 @@ struct gl_vertex_program_state<br>
 struct gl_tess_ctrl_program_state<br>
 {<br>
    /** Currently bound and valid shader. */<br>
-   struct gl_tess_ctrl_program *_Current;<br>
+   struct gl_program *_Current;<br>
<br>
    GLint patch_vertices;<br>
    GLfloat patch_default_outer_level[4];<br>
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c<br>
index c40bb2d..531f8fa 100644<br>
--- a/src/mesa/main/shaderapi.c<br>
+++ b/src/mesa/main/shaderapi.c<br>
@@ -2165,9 +2165,7 @@ _mesa_copy_linked_program_<wbr>data(gl_shader_stage type,<br>
       dst->CullDistanceArraySize = src->Vert.<wbr>CullDistanceArraySize;<br>
       break;<br>
    case MESA_SHADER_TESS_CTRL: {<br>
-      struct gl_tess_ctrl_program *dst_tcp =<br>
-         (struct gl_tess_ctrl_program *) dst;<br>
-      dst_tcp->VerticesOut = src->_LinkedShaders[MESA_<wbr>SHADER_TESS_CTRL]-><br>
+      dst->info.tcs.vertices_out = src->_LinkedShaders[MESA_<wbr>SHADER_TESS_CTRL]-><br>
          info.TessCtrl.VerticesOut;<br>
       break;<br>
    }<br>
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c<br>
index bf6035e..b520761 100644<br>
--- a/src/mesa/main/state.c<br>
+++ b/src/mesa/main/state.c<br>
@@ -110,7 +110,7 @@ update_program(struct gl_context *ctx)<br>
    const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;<br>
    const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;<br>
    const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current;<br>
-   const struct gl_tess_ctrl_program *prevTCP = ctx->TessCtrlProgram._Current;<br>
+   const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;<br>
    const struct gl_tess_eval_program *prevTEP = ctx->TessEvalProgram._Current;<br>
    const struct gl_compute_program *prevCP = ctx->ComputeProgram._Current;<br>
    GLbitfield new_state = 0x0;<br>
@@ -208,13 +208,12 @@ update_program(struct gl_context *ctx)<br>
    if (tcsProg && tcsProg->LinkStatus<br>
        && tcsProg->_LinkedShaders[MESA_<wbr>SHADER_TESS_CTRL]) {<br>
       /* Use GLSL tessellation control shader */<br>
-      _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._<wbr>Current,<br>
-         gl_tess_ctrl_program(<br>
-            tcsProg->_LinkedShaders[MESA_<wbr>SHADER_TESS_CTRL]->Program));<br>
+      _mesa_reference_program(ctx, &ctx->TessCtrlProgram._<wbr>Current,<br>
+          tcsProg->_LinkedShaders[MESA_<wbr>SHADER_TESS_CTRL]->Program);<br>
    }<br>
    else {<br>
       /* No tessellation control program */<br>
-      _mesa_reference_tesscprog(ctx, &ctx->TessCtrlProgram._<wbr>Current, NULL);<br>
+      _mesa_reference_program(ctx, &ctx->TessCtrlProgram._<wbr>Current, NULL);<br>
    }<br>
<br>
    /* Examine vertex program after fragment program as<br>
@@ -284,7 +283,7 @@ update_program(struct gl_context *ctx)<br>
       new_state |= _NEW_PROGRAM;<br>
       if (ctx->Driver.BindProgram) {<br>
          ctx->Driver.BindProgram(ctx, GL_TESS_CONTROL_PROGRAM_NV,<br>
-                            (struct gl_program *) ctx->TessCtrlProgram._Current)<wbr>;<br>
+                                 ctx->TessCtrlProgram._Current)<wbr>;<br>
       }<br>
    }<br>
<br>
diff --git a/src/mesa/program/prog_<wbr>statevars.c b/src/mesa/program/prog_<wbr>statevars.c<br>
index 6e6007e..2ac7b56 100644<br>
--- a/src/mesa/program/prog_<wbr>statevars.c<br>
+++ b/src/mesa/program/prog_<wbr>statevars.c<br>
@@ -604,7 +604,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],<br>
<br>
       case STATE_TES_PATCH_VERTICES_IN:<br>
          if (ctx->TessCtrlProgram._<wbr>Current)<br>
-            val[0].i = ctx->TessCtrlProgram._Current-<wbr>>VerticesOut;<br>
+            val[0].i = ctx->TessCtrlProgram._Current-<wbr>>info.tcs.vertices_out;<br>
          else<br>
             val[0].i = ctx->TessCtrlProgram.patch_<wbr>vertices;<br>
          return;<br>
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c<br>
index 6767216..f89a833 100644<br>
--- a/src/mesa/program/program.c<br>
+++ b/src/mesa/program/program.c<br>
@@ -228,8 +228,8 @@ _mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)<br>
       return _mesa_init_gl_program(&prog-><wbr>Base, target, id);<br>
    }<br>
    case GL_TESS_CONTROL_PROGRAM_NV: {<br>
-      struct gl_tess_ctrl_program *prog = CALLOC_STRUCT(gl_tess_ctrl_<wbr>program);<br>
-      return _mesa_init_gl_program(&prog-><wbr>Base, target, id);<br>
+      struct gl_program *prog = CALLOC_STRUCT(gl_program);<br>
+      return _mesa_init_gl_program(prog, target, id);<br>
    }<br>
    case GL_TESS_EVALUATION_PROGRAM_NV: {<br>
       struct gl_tess_eval_program *prog = CALLOC_STRUCT(gl_tess_eval_<wbr>program);<br>
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h<br>
index 09e6928..d937f82 100644<br>
--- a/src/mesa/program/program.h<br>
+++ b/src/mesa/program/program.h<br>
@@ -125,16 +125,6 @@ _mesa_reference_compprog(<wbr>struct gl_context *ctx,<br>
                            (struct gl_program *) prog);<br>
 }<br>
<br>
-<br>
-static inline void<br>
-_mesa_reference_tesscprog(<wbr>struct gl_context *ctx,<br>
-                         struct gl_tess_ctrl_program **ptr,<br>
-                         struct gl_tess_ctrl_program *prog)<br>
-{<br>
-   _mesa_reference_program(ctx, (struct gl_program **) ptr,<br>
-                           (struct gl_program *) prog);<br>
-}<br>
-<br>
 static inline void<br>
 _mesa_reference_tesseprog(<wbr>struct gl_context *ctx,<br>
                          struct gl_tess_eval_program **ptr,<br>
@@ -267,19 +257,6 @@ gl_compute_program_const(const struct gl_program *prog)<br>
    return (const struct gl_compute_program *) prog;<br>
 }<br>
<br>
-static inline struct gl_tess_ctrl_program *<br>
-gl_tess_ctrl_program(struct gl_program *prog)<br>
-{<br>
-   return (struct gl_tess_ctrl_program *) prog;<br>
-}<br>
-<br>
-static inline const struct gl_tess_ctrl_program *<br>
-gl_tess_ctrl_program_const(<wbr>const struct gl_program *prog)<br>
-{<br>
-   return (const struct gl_tess_ctrl_program *) prog;<br>
-}<br>
-<br>
-<br>
 static inline struct gl_tess_eval_program *<br>
 gl_tess_eval_program(struct gl_program *prog)<br>
 {<br>
diff --git a/src/mesa/state_tracker/st_<wbr>atom.c b/src/mesa/state_tracker/st_<wbr>atom.c<br>
index 94e012a..497ba82 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>atom.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>atom.c<br>
@@ -70,7 +70,7 @@ static void check_program_state( struct st_context *st )<br>
    struct st_fragment_program *old_fp = st->fp;<br>
<br>
    struct gl_vertex_program *new_vp = ctx->VertexProgram._Current;<br>
-   struct gl_tess_ctrl_program *new_tcp = ctx->TessCtrlProgram._Current;<br>
+   struct gl_program *new_tcp = ctx->TessCtrlProgram._Current;<br>
    struct gl_tess_eval_program *new_tep = ctx->TessEvalProgram._Current;<br>
    struct gl_geometry_program *new_gp = ctx->GeometryProgram._Current;<br>
    struct gl_fragment_program *new_fp = ctx->FragmentProgram._Current;<br>
diff --git a/src/mesa/state_tracker/st_<wbr>atom_constbuf.c b/src/mesa/state_tracker/st_<wbr>atom_constbuf.c<br>
index 8882582..90d4ffb 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>atom_constbuf.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>atom_constbuf.c<br>
@@ -195,7 +195,7 @@ static void update_tcs_constants(struct st_context *st )<br>
    struct gl_program_parameter_list *params;<br>
<br>
    if (tcp) {<br>
-      params = tcp->Base.Base.Parameters;<br>
+      params = tcp->Base.Parameters;<br>
       st_upload_constants( st, params, MESA_SHADER_TESS_CTRL );<br>
    }<br>
 }<br>
diff --git a/src/mesa/state_tracker/st_<wbr>atom_sampler.c b/src/mesa/state_tracker/st_<wbr>atom_sampler.c<br>
index 065df6d..76b355c 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>atom_sampler.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>atom_sampler.c<br>
@@ -344,7 +344,7 @@ update_samplers(struct st_context *st)<br>
    if (ctx->TessCtrlProgram._<wbr>Current) {<br>
       update_shader_samplers(st,<br>
                              PIPE_SHADER_TESS_CTRL,<br>
-                             &ctx->TessCtrlProgram._<wbr>Current->Base,<br>
+                             ctx->TessCtrlProgram._Current,<br>
                              ctx->Const.Program[MESA_<wbr>SHADER_TESS_CTRL].<wbr>MaxTextureImageUnits,<br>
                              st->state.samplers[PIPE_<wbr>SHADER_TESS_CTRL],<br>
                              &st->state.num_samplers[PIPE_<wbr>SHADER_TESS_CTRL]);<br>
diff --git a/src/mesa/state_tracker/st_<wbr>atom_shader.c b/src/mesa/state_tracker/st_<wbr>atom_shader.c<br>
index 2f700a2..0df0770 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>atom_shader.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>atom_shader.c<br>
@@ -254,7 +254,7 @@ update_tcp( struct st_context *st )<br>
    }<br>
<br>
    sttcp = st_tessctrl_program(st->ctx-><wbr>TessCtrlProgram._Current);<br>
-   assert(sttcp->Base.Base.Target == GL_TESS_CONTROL_PROGRAM_NV);<br>
+   assert(sttcp->Base.Target == GL_TESS_CONTROL_PROGRAM_NV);<br>
<br>
    st->tcp_variant = st_get_basic_variant(st, PIPE_SHADER_TESS_CTRL,<br>
                                           &sttcp->tgsi, &sttcp->variants);<br>
diff --git a/src/mesa/state_tracker/st_<wbr>atom_texture.c b/src/mesa/state_tracker/st_<wbr>atom_texture.c<br>
index c8ae62c..fbd73d6 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>atom_texture.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>atom_texture.c<br>
@@ -253,7 +253,7 @@ update_tessctrl_textures(<wbr>struct st_context *st)<br>
    if (ctx->TessCtrlProgram._<wbr>Current) {<br>
       update_textures(st,<br>
                       MESA_SHADER_TESS_CTRL,<br>
-                      &ctx->TessCtrlProgram._<wbr>Current->Base,<br>
+                      ctx->TessCtrlProgram._Current,<br>
                       ctx->Const.Program[MESA_<wbr>SHADER_TESS_CTRL].<wbr>MaxTextureImageUnits,<br>
                       st->state.sampler_views[PIPE_<wbr>SHADER_TESS_CTRL],<br>
                       &st->state.num_sampler_views[<wbr>PIPE_SHADER_TESS_CTRL]);<br>
diff --git a/src/mesa/state_tracker/st_<wbr>cb_program.c b/src/mesa/state_tracker/st_<wbr>cb_program.c<br>
index 1fd5019..c85f0ef 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>cb_program.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>cb_program.c<br>
@@ -71,7 +71,7 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id)<br>
    }<br>
    case GL_TESS_CONTROL_PROGRAM_NV: {<br>
       struct st_tessctrl_program *prog = ST_CALLOC_STRUCT(st_tessctrl_<wbr>program);<br>
-      return _mesa_init_gl_program(&prog-><wbr>Base.Base, target, id);<br>
+      return _mesa_init_gl_program(&prog-><wbr>Base, target, id);<br>
    }<br>
    case GL_TESS_EVALUATION_PROGRAM_NV: {<br>
       struct st_tesseval_program *prog = ST_CALLOC_STRUCT(st_tesseval_<wbr>program);<br>
@@ -134,8 +134,8 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)<br>
          struct st_tessctrl_program *sttcp =<br>
             (struct st_tessctrl_program *) prog;<br>
<br>
-         st_release_basic_variants(st, sttcp->Base.Base.Target,<br>
-                                   &sttcp->variants, &sttcp->tgsi);<br>
+         st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,<br>
+                                   &sttcp->tgsi);<br>
<br>
          if (sttcp->glsl_to_tgsi)<br>
             free_glsl_to_tgsi_visitor(<wbr>sttcp->glsl_to_tgsi);<br>
@@ -221,8 +221,8 @@ st_program_string_notify( struct gl_context *ctx,<br>
       struct st_tessctrl_program *sttcp =<br>
          (struct st_tessctrl_program *) prog;<br>
<br>
-      st_release_basic_variants(st, sttcp->Base.Base.Target,<br>
-                                &sttcp->variants, &sttcp->tgsi);<br>
+      st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,<br>
+                                &sttcp->tgsi);<br>
       if (!st_translate_tessctrl_<wbr>program(st, sttcp))<br>
          return false;<br>
<br>
diff --git a/src/mesa/state_tracker/st_<wbr>program.c b/src/mesa/state_tracker/st_<wbr>program.c<br>
index 7cc36b4..cb40211 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>program.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>program.c<br>
@@ -1605,10 +1605,10 @@ st_translate_tessctrl_program(<wbr>struct st_context *st,<br>
       return false;<br>
<br>
    ureg_property(ureg, TGSI_PROPERTY_TCS_VERTICES_<wbr>OUT,<br>
-                 sttcp->Base.VerticesOut);<br>
+                 sttcp->Base.info.tcs.vertices_<wbr>out);<br>
<br>
-   st_translate_program_common(<wbr>st, &sttcp->Base.Base, sttcp->glsl_to_tgsi,<br>
-                               ureg, PIPE_SHADER_TESS_CTRL, &sttcp->tgsi);<br>
+   st_translate_program_common(<wbr>st, &sttcp->Base, sttcp->glsl_to_tgsi, ureg,<br>
+                               PIPE_SHADER_TESS_CTRL, &sttcp->tgsi);<br>
<br>
    free_glsl_to_tgsi_visitor(<wbr>sttcp->glsl_to_tgsi);<br>
    sttcp->glsl_to_tgsi = NULL;<br>
diff --git a/src/mesa/state_tracker/st_<wbr>program.h b/src/mesa/state_tracker/st_<wbr>program.h<br>
index ea55d47..b801891 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>program.h<br>
+++ b/src/mesa/state_tracker/st_<wbr>program.h<br>
@@ -260,11 +260,11 @@ struct st_geometry_program<br>
<br>
<br>
 /**<br>
- * Derived from Mesa gl_tess_ctrl_program:<br>
+ * Derived from Mesa gl_program:<br>
  */<br>
 struct st_tessctrl_program<br>
 {<br>
-   struct gl_tess_ctrl_program Base;  /**< The Mesa tess ctrl program */<br>
+   struct gl_program Base;  /**< The Mesa tess ctrl program */<br>
    struct pipe_shader_state tgsi;<br>
    struct glsl_to_tgsi_visitor* glsl_to_tgsi;<br>
    uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */<br>
@@ -321,7 +321,7 @@ st_geometry_program( struct gl_geometry_program *gp )<br>
 }<br>
<br>
 static inline struct st_tessctrl_program *<br>
-st_tessctrl_program( struct gl_tess_ctrl_program *tcp )<br>
+st_tessctrl_program( struct gl_program *tcp )<br>
 {<br>
    return (struct st_tessctrl_program *)tcp;<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div></div></div></div></div></div></div></div></div>