[Mesa-dev] [PATCH 11/25] mesa/i965/i915/r200: eliminate gl_vertex_program

Ian Romanick idr at freedesktop.org
Tue Oct 18 19:07:15 UTC 2016


I'd like to see two tiny changes:

1. A comment for the IsPositionInvariant field that it can only be true
for vertex programs.

2. An assertion or two like

    assert(p->Target == GL_VERTEX_PROGRAM_ARB ||
           !p->IsPositionInvariant);

   in reasonable places.  I'm thinking:

   - Where it's assigned in src/mesa/program/arbprogparse.c

   - Where it's used in src/mesa/state_tracker/st_program.c,
     src/mesa/drivers/dri/i965/brw_program.c, and
     src/mesa/tnl/t_vb_program.c (both places).

I'd also support a follow-up patch that converts IsPositionInvariant
from GLboolean to bool. :)

On 10/17/2016 11:12 PM, Timothy Arceri wrote:
> Here we move the only field in gl_vertex_program to the
> ARB program fields in gl_program.
> ---
>  src/mesa/drivers/common/meta.c                   | 10 +--
>  src/mesa/drivers/common/meta.h                   |  2 +-
>  src/mesa/drivers/dri/i915/i915_fragprog.c        |  4 +-
>  src/mesa/drivers/dri/i965/brw_context.h          |  8 +--
>  src/mesa/drivers/dri/i965/brw_curbe.c            |  2 +-
>  src/mesa/drivers/dri/i965/brw_draw.c             |  4 +-
>  src/mesa/drivers/dri/i965/brw_program.c          |  5 +-
>  src/mesa/drivers/dri/i965/brw_vs.c               | 41 ++++++------
>  src/mesa/drivers/dri/i965/brw_vs_surface_state.c |  2 +-
>  src/mesa/drivers/dri/i965/gen6_vs_state.c        |  4 +-
>  src/mesa/drivers/dri/r200/r200_context.h         |  2 +-
>  src/mesa/drivers/dri/r200/r200_state_init.c      |  4 +-
>  src/mesa/drivers/dri/r200/r200_tcl.c             |  2 +-
>  src/mesa/drivers/dri/r200/r200_vertprog.c        | 82 ++++++++++++------------
>  src/mesa/main/arbprogram.c                       | 19 +++---
>  src/mesa/main/context.c                          |  8 +--
>  src/mesa/main/ff_fragment_shader.cpp             |  2 +-
>  src/mesa/main/ffvertex_prog.c                    | 72 ++++++++++-----------
>  src/mesa/main/ffvertex_prog.h                    |  2 +-
>  src/mesa/main/mtypes.h                           | 17 ++---
>  src/mesa/main/shared.c                           |  5 +-
>  src/mesa/main/state.c                            | 26 ++++----
>  src/mesa/main/state.h                            |  2 +-
>  src/mesa/program/arbprogparse.c                  | 46 ++++++-------
>  src/mesa/program/arbprogparse.h                  |  2 +-
>  src/mesa/program/prog_statevars.c                |  8 +--
>  src/mesa/program/program.c                       | 15 ++---
>  src/mesa/program/program.h                       | 26 --------
>  src/mesa/program/programopt.c                    | 42 ++++++------
>  src/mesa/program/programopt.h                    |  2 +-
>  src/mesa/state_tracker/st_atom.c                 |  4 +-
>  src/mesa/state_tracker/st_atom_constbuf.c        |  2 +-
>  src/mesa/state_tracker/st_atom_rasterizer.c      |  8 +--
>  src/mesa/state_tracker/st_atom_sampler.c         |  2 +-
>  src/mesa/state_tracker/st_atom_shader.c          |  4 +-
>  src/mesa/state_tracker/st_atom_texture.c         |  2 +-
>  src/mesa/state_tracker/st_cb_feedback.c          |  2 +-
>  src/mesa/state_tracker/st_cb_program.c           |  2 +-
>  src/mesa/state_tracker/st_debug.c                |  4 +-
>  src/mesa/state_tracker/st_program.c              | 35 +++++-----
>  src/mesa/state_tracker/st_program.h              |  4 +-
>  src/mesa/tnl/t_context.c                         |  4 +-
>  src/mesa/tnl/t_vb_program.c                      | 24 +++----
>  src/mesa/tnl/t_vp_build.c                        |  4 +-
>  src/mesa/vbo/vbo_exec_draw.c                     |  4 +-
>  src/mesa/vbo/vbo_save_draw.c                     |  4 +-
>  46 files changed, 264 insertions(+), 311 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 890e98a..ab81eed 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -566,8 +566,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
>  
>        if (ctx->Extensions.ARB_vertex_program) {
>           save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
> -         _mesa_reference_vertprog(ctx, &save->VertexProgram,
> -				  ctx->VertexProgram.Current);
> +         _mesa_reference_program(ctx, &save->VertexProgram,
> +				 ctx->VertexProgram.Current);
>           _mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
>        }
>  
> @@ -945,9 +945,9 @@ _mesa_meta_end(struct gl_context *ctx)
>        if (ctx->Extensions.ARB_vertex_program) {
>           _mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB,
>                            save->VertexProgramEnabled);
> -         _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, 
> -                                  save->VertexProgram);
> -	 _mesa_reference_vertprog(ctx, &save->VertexProgram, NULL);
> +         _mesa_reference_program(ctx, &ctx->VertexProgram.Current,
> +                                 save->VertexProgram);
> +	 _mesa_reference_program(ctx, &save->VertexProgram, NULL);
>        }
>  
>        if (ctx->Extensions.ARB_fragment_program) {
> diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
> index ba83a6d..4d3b8ec 100644
> --- a/src/mesa/drivers/common/meta.h
> +++ b/src/mesa/drivers/common/meta.h
> @@ -121,7 +121,7 @@ struct save_state
>  
>     /** MESA_META_SHADER */
>     GLboolean VertexProgramEnabled;
> -   struct gl_vertex_program *VertexProgram;
> +   struct gl_program *VertexProgram;
>     GLboolean FragmentProgramEnabled;
>     struct gl_fragment_program *FragmentProgram;
>     GLboolean ATIFragmentShaderEnabled;
> diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
> index 1944b3d..4e1df73 100644
> --- a/src/mesa/drivers/dri/i915/i915_fragprog.c
> +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
> @@ -1148,8 +1148,8 @@ i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
>  {
>     switch (target) {
>     case GL_VERTEX_PROGRAM_ARB: {
> -      struct gl_vertex_program *prog = CALLOC_STRUCT(gl_vertex_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_FRAGMENT_PROGRAM_ARB:{
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index 5e68c50..c1d6e08 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -330,7 +330,7 @@ struct brw_state_flags {
>  
>  /** Subclass of Mesa vertex program */
>  struct brw_vertex_program {
> -   struct gl_vertex_program program;
> +   struct gl_program program;
>     GLuint id;
>  };
>  
> @@ -1006,7 +1006,7 @@ struct brw_context
>  
>     /* Active vertex program:
>      */
> -   const struct gl_vertex_program *vertex_program;
> +   const struct gl_program *vertex_program;
>     const struct gl_program *geometry_program;
>     const struct gl_program *tess_ctrl_program;
>     const struct gl_program *tess_eval_program;
> @@ -1718,13 +1718,13 @@ brw_context( struct gl_context *ctx )
>  }
>  
>  static inline struct brw_vertex_program *
> -brw_vertex_program(struct gl_vertex_program *p)
> +brw_vertex_program(struct gl_program *p)
>  {
>     return (struct brw_vertex_program *) p;
>  }
>  
>  static inline const struct brw_vertex_program *
> -brw_vertex_program_const(const struct gl_vertex_program *p)
> +brw_vertex_program_const(const struct gl_program *p)
>  {
>     return (const struct brw_vertex_program *) p;
>  }
> diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
> index e88f4bb..f3f5a80 100644
> --- a/src/mesa/drivers/dri/i965/brw_curbe.c
> +++ b/src/mesa/drivers/dri/i965/brw_curbe.c
> @@ -256,7 +256,7 @@ brw_upload_constant_buffer(struct brw_context *brw)
>  
>     /* vertex shader constants */
>     if (brw->curbe.vs_size) {
> -      _mesa_load_state_parameters(ctx, brw->vertex_program->Base.Parameters);
> +      _mesa_load_state_parameters(ctx, brw->vertex_program->Parameters);
>  
>        GLuint offset = brw->curbe.vs_start * 16;
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> index a2e0442..a979128 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -302,7 +302,7 @@ brw_merge_inputs(struct brw_context *brw,
>     }
>  
>     if (brw->gen < 8 && !brw->is_haswell) {
> -      uint64_t mask = ctx->VertexProgram._Current->Base.nir->info->inputs_read;
> +      uint64_t mask = ctx->VertexProgram._Current->info.inputs_read;
>        /* Prior to Haswell, the hardware can't natively support GL_FIXED or
>         * 2_10_10_10_REV vertex formats.  Set appropriate workaround flags.
>         */
> @@ -460,7 +460,7 @@ brw_try_draw_prims(struct gl_context *ctx,
>     brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?
>        util_last_bit(ctx->TessCtrlProgram._Current->SamplersUsed) : 0;
>     brw->vs.base.sampler_count =
> -      util_last_bit(ctx->VertexProgram._Current->Base.SamplersUsed);
> +      util_last_bit(ctx->VertexProgram._Current->SamplersUsed);
>  
>     intel_prepare_render(brw);
>     brw_predraw_set_aux_buffers(brw);
> diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
> index 8c0c936..9b31270 100644
> --- a/src/mesa/drivers/dri/i965/brw_program.c
> +++ b/src/mesa/drivers/dri/i965/brw_program.c
> @@ -135,7 +135,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;
> @@ -235,8 +235,7 @@ brwProgramStringNotify(struct gl_context *ctx,
>        break;
>     }
>     case GL_VERTEX_PROGRAM_ARB: {
> -      struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
> -      struct brw_vertex_program *newVP = brw_vertex_program(vprog);
> +      struct brw_vertex_program *newVP = brw_vertex_program(prog);
>        const struct brw_vertex_program *curVP =
>           brw_vertex_program_const(brw->vertex_program);
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
> index f24a2ee..5d1c8e0 100644
> --- a/src/mesa/drivers/dri/i965/brw_vs.c
> +++ b/src/mesa/drivers/dri/i965/brw_vs.c
> @@ -112,16 +112,15 @@ brw_codegen_vs_prog(struct brw_context *brw,
>  
>     mem_ctx = ralloc_context(NULL);
>  
> -   brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX,
> -                                           devinfo,
> -                                           prog, &vp->program.Base,
> -                                           &prog_data.base.base, 0);
> +   brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX, devinfo, prog,
> +                                           &vp->program, &prog_data.base.base,
> +                                           0);
>  
>     /* Allocate the references to the uniforms that will end up in the
>      * prog_data associated with the compiled program, and which will be freed
>      * by the state cache.
>      */
> -   int param_count = vp->program.Base.nir->num_uniforms / 4;
> +   int param_count = vp->program.nir->num_uniforms / 4;
>  
>     if (vs)
>        prog_data.base.base.nr_image_params = vs->base.NumImages;
> @@ -141,26 +140,25 @@ brw_codegen_vs_prog(struct brw_context *brw,
>     stage_prog_data->nr_params = param_count;
>  
>     if (prog) {
> -      brw_nir_setup_glsl_uniforms(vp->program.Base.nir, prog, &vp->program.Base,
> +      brw_nir_setup_glsl_uniforms(vp->program.nir, prog, &vp->program,
>                                    &prog_data.base.base,
>                                    compiler->scalar_stage[MESA_SHADER_VERTEX]);
>     } else {
> -      brw_nir_setup_arb_uniforms(vp->program.Base.nir, &vp->program.Base,
> +      brw_nir_setup_arb_uniforms(vp->program.nir, &vp->program,
>                                   &prog_data.base.base);
>     }
>  
>     uint64_t outputs_written =
> -      brw_vs_outputs_written(brw, key,
> -                             vp->program.Base.nir->info->outputs_written);
> -   prog_data.inputs_read = vp->program.Base.nir->info->inputs_read;
> +      brw_vs_outputs_written(brw, key, vp->program.info.outputs_written);
> +   prog_data.inputs_read = vp->program.info.inputs_read;
>  
>     if (key->copy_edgeflag) {
>        prog_data.inputs_read |= VERT_BIT_EDGEFLAG;
>     }
>  
>     prog_data.base.cull_distance_mask =
> -      ((1 << vp->program.Base.CullDistanceArraySize) - 1) <<
> -      vp->program.Base.ClipDistanceArraySize;
> +      ((1 << vp->program.CullDistanceArraySize) - 1) <<
> +      vp->program.ClipDistanceArraySize;
>  
>     brw_compute_vue_map(devinfo,
>                         &prog_data.base.vue_map, outputs_written,
> @@ -169,8 +167,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
>                              : false);
>  
>     if (0) {
> -      _mesa_fprint_program_opt(stderr, &vp->program.Base, PROG_PRINT_DEBUG,
> -			       true);
> +      _mesa_fprint_program_opt(stderr, &vp->program, PROG_PRINT_DEBUG, true);
>     }
>  
>     if (unlikely(brw->perf_debug)) {
> @@ -180,7 +177,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
>     }
>  
>     if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
> -      brw_dump_ir("vertex", prog, vs ? &vs->base : NULL, &vp->program.Base);
> +      brw_dump_ir("vertex", prog, vs ? &vs->base : NULL, &vp->program);
>  
>        fprintf(stderr, "VS Output ");
>        brw_print_vue_map(stderr, &prog_data.base.vue_map);
> @@ -188,13 +185,13 @@ brw_codegen_vs_prog(struct brw_context *brw,
>  
>     int st_index = -1;
>     if (INTEL_DEBUG & DEBUG_SHADER_TIME)
> -      st_index = brw_get_shader_time_index(brw, prog, &vp->program.Base, ST_VS);
> +      st_index = brw_get_shader_time_index(brw, prog, &vp->program, ST_VS);
>  
>     /* Emit GEN4 code.
>      */
>     char *error_str;
> -   program = brw_compile_vs(compiler, brw, mem_ctx, key,
> -                            &prog_data, vp->program.Base.nir,
> +   program = brw_compile_vs(compiler, brw, mem_ctx, key, &prog_data,
> +                            vp->program.nir,
>                              brw_select_clip_planes(&brw->ctx),
>                              !_mesa_is_gles3(&brw->ctx),
>                              st_index, &program_size, &error_str);
> @@ -322,9 +319,8 @@ brw_vs_populate_key(struct brw_context *brw,
>     key->program_string_id = vp->id;
>  
>     if (ctx->Transform.ClipPlanesEnabled != 0 &&
> -       (ctx->API == API_OPENGL_COMPAT ||
> -        ctx->API == API_OPENGLES) &&
> -       vp->program.Base.ClipDistanceArraySize == 0) {
> +       (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) &&
> +       vp->program.ClipDistanceArraySize == 0) {
>        key->nr_userclip_plane_consts =
>           _mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
>     }
> @@ -393,8 +389,7 @@ brw_vs_precompile(struct gl_context *ctx,
>     struct brw_stage_prog_data *old_prog_data = brw->vs.base.prog_data;
>     bool success;
>  
> -   struct gl_vertex_program *vp = (struct gl_vertex_program *) prog;
> -   struct brw_vertex_program *bvp = brw_vertex_program(vp);
> +   struct brw_vertex_program *bvp = brw_vertex_program(prog);
>  
>     memset(&key, 0, sizeof(key));
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
> index f8c7218..a5a5a75 100644
> --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
> @@ -121,7 +121,7 @@ brw_upload_vs_pull_constants(struct brw_context *brw)
>  
>     _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_VERTEX);
>     /* _NEW_PROGRAM_CONSTANTS */
> -   brw_upload_pull_constants(brw, BRW_NEW_VS_CONSTBUF, &vp->program.Base,
> +   brw_upload_pull_constants(brw, BRW_NEW_VS_CONSTBUF, &vp->program,
>                               stage_state, prog_data);
>  }
>  
> diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> index 780b163..17ccd32 100644
> --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> @@ -46,8 +46,8 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
>     const struct brw_stage_prog_data *prog_data = brw->vs.base.prog_data;
>  
>     _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_VERTEX);
> -   gen6_upload_push_constants(brw, &vp->program.Base, prog_data,
> -                              stage_state, AUB_TRACE_VS_CONSTANTS);
> +   gen6_upload_push_constants(brw, &vp->program, prog_data, stage_state,
> +                              AUB_TRACE_VS_CONSTANTS);
>  
>     if (brw->gen >= 7) {
>        if (brw->gen == 7 && !brw->is_haswell && !brw->is_baytrail)
> diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
> index 7c6f480..07eae23 100644
> --- a/src/mesa/drivers/dri/r200/r200_context.h
> +++ b/src/mesa/drivers/dri/r200/r200_context.h
> @@ -59,7 +59,7 @@ typedef struct r200_context *r200ContextPtr;
>  #include "main/mm.h"
>  
>  struct r200_vertex_program {
> -        struct gl_vertex_program mesa_program; /* Must be first */
> +        struct gl_program mesa_program; /* Must be first */
>          int translated;
>          /* need excess instr: 1 for late loop checking, 2 for 
>             additional instr due to instr/attr, 3 for fog */
> diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
> index 8cffa92..f31a191 100644
> --- a/src/mesa/drivers/dri/r200/r200_state_init.c
> +++ b/src/mesa/drivers/dri/r200/r200_state_init.c
> @@ -271,8 +271,8 @@ TCL_OR_VP_CHECK( tcl_or_vp, GL_TRUE, 0 )
>  TCL_OR_VP_CHECK( tcl_or_vp_add2, GL_TRUE, 2 )
>  VP_CHECK( tcl_vp, GL_TRUE, 0 )
>  VP_CHECK( tcl_vp_add4, GL_TRUE, 4 )
> -VP_CHECK( tcl_vp_size_add4, ctx->VertexProgram.Current->Base.NumNativeInstructions > 64, 4 )
> -VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->Base.NumNativeParameters > 96, 4 )
> +VP_CHECK( tcl_vp_size_add4, ctx->VertexProgram.Current->NumNativeInstructions > 64, 4 )
> +VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->NumNativeParameters > 96, 4 )
>  
>  #define OUT_VEC(hdr, data) do {			\
>      drm_radeon_cmd_header_t h;					\
> diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
> index c042aae..b556c86 100644
> --- a/src/mesa/drivers/dri/r200/r200_tcl.c
> +++ b/src/mesa/drivers/dri/r200/r200_tcl.c
> @@ -427,7 +427,7 @@ static GLboolean r200_run_tcl_render( struct gl_context *ctx,
>  	 We only need to change compsel. */
>        GLuint out_compsel = 0;
>        const GLbitfield64 vp_out =
> -	 rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
> +	 rmesa->curr_vp_hw->mesa_program.OutputsWritten;
>  
>        vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0];
>        assert(vp_out & BITFIELD64_BIT(VARYING_SLOT_POS));
> diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
> index 628c570..bf67602 100644
> --- a/src/mesa/drivers/dri/r200/r200_vertprog.c
> +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
> @@ -104,15 +104,15 @@ static GLboolean r200VertexProgUpdateParams(struct gl_context *ctx, struct r200_
>     r200ContextPtr rmesa = R200_CONTEXT( ctx );
>     GLfloat *fcmd = (GLfloat *)&rmesa->hw.vpp[0].cmd[VPP_CMD_0 + 1];
>     int pi;
> -   struct gl_vertex_program *mesa_vp = &vp->mesa_program;
> +   struct gl_program *mesa_vp = &vp->mesa_program;
>     struct gl_program_parameter_list *paramList;
>     drm_radeon_cmd_header_t tmp;
>  
>     R200_STATECHANGE( rmesa, vpp[0] );
>     R200_STATECHANGE( rmesa, vpp[1] );
> -   assert(mesa_vp->Base.Parameters);
> -   _mesa_load_state_parameters(ctx, mesa_vp->Base.Parameters);
> -   paramList = mesa_vp->Base.Parameters;
> +   assert(mesa_vp->Parameters);
> +   _mesa_load_state_parameters(ctx, mesa_vp->Parameters);
> +   paramList = mesa_vp->Parameters;
>  
>     if(paramList->NumParameters > R200_VSF_MAX_PARAM){
>        fprintf(stderr, "%s:Params exhausted\n", __func__);
> @@ -392,7 +392,7 @@ static unsigned long op_operands(enum prog_opcode opcode)
>   */
>  static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r200_vertex_program *vp)
>  {
> -   struct gl_vertex_program *mesa_vp = &vp->mesa_program;
> +   struct gl_program *mesa_vp = &vp->mesa_program;
>     struct prog_instruction *vpi;
>     int i;
>     VERTEX_SHADER_INSTRUCTION *o_inst;
> @@ -409,30 +409,30 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
>     vp->translated = GL_TRUE;
>     vp->fogmode = ctx->Fog.Mode;
>  
> -   if (mesa_vp->Base.NumInstructions == 0)
> +   if (mesa_vp->NumInstructions == 0)
>        return GL_FALSE;
>  
>  #if 0
> -   if ((mesa_vp->Base.InputsRead &
> +   if ((mesa_vp->InputsRead &
>        ~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 |
>        VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 |
>        VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) != 0) {
>        if (R200_DEBUG & RADEON_FALLBACKS) {
>  	 fprintf(stderr, "can't handle vert prog inputs 0x%x\n",
> -	    mesa_vp->Base.InputsRead);
> +	    mesa_vp->InputsRead);
>        }
>        return GL_FALSE;
>     }
>  #endif
>  
> -   if ((mesa_vp->Base.OutputsWritten &
> +   if ((mesa_vp->OutputsWritten &
>        ~((1 << VARYING_SLOT_POS) | (1 << VARYING_SLOT_COL0) | (1 << VARYING_SLOT_COL1) |
>        (1 << VARYING_SLOT_FOGC) | (1 << VARYING_SLOT_TEX0) | (1 << VARYING_SLOT_TEX1) |
>        (1 << VARYING_SLOT_TEX2) | (1 << VARYING_SLOT_TEX3) | (1 << VARYING_SLOT_TEX4) |
>        (1 << VARYING_SLOT_TEX5) | (1 << VARYING_SLOT_PSIZ))) != 0) {
>        if (R200_DEBUG & RADEON_FALLBACKS) {
>  	 fprintf(stderr, "can't handle vert prog outputs 0x%llx\n",
> -                 (unsigned long long) mesa_vp->Base.OutputsWritten);
> +                 (unsigned long long) mesa_vp->OutputsWritten);
>        }
>        return GL_FALSE;
>     }
> @@ -447,25 +447,25 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
>  /* FIXME: is changing the prog safe to do here? */
>     if (mesa_vp->IsPositionInvariant &&
>        /* make sure we only do this once */
> -       !(mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_POS))) {
> +       !(mesa_vp->OutputsWritten & (1 << VARYING_SLOT_POS))) {
>  	 _mesa_insert_mvp_code(ctx, mesa_vp);
>        }
>  
>     /* for fogc, can't change mesa_vp, as it would hose swtnl, and exp with
>        base e isn't directly available neither. */
> -   if ((mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_FOGC)) && !vp->fogpidx) {
> +   if ((mesa_vp->OutputsWritten & (1 << VARYING_SLOT_FOGC)) && !vp->fogpidx) {
>        struct gl_program_parameter_list *paramList;
>        gl_state_index tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 };
> -      paramList = mesa_vp->Base.Parameters;
> +      paramList = mesa_vp->Parameters;
>        vp->fogpidx = _mesa_add_state_reference(paramList, tokens);
>     }
>  
>     vp->pos_end = 0;
> -   mesa_vp->Base.NumNativeInstructions = 0;
> -   if (mesa_vp->Base.Parameters)
> -      mesa_vp->Base.NumNativeParameters = mesa_vp->Base.Parameters->NumParameters;
> +   mesa_vp->NumNativeInstructions = 0;
> +   if (mesa_vp->Parameters)
> +      mesa_vp->NumNativeParameters = mesa_vp->Parameters->NumParameters;
>     else
> -      mesa_vp->Base.NumNativeParameters = 0;
> +      mesa_vp->NumNativeParameters = 0;
>  
>     for(i = 0; i < VERT_ATTRIB_MAX; i++)
>        vp->inputs[i] = -1;
> @@ -491,42 +491,42 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
>     Haven't seen attr 14 used, maybe that's for the hw pointsize vec1 (which is
>     not possibe to use with vertex progs as it is lacking in vert prog specification) */
>  /* may look different when using idx buf / input_route instead of se_vtx_fmt? */
> -   if (mesa_vp->Base.InputsRead & VERT_BIT_POS) {
> +   if (mesa_vp->InputsRead & VERT_BIT_POS) {
>        vp->inputs[VERT_ATTRIB_POS] = 0;
>        vp->inputmap_rev[0] = VERT_ATTRIB_POS;
>        free_inputs &= ~(1 << 0);
>        array_count++;
>     }
> -   if (mesa_vp->Base.InputsRead & VERT_BIT_WEIGHT) {
> +   if (mesa_vp->InputsRead & VERT_BIT_WEIGHT) {
>        vp->inputs[VERT_ATTRIB_WEIGHT] = 12;
>        vp->inputmap_rev[1] = VERT_ATTRIB_WEIGHT;
>        array_count++;
>     }
> -   if (mesa_vp->Base.InputsRead & VERT_BIT_NORMAL) {
> +   if (mesa_vp->InputsRead & VERT_BIT_NORMAL) {
>        vp->inputs[VERT_ATTRIB_NORMAL] = 1;
>        vp->inputmap_rev[2] = VERT_ATTRIB_NORMAL;
>        array_count++;
>     }
> -   if (mesa_vp->Base.InputsRead & VERT_BIT_COLOR0) {
> +   if (mesa_vp->InputsRead & VERT_BIT_COLOR0) {
>        vp->inputs[VERT_ATTRIB_COLOR0] = 2;
>        vp->inputmap_rev[4] = VERT_ATTRIB_COLOR0;
>        free_inputs &= ~(1 << 2);
>        array_count++;
>     }
> -   if (mesa_vp->Base.InputsRead & VERT_BIT_COLOR1) {
> +   if (mesa_vp->InputsRead & VERT_BIT_COLOR1) {
>        vp->inputs[VERT_ATTRIB_COLOR1] = 3;
>        vp->inputmap_rev[5] = VERT_ATTRIB_COLOR1;
>        free_inputs &= ~(1 << 3);
>        array_count++;
>     }
> -   if (mesa_vp->Base.InputsRead & VERT_BIT_FOG) {
> +   if (mesa_vp->InputsRead & VERT_BIT_FOG) {
>        vp->inputs[VERT_ATTRIB_FOG] = 15; array_count++;
>        vp->inputmap_rev[3] = VERT_ATTRIB_FOG;
>        array_count++;
>     }
>     /* VERT_ATTRIB_TEX0-5 */
>     for (i = 0; i <= 5; i++) {
> -      if (mesa_vp->Base.InputsRead & VERT_BIT_TEX(i)) {
> +      if (mesa_vp->InputsRead & VERT_BIT_TEX(i)) {
>  	 vp->inputs[VERT_ATTRIB_TEX(i)] = i + 6;
>  	 vp->inputmap_rev[8 + i] = VERT_ATTRIB_TEX(i);
>  	 free_inputs &= ~(1 << (i + 6));
> @@ -535,7 +535,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
>     }
>     /* using VERT_ATTRIB_TEX6/7 would be illegal */
>     for (; i < VERT_ATTRIB_TEX_MAX; i++) {
> -      if (mesa_vp->Base.InputsRead & VERT_BIT_TEX(i)) {
> +      if (mesa_vp->InputsRead & VERT_BIT_TEX(i)) {
>            if (R200_DEBUG & RADEON_FALLBACKS) {
>                fprintf(stderr, "texture attribute %d in vert prog\n", i);
>            }
> @@ -546,7 +546,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
>     for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
>        int j;
>     /* completely ignore aliasing? */
> -      if (mesa_vp->Base.InputsRead & VERT_BIT_GENERIC(i)) {
> +      if (mesa_vp->InputsRead & VERT_BIT_GENERIC(i)) {
>  	 array_count++;
>  	 if (array_count > 12) {
>  	    if (R200_DEBUG & RADEON_FALLBACKS) {
> @@ -575,7 +575,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
>        }
>     }
>  
> -   if (!(mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_POS))) {
> +   if (!(mesa_vp->OutputsWritten & (1 << VARYING_SLOT_POS))) {
>        if (R200_DEBUG & RADEON_FALLBACKS) {
>  	 fprintf(stderr, "can't handle vert prog without position output\n");
>        }
> @@ -589,7 +589,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
>     }
>  
>     o_inst = vp->instr;
> -   for (vpi = mesa_vp->Base.Instructions; vpi->Opcode != OPCODE_END; vpi++, o_inst++){
> +   for (vpi = mesa_vp->Instructions; vpi->Opcode != OPCODE_END; vpi++, o_inst++){
>        operands = op_operands(vpi->Opcode);
>        are_srcs_scalar = operands & SCALAR_FLAG;
>        operands &= OP_MASK;
> @@ -1069,20 +1069,20 @@ else {
>        }
>  
>        u_temp_used = (R200_VSF_MAX_TEMPS - 1) - u_temp_i;
> -      if (mesa_vp->Base.NumNativeTemporaries <
> -	 (mesa_vp->Base.NumTemporaries + u_temp_used)) {
> -	 mesa_vp->Base.NumNativeTemporaries =
> -	    mesa_vp->Base.NumTemporaries + u_temp_used;
> +      if (mesa_vp->NumNativeTemporaries <
> +	  (mesa_vp->NumTemporaries + u_temp_used)) {
> +	 mesa_vp->NumNativeTemporaries =
> +	    mesa_vp->NumTemporaries + u_temp_used;
>        }
> -      if ((mesa_vp->Base.NumTemporaries + u_temp_used) > R200_VSF_MAX_TEMPS) {
> +      if ((mesa_vp->NumTemporaries + u_temp_used) > R200_VSF_MAX_TEMPS) {
>  	 if (R200_DEBUG & RADEON_FALLBACKS) {
> -	    fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->Base.NumTemporaries, u_temp_used);
> +	    fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->NumTemporaries, u_temp_used);
>  	 }
>  	 return GL_FALSE;
>        }
>        u_temp_i = R200_VSF_MAX_TEMPS - 1;
>        if(o_inst - vp->instr >= R200_VSF_MAX_INST) {
> -	 mesa_vp->Base.NumNativeInstructions = 129;
> +	 mesa_vp->NumNativeInstructions = 129;
>  	 if (R200_DEBUG & RADEON_FALLBACKS) {
>  	    fprintf(stderr, "more than 128 native instructions\n");
>  	 }
> @@ -1094,7 +1094,7 @@ else {
>     }
>  
>     vp->native = GL_TRUE;
> -   mesa_vp->Base.NumNativeInstructions = (o_inst - vp->instr);
> +   mesa_vp->NumNativeInstructions = (o_inst - vp->instr);
>  #if 0
>     fprintf(stderr, "hw program:\n");
>     for(i=0; i < vp->program.length; i++)
> @@ -1126,10 +1126,10 @@ void r200SetupVertexProg( struct gl_context *ctx ) {
>     R200_STATECHANGE( rmesa, pvs );
>  
>     rmesa->hw.pvs.cmd[PVS_CNTL_1] = (0 << R200_PVS_CNTL_1_PROGRAM_START_SHIFT) |
> -      ((vp->mesa_program.Base.NumNativeInstructions - 1) << R200_PVS_CNTL_1_PROGRAM_END_SHIFT) |
> +      ((vp->mesa_program.NumNativeInstructions - 1) << R200_PVS_CNTL_1_PROGRAM_END_SHIFT) |
>        (vp->pos_end << R200_PVS_CNTL_1_POS_END_SHIFT);
>     rmesa->hw.pvs.cmd[PVS_CNTL_2] = (0 << R200_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
> -      (vp->mesa_program.Base.NumNativeParameters << R200_PVS_CNTL_2_PARAM_COUNT_SHIFT);
> +      (vp->mesa_program.NumNativeParameters << R200_PVS_CNTL_2_PARAM_COUNT_SHIFT);
>  
>     /* maybe user clip planes just work with vertex progs... untested */
>     if (ctx->Transform.ClipPlanesEnabled) {
> @@ -1143,7 +1143,7 @@ void r200SetupVertexProg( struct gl_context *ctx ) {
>     }
>  
>     if (vp != rmesa->curr_vp_hw) {
> -      GLuint count = vp->mesa_program.Base.NumNativeInstructions;
> +      GLuint count = vp->mesa_program.NumNativeInstructions;
>        drm_radeon_cmd_header_t tmp;
>  
>        R200_STATECHANGE( rmesa, vpi[0] );
> @@ -1203,7 +1203,7 @@ r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id)
>     switch(target){
>     case GL_VERTEX_PROGRAM_ARB: {
>        struct r200_vertex_program *vp = CALLOC_STRUCT(r200_vertex_program);
> -      return _mesa_init_gl_program(&vp->mesa_program.Base, target, id);
> +      return _mesa_init_gl_program(&vp->mesa_program, target, id);
>     }
>     case GL_FRAGMENT_PROGRAM_ARB: {
>        struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
> @@ -1232,7 +1232,7 @@ r200ProgramStringNotify(struct gl_context *ctx, GLenum target, struct gl_program
>     case GL_VERTEX_PROGRAM_ARB:
>        vp->translated = GL_FALSE;
>        vp->fogpidx = 0;
> -/*      memset(&vp->translated, 0, sizeof(struct r200_vertex_program) - sizeof(struct gl_vertex_program));*/
> +/*      memset(&vp->translated, 0, sizeof(struct r200_vertex_program) - sizeof(struct gl_program));*/
>        r200_translate_vertex_program(ctx, vp);
>        rmesa->curr_vp_hw = NULL;
>        break;
> diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
> index 911b6fa..0b6f7cb 100644
> --- a/src/mesa/main/arbprogram.c
> +++ b/src/mesa/main/arbprogram.c
> @@ -59,7 +59,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
>  
>     /* Error-check target and get curProg */
>     if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
> -      curProg = &ctx->VertexProgram.Current->Base;
> +      curProg = ctx->VertexProgram.Current;
>     }
>     else if (target == GL_FRAGMENT_PROGRAM_ARB
>              && ctx->Extensions.ARB_fragment_program) {
> @@ -79,7 +79,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
>        /* Bind a default program */
>        newProg = NULL;
>        if (target == GL_VERTEX_PROGRAM_ARB)
> -         newProg = &ctx->Shared->DefaultVertexProgram->Base;
> +         newProg = ctx->Shared->DefaultVertexProgram;
>        else
>           newProg = &ctx->Shared->DefaultFragmentProgram->Base;
>     }
> @@ -114,8 +114,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
>  
>     /* bind newProg */
>     if (target == GL_VERTEX_PROGRAM_ARB) {
> -      _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
> -                               gl_vertex_program(newProg));
> +      _mesa_reference_program(ctx, &ctx->VertexProgram.Current, newProg);
>     }
>     else if (target == GL_FRAGMENT_PROGRAM_ARB) {
>        _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
> @@ -160,7 +159,7 @@ _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
>              switch (prog->Target) {
>              case GL_VERTEX_PROGRAM_ARB:
>                 if (ctx->VertexProgram.Current &&
> -                   ctx->VertexProgram.Current->Base.Id == ids[i]) {
> +                   ctx->VertexProgram.Current->Id == ids[i]) {
>                    /* unbind this currently bound program */
>                    _mesa_BindProgramARB(prog->Target, 0);
>                 }
> @@ -257,7 +256,7 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
>  
>     if (target == GL_VERTEX_PROGRAM_ARB
>         && ctx->Extensions.ARB_vertex_program) {
> -      prog = &(ctx->VertexProgram.Current->Base);
> +      prog = ctx->VertexProgram.Current;
>        maxParams = ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams;
>     }
>     else if (target == GL_FRAGMENT_PROGRAM_ARB
> @@ -336,10 +335,10 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
>     }
>  
>     if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
> -      struct gl_vertex_program *prog = ctx->VertexProgram.Current;
> +      struct gl_program *prog = ctx->VertexProgram.Current;
>        _mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
>  
> -      base = & prog->Base;
> +      base = prog;
>     }
>     else if (target == GL_FRAGMENT_PROGRAM_ARB
>              && ctx->Extensions.ARB_fragment_program) {
> @@ -657,7 +656,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
>  
>     if (target == GL_VERTEX_PROGRAM_ARB
>         && ctx->Extensions.ARB_vertex_program) {
> -      prog = &(ctx->VertexProgram.Current->Base);
> +      prog = ctx->VertexProgram.Current;
>        limits = &ctx->Const.Program[MESA_SHADER_VERTEX];
>     }
>     else if (target == GL_FRAGMENT_PROGRAM_ARB
> @@ -838,7 +837,7 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
>     GET_CURRENT_CONTEXT(ctx);
>  
>     if (target == GL_VERTEX_PROGRAM_ARB) {
> -      prog = &(ctx->VertexProgram.Current->Base);
> +      prog = ctx->VertexProgram.Current;
>     }
>     else if (target == GL_FRAGMENT_PROGRAM_ARB) {
>        prog = &(ctx->FragmentProgram.Current->Base);
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 757dbfc..1ae1ab5 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -741,7 +741,7 @@ check_context_limits(struct gl_context *ctx)
>  
>     /* check that we don't exceed the size of various bitfields */
>     assert(VARYING_SLOT_MAX <=
> -	  (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
> +	  (8 * sizeof(ctx->VertexProgram._Current->OutputsWritten)));
>     assert(VARYING_SLOT_MAX <=
>  	  (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
>  
> @@ -1293,9 +1293,9 @@ _mesa_free_context_data( struct gl_context *ctx )
>     _mesa_reference_framebuffer(&ctx->DrawBuffer, NULL);
>     _mesa_reference_framebuffer(&ctx->ReadBuffer, NULL);
>  
> -   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
> -   _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
> -   _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL);
> +   _mesa_reference_program(ctx, &ctx->VertexProgram.Current, NULL);
> +   _mesa_reference_program(ctx, &ctx->VertexProgram._Current, NULL);
> +   _mesa_reference_program(ctx, &ctx->VertexProgram._TnlProgram, NULL);
>  
>     _mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current, NULL);
>     _mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
> diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
> index db3736e..5300335 100644
> --- a/src/mesa/main/ff_fragment_shader.cpp
> +++ b/src/mesa/main/ff_fragment_shader.cpp
> @@ -368,7 +368,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
>        if (vertexShader)
>           vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
>        else
> -         vprog = &ctx->VertexProgram.Current->Base;
> +         vprog = ctx->VertexProgram.Current;
>  
>        vp_outputs = vprog->OutputsWritten;
>  
> diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
> index 9bf0f68..15997cc 100644
> --- a/src/mesa/main/ffvertex_prog.c
> +++ b/src/mesa/main/ffvertex_prog.c
> @@ -305,7 +305,7 @@ struct ureg {
>  
>  struct tnl_program {
>     const struct state_key *state;
> -   struct gl_vertex_program *program;
> +   struct gl_program *program;
>     GLuint max_inst;  /** number of instructions allocated for program */
>     GLboolean mvp_with_dp4;
>  
> @@ -384,8 +384,8 @@ static struct ureg get_temp( struct tnl_program *p )
>        exit(1);
>     }
>  
> -   if ((GLuint) bit > p->program->Base.NumTemporaries)
> -      p->program->Base.NumTemporaries = bit;
> +   if ((GLuint) bit > p->program->NumTemporaries)
> +      p->program->NumTemporaries = bit;
>  
>     p->temp_in_use |= 1<<(bit-1);
>     return make_ureg(PROGRAM_TEMPORARY, bit-1);
> @@ -428,7 +428,7 @@ static struct ureg register_param5(struct tnl_program *p,
>     tokens[2] = s2;
>     tokens[3] = s3;
>     tokens[4] = s4;
> -   idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens );
> +   idx = _mesa_add_state_reference(p->program->Parameters, tokens );
>     return make_ureg(PROGRAM_STATE_VAR, idx);
>  }
>  
> @@ -448,7 +448,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
>     assert(input < VERT_ATTRIB_MAX);
>  
>     if (p->state->varying_vp_inputs & VERT_BIT(input)) {
> -      p->program->Base.InputsRead |= VERT_BIT(input);
> +      p->program->InputsRead |= VERT_BIT(input);
>        return make_ureg(PROGRAM_INPUT, input);
>     }
>     else {
> @@ -462,7 +462,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
>   */
>  static struct ureg register_output( struct tnl_program *p, GLuint output )
>  {
> -   p->program->Base.OutputsWritten |= BITFIELD64_BIT(output);
> +   p->program->OutputsWritten |= BITFIELD64_BIT(output);
>     return make_ureg(PROGRAM_OUTPUT, output);
>  }
>  
> @@ -480,8 +480,8 @@ static struct ureg register_const4f( struct tnl_program *p,
>     values[1].f = s1;
>     values[2].f = s2;
>     values[3].f = s3;
> -   idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4,
> -                                     &swizzle );
> +   idx = _mesa_add_unnamed_constant(p->program->Parameters, values, 4,
> +                                    &swizzle );
>     assert(swizzle == SWIZZLE_NOOP);
>     return make_ureg(PROGRAM_CONSTANT, idx);
>  }
> @@ -578,9 +578,9 @@ static void emit_op3fn(struct tnl_program *p,
>     GLuint nr;
>     struct prog_instruction *inst;
>  
> -   assert(p->program->Base.NumInstructions <= p->max_inst);
> +   assert(p->program->NumInstructions <= p->max_inst);
>  
> -   if (p->program->Base.NumInstructions == p->max_inst) {
> +   if (p->program->NumInstructions == p->max_inst) {
>        /* need to extend the program's instruction array */
>        struct prog_instruction *newInst;
>  
> @@ -593,19 +593,18 @@ static void emit_op3fn(struct tnl_program *p,
>           return;
>        }
>  
> -      _mesa_copy_instructions(newInst,
> -                              p->program->Base.Instructions,
> -                              p->program->Base.NumInstructions);
> +      _mesa_copy_instructions(newInst, p->program->Instructions,
> +                              p->program->NumInstructions);
>  
> -      _mesa_free_instructions(p->program->Base.Instructions,
> -                              p->program->Base.NumInstructions);
> +      _mesa_free_instructions(p->program->Instructions,
> +                              p->program->NumInstructions);
>  
> -      p->program->Base.Instructions = newInst;
> +      p->program->Instructions = newInst;
>     }
>  
> -   nr = p->program->Base.NumInstructions++;
> +   nr = p->program->NumInstructions++;
>  
> -   inst = &p->program->Base.Instructions[nr];
> +   inst = &p->program->Instructions[nr];
>     inst->Opcode = (enum prog_opcode) op;
>  
>     emit_arg( &inst->SrcReg[0], src0 );
> @@ -1608,7 +1607,7 @@ static void build_tnl_program( struct tnl_program *p )
>  
>  static void
>  create_new_program( const struct state_key *key,
> -                    struct gl_vertex_program *program,
> +                    struct gl_program *program,
>                      GLboolean mvp_with_dp4,
>                      GLuint max_temps)
>  {
> @@ -1634,15 +1633,15 @@ create_new_program( const struct state_key *key,
>      * If we need more, we'll grow the instruction array as needed.
>      */
>     p.max_inst = 32;
> -   p.program->Base.Instructions = _mesa_alloc_instructions(p.max_inst);
> -   p.program->Base.String = NULL;
> -   p.program->Base.NumInstructions =
> -   p.program->Base.NumTemporaries =
> -   p.program->Base.NumParameters =
> -   p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0;
> -   p.program->Base.Parameters = _mesa_new_parameter_list();
> -   p.program->Base.InputsRead = 0;
> -   p.program->Base.OutputsWritten = 0;
> +   p.program->Instructions = _mesa_alloc_instructions(p.max_inst);
> +   p.program->String = NULL;
> +   p.program->NumInstructions =
> +   p.program->NumTemporaries =
> +   p.program->NumParameters =
> +   p.program->NumAttributes = p.program->NumAddressRegs = 0;
> +   p.program->Parameters = _mesa_new_parameter_list();
> +   p.program->InputsRead = 0;
> +   p.program->OutputsWritten = 0;
>  
>     build_tnl_program( &p );
>  }
> @@ -1652,10 +1651,10 @@ create_new_program( const struct state_key *key,
>   * Return a vertex program which implements the current fixed-function
>   * transform/lighting/texgen operations.
>   */
> -struct gl_vertex_program *
> +struct gl_program *
>  _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
>  {
> -   struct gl_vertex_program *prog;
> +   struct gl_program *prog;
>     struct state_key key;
>  
>     /* Grab all the relevant state and put it in a single structure:
> @@ -1664,15 +1663,15 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
>  
>     /* Look for an already-prepared program for this state:
>      */
> -   prog = gl_vertex_program(
> -      _mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key)));
> +   prog = _mesa_search_program_cache(ctx->VertexProgram.Cache, &key,
> +                                     sizeof(key));
>  
>     if (!prog) {
>        /* OK, we'll have to build a new one */
>        if (0)
>           printf("Build new TNL program\n");
>  
> -      prog = gl_vertex_program(ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0));
> +      prog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
>        if (!prog)
>           return NULL;
>  
> @@ -1681,11 +1680,10 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
>                            ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps );
>  
>        if (ctx->Driver.ProgramStringNotify)
> -         ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
> -                                          &prog->Base );
> +         ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, prog);
>  
> -      _mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache,
> -                                 &key, sizeof(key), &prog->Base);
> +      _mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache, &key,
> +                                 sizeof(key), prog);
>     }
>  
>     return prog;
> diff --git a/src/mesa/main/ffvertex_prog.h b/src/mesa/main/ffvertex_prog.h
> index 648befd..0a67d48 100644
> --- a/src/mesa/main/ffvertex_prog.h
> +++ b/src/mesa/main/ffvertex_prog.h
> @@ -32,7 +32,7 @@
>  
>  struct gl_context;
>  
> -struct gl_vertex_program *
> +struct gl_program *
>  _mesa_get_fixed_func_vertex_program(struct gl_context *ctx);
>  
>  
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index e79d37a..d54c1b3 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1987,13 +1987,8 @@ struct gl_program
>     GLuint NumNativeTexInstructions;
>     GLuint NumNativeTexIndirections;
>     /*@}*/
> -};
> -
>  
> -/** Vertex program object */
> -struct gl_vertex_program
> -{
> -   struct gl_program Base;   /**< base class */
> +   /** Used by ARB assembly-style Vertex program */
>     GLboolean IsPositionInvariant;
>  };
>  
> @@ -2071,13 +2066,13 @@ struct gl_vertex_program_state
>     GLboolean TwoSideEnabled;     /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
>     /** Computed two sided lighting for fixed function/programs. */
>     GLboolean _TwoSideEnabled;
> -   struct gl_vertex_program *Current;  /**< User-bound vertex program */
> +   struct gl_program *Current;  /**< User-bound vertex program */
>  
>     /** Currently enabled and valid vertex program (including internal
>      * programs, user-defined vertex programs and GLSL vertex shaders).
>      * This is the program we must use when rendering.
>      */
> -   struct gl_vertex_program *_Current;
> +   struct gl_program *_Current;
>  
>     GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
>  
> @@ -2085,7 +2080,7 @@ struct gl_vertex_program_state
>     GLboolean _MaintainTnlProgram;
>  
>     /** Program to emulate fixed-function T&L (see above) */
> -   struct gl_vertex_program *_TnlProgram;
> +   struct gl_program *_TnlProgram;
>  
>     /** Cache of fixed-function programs */
>     struct gl_program_cache *Cache;
> @@ -2779,7 +2774,7 @@ struct gl_shader_program
>     /** Vertex shader state */
>     struct {
>        /**
> -       * True if gl_ClipDistance is written to.  Copied into gl_vertex_program
> +       * True if gl_ClipDistance is written to.  Copied into gl_program
>         * by _mesa_copy_linked_program_data().
>         */
>        GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
> @@ -3100,7 +3095,7 @@ struct gl_shared_state
>      */
>     /*@{*/
>     struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */
> -   struct gl_vertex_program *DefaultVertexProgram;
> +   struct gl_program *DefaultVertexProgram;
>     struct gl_fragment_program *DefaultFragmentProgram;
>     /*@}*/
>  
> diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
> index 49e5f02..5ff0b69 100644
> --- a/src/mesa/main/shared.c
> +++ b/src/mesa/main/shared.c
> @@ -70,8 +70,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
>     shared->Programs = _mesa_NewHashTable();
>  
>     shared->DefaultVertexProgram =
> -      gl_vertex_program(ctx->Driver.NewProgram(ctx,
> -                                               GL_VERTEX_PROGRAM_ARB, 0));
> +      ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
>     shared->DefaultFragmentProgram =
>        gl_fragment_program(ctx->Driver.NewProgram(ctx,
>                                                   GL_FRAGMENT_PROGRAM_ARB, 0));
> @@ -332,7 +331,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
>     _mesa_HashDeleteAll(shared->Programs, delete_program_cb, ctx);
>     _mesa_DeleteHashTable(shared->Programs);
>  
> -   _mesa_reference_vertprog(ctx, &shared->DefaultVertexProgram, NULL);
> +   _mesa_reference_program(ctx, &shared->DefaultVertexProgram, NULL);
>     _mesa_reference_fragprog(ctx, &shared->DefaultFragmentProgram, NULL);
>  
>     _mesa_HashDeleteAll(shared->ATIShaders, delete_fragshader_cb, ctx);
> diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
> index 407ff38..b09b3fe 100644
> --- a/src/mesa/main/state.c
> +++ b/src/mesa/main/state.c
> @@ -70,7 +70,7 @@ update_program_enables(struct gl_context *ctx)
>      * GLSL shaders not relevant here.
>      */
>     ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
> -      && ctx->VertexProgram.Current->Base.Instructions;
> +      && ctx->VertexProgram.Current->Instructions;
>     ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
>        && ctx->FragmentProgram.Current->Base.Instructions;
>     ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
> @@ -107,7 +107,7 @@ update_program(struct gl_context *ctx)
>        ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
>     const struct gl_shader_program *csProg =
>        ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
> -   const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
> +   const struct gl_program *prevVP = ctx->VertexProgram._Current;
>     const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
>     const struct gl_program *prevGP = ctx->GeometryProgram._Current;
>     const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
> @@ -222,24 +222,24 @@ update_program(struct gl_context *ctx)
>     if (vsProg && vsProg->LinkStatus
>         && vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
>        /* Use GLSL vertex shader */
> -      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
> -			       gl_vertex_program(vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program));
> +      _mesa_reference_program(ctx, &ctx->VertexProgram._Current,
> +                              vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
>     }
>     else if (ctx->VertexProgram._Enabled) {
>        /* Use user-defined vertex program */
> -      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
> -                               ctx->VertexProgram.Current);
> +      _mesa_reference_program(ctx, &ctx->VertexProgram._Current,
> +                              ctx->VertexProgram.Current);
>     }
>     else if (ctx->VertexProgram._MaintainTnlProgram) {
>        /* Use vertex program generated from fixed-function state */
> -      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
> -                               _mesa_get_fixed_func_vertex_program(ctx));
> -      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram,
> -                               ctx->VertexProgram._Current);
> +      _mesa_reference_program(ctx, &ctx->VertexProgram._Current,
> +                              _mesa_get_fixed_func_vertex_program(ctx));
> +      _mesa_reference_program(ctx, &ctx->VertexProgram._TnlProgram,
> +                              ctx->VertexProgram._Current);
>     }
>     else {
>        /* no vertex program */
> -      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
> +      _mesa_reference_program(ctx, &ctx->VertexProgram._Current, NULL);
>     }
>  
>     if (csProg && csProg->LinkStatus
> @@ -290,7 +290,7 @@ update_program(struct gl_context *ctx)
>        new_state |= _NEW_PROGRAM;
>        if (ctx->Driver.BindProgram) {
>           ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
> -                            (struct gl_program *) ctx->VertexProgram._Current);
> +                                 ctx->VertexProgram._Current);
>        }
>     }
>  
> @@ -328,7 +328,7 @@ update_program_constants(struct gl_context *ctx)
>  
>     if (ctx->VertexProgram._Current) {
>        const struct gl_program_parameter_list *params =
> -         ctx->VertexProgram._Current->Base.Parameters;
> +         ctx->VertexProgram._Current->Parameters;
>        if (params && params->StateFlags & ctx->NewState) {
>           new_state |= _NEW_PROGRAM_CONSTANTS;
>        }
> diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
> index c57dc0e..95cde32 100644
> --- a/src/mesa/main/state.h
> +++ b/src/mesa/main/state.h
> @@ -61,7 +61,7 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
>  
>     if (ctx->VertexProgram._Current &&
>         (ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) &&
> -       (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1))
> +       (ctx->VertexProgram._Current->InputsRead & VERT_BIT_COLOR1))
>        return GL_TRUE;
>  
>     if (ctx->FragmentProgram._Current &&
> diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
> index b7bddfe..80a0528 100644
> --- a/src/mesa/program/arbprogparse.c
> +++ b/src/mesa/program/arbprogparse.c
> @@ -160,7 +160,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
>  void
>  _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
>  			       const GLvoid *str, GLsizei len,
> -			       struct gl_vertex_program *program)
> +			       struct gl_program *program)
>  {
>     struct gl_program prog;
>     struct asm_parser_state state;
> @@ -180,37 +180,37 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
>     if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
>        _mesa_optimize_program(ctx, &prog);
>  
> -   free(program->Base.String);
> +   free(program->String);
>  
>     /* Copy the relevant contents of the arb_program struct into the 
>      * vertex_program struct.
>      */
> -   program->Base.String          = prog.String;
> -   program->Base.NumInstructions = prog.NumInstructions;
> -   program->Base.NumTemporaries  = prog.NumTemporaries;
> -   program->Base.NumParameters   = prog.NumParameters;
> -   program->Base.NumAttributes   = prog.NumAttributes;
> -   program->Base.NumAddressRegs  = prog.NumAddressRegs;
> -   program->Base.NumNativeInstructions = prog.NumNativeInstructions;
> -   program->Base.NumNativeTemporaries = prog.NumNativeTemporaries;
> -   program->Base.NumNativeParameters = prog.NumNativeParameters;
> -   program->Base.NumNativeAttributes = prog.NumNativeAttributes;
> -   program->Base.NumNativeAddressRegs = prog.NumNativeAddressRegs;
> -   program->Base.InputsRead     = prog.InputsRead;
> -   program->Base.OutputsWritten = prog.OutputsWritten;
> -   program->Base.IndirectRegisterFiles = prog.IndirectRegisterFiles;
> +   program->String          = prog.String;
> +   program->NumInstructions = prog.NumInstructions;
> +   program->NumTemporaries  = prog.NumTemporaries;
> +   program->NumParameters   = prog.NumParameters;
> +   program->NumAttributes   = prog.NumAttributes;
> +   program->NumAddressRegs  = prog.NumAddressRegs;
> +   program->NumNativeInstructions = prog.NumNativeInstructions;
> +   program->NumNativeTemporaries = prog.NumNativeTemporaries;
> +   program->NumNativeParameters = prog.NumNativeParameters;
> +   program->NumNativeAttributes = prog.NumNativeAttributes;
> +   program->NumNativeAddressRegs = prog.NumNativeAddressRegs;
> +   program->InputsRead     = prog.InputsRead;
> +   program->OutputsWritten = prog.OutputsWritten;
> +   program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
>     program->IsPositionInvariant = (state.option.PositionInvariant)
>        ? GL_TRUE : GL_FALSE;
>  
> -   free(program->Base.Instructions);
> -   program->Base.Instructions = prog.Instructions;
> +   free(program->Instructions);
> +   program->Instructions = prog.Instructions;
>  
> -   if (program->Base.Parameters)
> -      _mesa_free_parameter_list(program->Base.Parameters);
> -   program->Base.Parameters = prog.Parameters; 
> +   if (program->Parameters)
> +      _mesa_free_parameter_list(program->Parameters);
> +   program->Parameters = prog.Parameters;
>  
>  #if DEBUG_VP
> -   printf("____________Vertex program %u __________\n", program->Base.Id);
> -   _mesa_print_program(&program->Base);
> +   printf("____________Vertex program %u __________\n", program->Id);
> +   _mesa_print_program(program);
>  #endif
>  }
> diff --git a/src/mesa/program/arbprogparse.h b/src/mesa/program/arbprogparse.h
> index 39d2116..05d93f0 100644
> --- a/src/mesa/program/arbprogparse.h
> +++ b/src/mesa/program/arbprogparse.h
> @@ -35,7 +35,7 @@ struct gl_vertex_program;
>  extern void
>  _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
>  			       const GLvoid *str, GLsizei len,
> -			       struct gl_vertex_program *program);
> +                               struct gl_program *program);
>  
>  extern void
>  _mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target,
> diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
> index 2ac7b56..110dfda 100644
> --- a/src/mesa/program/prog_statevars.c
> +++ b/src/mesa/program/prog_statevars.c
> @@ -399,14 +399,14 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
>                 COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
>                 return;
>              case STATE_LOCAL:
> -               if (!ctx->VertexProgram.Current->Base.LocalParams) {
> -                  ctx->VertexProgram.Current->Base.LocalParams =
> +               if (!ctx->VertexProgram.Current->LocalParams) {
> +                  ctx->VertexProgram.Current->LocalParams =
>                       calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
> -                  if (!ctx->VertexProgram.Current->Base.LocalParams)
> +                  if (!ctx->VertexProgram.Current->LocalParams)
>                       return;
>                 }
>  
> -               COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]);
> +               COPY_4V(value, ctx->VertexProgram.Current->LocalParams[idx]);
>                 return;
>              default:
>                 _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
> diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
> index 28af5b5..a72e6a1 100644
> --- a/src/mesa/program/program.c
> +++ b/src/mesa/program/program.c
> @@ -87,8 +87,8 @@ _mesa_init_program(struct gl_context *ctx)
>     ctx->VertexProgram.PointSizeEnabled =
>        (ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
>     ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
> -   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
> -                            ctx->Shared->DefaultVertexProgram);
> +   _mesa_reference_program(ctx, &ctx->VertexProgram.Current,
> +                           ctx->Shared->DefaultVertexProgram);
>     assert(ctx->VertexProgram.Current);
>     ctx->VertexProgram.Cache = _mesa_new_program_cache();
>  
> @@ -112,7 +112,7 @@ _mesa_init_program(struct gl_context *ctx)
>  void
>  _mesa_free_program_data(struct gl_context *ctx)
>  {
> -   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
> +   _mesa_reference_program(ctx, &ctx->VertexProgram.Current, NULL);
>     _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
>     _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
>     _mesa_delete_shader_cache(ctx, ctx->FragmentProgram.Cache);
> @@ -137,8 +137,8 @@ _mesa_free_program_data(struct gl_context *ctx)
>  void
>  _mesa_update_default_objects_program(struct gl_context *ctx)
>  {
> -   _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
> -                            ctx->Shared->DefaultVertexProgram);
> +   _mesa_reference_program(ctx, &ctx->VertexProgram.Current,
> +                           ctx->Shared->DefaultVertexProgram);
>     assert(ctx->VertexProgram.Current);
>  
>     _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
> @@ -215,14 +215,11 @@ struct gl_program *
>  _mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
>  {
>     switch (target) {
> -   case GL_VERTEX_PROGRAM_ARB: { /* == GL_VERTEX_PROGRAM_NV */
> -      struct gl_vertex_program *prog = CALLOC_STRUCT(gl_vertex_program);
> -      return _mesa_init_gl_program(&prog->Base, target, id);
> -   }
>     case GL_FRAGMENT_PROGRAM_ARB: {
>        struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
>        return _mesa_init_gl_program(&prog->Base, target, id);
>     }
> +   case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
>     case GL_GEOMETRY_PROGRAM_NV:
>     case GL_TESS_CONTROL_PROGRAM_NV:
>     case GL_TESS_EVALUATION_PROGRAM_NV: {
> diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
> index a909dcc..5f322da 100644
> --- a/src/mesa/program/program.h
> +++ b/src/mesa/program/program.h
> @@ -90,15 +90,6 @@ _mesa_reference_program(struct gl_context *ctx,
>  }
>  
>  static inline void
> -_mesa_reference_vertprog(struct gl_context *ctx,
> -                         struct gl_vertex_program **ptr,
> -                         struct gl_vertex_program *prog)
> -{
> -   _mesa_reference_program(ctx, (struct gl_program **) ptr,
> -                           (struct gl_program *) prog);
> -}
> -
> -static inline void
>  _mesa_reference_fragprog(struct gl_context *ctx,
>                           struct gl_fragment_program **ptr,
>                           struct gl_fragment_program *prog)
> @@ -184,10 +175,6 @@ _mesa_shader_stage_to_program(unsigned stage)
>  }
>  
>  
> -/* Cast wrappers from gl_program to derived program types.
> - * (e.g. gl_vertex_program)
> - */
> -
>  static inline struct gl_fragment_program *
>  gl_fragment_program(struct gl_program *prog)
>  {
> @@ -200,19 +187,6 @@ gl_fragment_program_const(const struct gl_program *prog)
>     return (const struct gl_fragment_program *) prog;
>  }
>  
> -
> -static inline struct gl_vertex_program *
> -gl_vertex_program(struct gl_program *prog)
> -{
> -   return (struct gl_vertex_program *) prog;
> -}
> -
> -static inline const struct gl_vertex_program *
> -gl_vertex_program_const(const struct gl_program *prog)
> -{
> -   return (const struct gl_vertex_program *) prog;
> -}
> -
>  static inline struct gl_compute_program *
>  gl_compute_program(struct gl_program *prog)
>  {
> diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
> index 4dd9998..4610035 100644
> --- a/src/mesa/program/programopt.c
> +++ b/src/mesa/program/programopt.c
> @@ -46,10 +46,10 @@
>   * May be used to implement the position_invariant option.
>   */
>  static void
> -_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
> +_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
>  {
>     struct prog_instruction *newInst;
> -   const GLuint origLen = vprog->Base.NumInstructions;
> +   const GLuint origLen = vprog->NumInstructions;
>     const GLuint newLen = origLen + 4;
>     GLuint i;
>  
> @@ -66,8 +66,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro
>     GLint mvpRef[4];
>  
>     for (i = 0; i < 4; i++) {
> -      mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
> -                                            mvpState[i]);
> +      mvpRef[i] = _mesa_add_state_reference(vprog->Parameters, mvpState[i]);
>     }
>  
>     /* Alloc storage for new instructions */
> @@ -100,24 +99,24 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro
>     }
>  
>     /* Append original instructions after new instructions */
> -   _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
> +   _mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
>  
>     /* free old instructions */
> -   _mesa_free_instructions(vprog->Base.Instructions, origLen);
> +   _mesa_free_instructions(vprog->Instructions, origLen);
>  
>     /* install new instructions */
> -   vprog->Base.Instructions = newInst;
> -   vprog->Base.NumInstructions = newLen;
> -   vprog->Base.InputsRead |= VERT_BIT_POS;
> -   vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
> +   vprog->Instructions = newInst;
> +   vprog->NumInstructions = newLen;
> +   vprog->InputsRead |= VERT_BIT_POS;
> +   vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
>  }
>  
>  
>  static void
> -_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
> +_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
>  {
>     struct prog_instruction *newInst;
> -   const GLuint origLen = vprog->Base.NumInstructions;
> +   const GLuint origLen = vprog->NumInstructions;
>     const GLuint newLen = origLen + 4;
>     GLuint hposTemp;
>     GLuint i;
> @@ -135,8 +134,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
>     GLint mvpRef[4];
>  
>     for (i = 0; i < 4; i++) {
> -      mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
> -                                            mvpState[i]);
> +      mvpRef[i] = _mesa_add_state_reference(vprog->Parameters, mvpState[i]);
>     }
>  
>     /* Alloc storage for new instructions */
> @@ -148,7 +146,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
>     }
>  
>     /* TEMP hposTemp; */
> -   hposTemp = vprog->Base.NumTemporaries++;
> +   hposTemp = vprog->NumTemporaries++;
>  
>     /*
>      * Generated instructions:
> @@ -202,21 +200,21 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
>  
>  
>     /* Append original instructions after new instructions */
> -   _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
> +   _mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
>  
>     /* free old instructions */
> -   _mesa_free_instructions(vprog->Base.Instructions, origLen);
> +   _mesa_free_instructions(vprog->Instructions, origLen);
>  
>     /* install new instructions */
> -   vprog->Base.Instructions = newInst;
> -   vprog->Base.NumInstructions = newLen;
> -   vprog->Base.InputsRead |= VERT_BIT_POS;
> -   vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
> +   vprog->Instructions = newInst;
> +   vprog->NumInstructions = newLen;
> +   vprog->InputsRead |= VERT_BIT_POS;
> +   vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
>  }
>  
>  
>  void
> -_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
> +_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog)
>  {
>     if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS)
>        _mesa_insert_mvp_dp4_code( ctx, vprog );
> diff --git a/src/mesa/program/programopt.h b/src/mesa/program/programopt.h
> index 1520d16..2a76da4 100644
> --- a/src/mesa/program/programopt.h
> +++ b/src/mesa/program/programopt.h
> @@ -35,7 +35,7 @@ extern "C" {
>  
>  
>  extern void
> -_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog);
> +_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog);
>  
>  extern void
>  _mesa_append_fog_code(struct gl_context *ctx,
> diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
> index dc4e143..573615e 100644
> --- a/src/mesa/state_tracker/st_atom.c
> +++ b/src/mesa/state_tracker/st_atom.c
> @@ -69,7 +69,7 @@ static void check_program_state( struct st_context *st )
>     struct st_geometry_program *old_gp = st->gp;
>     struct st_fragment_program *old_fp = st->fp;
>  
> -   struct gl_vertex_program *new_vp = ctx->VertexProgram._Current;
> +   struct gl_program *new_vp = ctx->VertexProgram._Current;
>     struct gl_program *new_tcp = ctx->TessCtrlProgram._Current;
>     struct gl_program *new_tep = ctx->TessEvalProgram._Current;
>     struct gl_program *new_gp = ctx->GeometryProgram._Current;
> @@ -122,7 +122,7 @@ static void check_attrib_edgeflag(struct st_context *st)
>  {
>     const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
>     GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
> -   struct gl_vertex_program *vp = st->ctx->VertexProgram._Current;
> +   struct gl_program *vp = st->ctx->VertexProgram._Current;
>  
>     if (!arrays)
>        return;
> diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
> index 74d18e3..bc9a156 100644
> --- a/src/mesa/state_tracker/st_atom_constbuf.c
> +++ b/src/mesa/state_tracker/st_atom_constbuf.c
> @@ -142,7 +142,7 @@ void st_upload_constants( struct st_context *st,
>  static void update_vs_constants(struct st_context *st )
>  {
>     struct st_vertex_program *vp = st->vp;
> -   struct gl_program_parameter_list *params = vp->Base.Base.Parameters;
> +   struct gl_program_parameter_list *params = vp->Base.Parameters;
>  
>     st_upload_constants( st, params, MESA_SHADER_VERTEX );
>  }
> diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
> index 1598f5e..e365a45 100644
> --- a/src/mesa/state_tracker/st_atom_rasterizer.c
> +++ b/src/mesa/state_tracker/st_atom_rasterizer.c
> @@ -62,7 +62,7 @@ static void update_raster_state( struct st_context *st )
>  {
>     struct gl_context *ctx = st->ctx;
>     struct pipe_rasterizer_state *raster = &st->state.rasterizer;
> -   const struct gl_vertex_program *vertProg = ctx->VertexProgram._Current;
> +   const struct gl_program *vertProg = ctx->VertexProgram._Current;
>     const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current;
>  
>     memset(raster, 0, sizeof(*raster));
> @@ -194,8 +194,8 @@ static void update_raster_state( struct st_context *st )
>     /* ST_NEW_VERTEX_PROGRAM
>      */
>     if (vertProg) {
> -      if (vertProg->Base.Id == 0) {
> -         if (vertProg->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
> +      if (vertProg->Id == 0) {
> +         if (vertProg->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
>              /* generated program which emits point size */
>              raster->point_size_per_vertex = TRUE;
>           }
> @@ -213,7 +213,7 @@ static void update_raster_state( struct st_context *st )
>           else if (ctx->TessEvalProgram._Current)
>              last = ctx->TessEvalProgram._Current;
>           else if (ctx->VertexProgram._Current)
> -            last = &ctx->VertexProgram._Current->Base;
> +            last = ctx->VertexProgram._Current;
>           if (last)
>              raster->point_size_per_vertex =
>                 !!(last->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ));
> diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
> index f170298..91baa59 100644
> --- a/src/mesa/state_tracker/st_atom_sampler.c
> +++ b/src/mesa/state_tracker/st_atom_sampler.c
> @@ -328,7 +328,7 @@ update_samplers(struct st_context *st)
>  
>     update_shader_samplers(st,
>                            PIPE_SHADER_VERTEX,
> -                          &ctx->VertexProgram._Current->Base,
> +                          ctx->VertexProgram._Current,
>                            ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
>                            st->state.samplers[PIPE_SHADER_VERTEX],
>                            &st->state.num_samplers[PIPE_SHADER_VERTEX]);
> diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
> index 02f789c..554e342 100644
> --- a/src/mesa/state_tracker/st_atom_shader.c
> +++ b/src/mesa/state_tracker/st_atom_shader.c
> @@ -175,7 +175,7 @@ update_vp( struct st_context *st )
>      */
>     assert(st->ctx->VertexProgram._Current);
>     stvp = st_vertex_program(st->ctx->VertexProgram._Current);
> -   assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
> +   assert(stvp->Base.Target == GL_VERTEX_PROGRAM_ARB);
>  
>     memset(&key, 0, sizeof key);
>     key.st = st->has_shareable_shaders ? NULL : st;
> @@ -190,7 +190,7 @@ update_vp( struct st_context *st )
>  
>     key.clamp_color = st->clamp_vert_color_in_shader &&
>                       st->ctx->Light._ClampVertexColor &&
> -                     (stvp->Base.Base.OutputsWritten &
> +                     (stvp->Base.OutputsWritten &
>                        (VARYING_SLOT_COL0 |
>                         VARYING_SLOT_COL1 |
>                         VARYING_SLOT_BFC0 |
> diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
> index df77a38..e4257dd 100644
> --- a/src/mesa/state_tracker/st_atom_texture.c
> +++ b/src/mesa/state_tracker/st_atom_texture.c
> @@ -207,7 +207,7 @@ update_vertex_textures(struct st_context *st)
>     if (ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits > 0) {
>        update_textures(st,
>                        MESA_SHADER_VERTEX,
> -                      &ctx->VertexProgram._Current->Base,
> +                      ctx->VertexProgram._Current,
>                        ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
>                        st->state.sampler_views[PIPE_SHADER_VERTEX],
>                        &st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
> diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
> index d624d9f..7f383eb 100644
> --- a/src/mesa/state_tracker/st_cb_feedback.c
> +++ b/src/mesa/state_tracker/st_cb_feedback.c
> @@ -292,7 +292,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
>        vbo_set_draw_func(ctx, st_feedback_draw_vbo);
>     }
>     else {
> -      struct gl_vertex_program *vp = st->ctx->VertexProgram._Current;
> +      struct gl_program *vp = st->ctx->VertexProgram._Current;
>  
>        if (!st->feedback_stage)
>           st->feedback_stage = draw_glfeedback_stage(ctx, draw);
> diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
> index 6dce2f6..fb0bdd2 100644
> --- a/src/mesa/state_tracker/st_cb_program.c
> +++ b/src/mesa/state_tracker/st_cb_program.c
> @@ -59,7 +59,7 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
>     switch (target) {
>     case GL_VERTEX_PROGRAM_ARB: {
>        struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program);
> -      return _mesa_init_gl_program(&prog->Base.Base, target, id);
> +      return _mesa_init_gl_program(&prog->Base, target, id);
>     }
>     case GL_FRAGMENT_PROGRAM_ARB: {
>        struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
> diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
> index b51f350..1e5bbba 100644
> --- a/src/mesa/state_tracker/st_debug.c
> +++ b/src/mesa/state_tracker/st_debug.c
> @@ -98,8 +98,8 @@ st_print_current(void)
>  
>     if (st->vp->variants)
>        tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
> -   if (st->vp->Base.Base.Parameters)
> -      _mesa_print_parameter_list(st->vp->Base.Base.Parameters);
> +   if (st->vp->Base.Parameters)
> +      _mesa_print_parameter_list(st->vp->Base.Parameters);
>  
>     tgsi_dump(st->fp->tgsi.tokens, 0);
>     if (st->fp->Base.Base.Parameters)
> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
> index 9f90f6b..e671e12 100644
> --- a/src/mesa/state_tracker/st_program.c
> +++ b/src/mesa/state_tracker/st_program.c
> @@ -250,11 +250,11 @@ st_translate_vertex_program(struct st_context *st,
>      * and TGSI generic input indexes, plus input attrib semantic info.
>      */
>     for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
> -      if ((stvp->Base.Base.InputsRead & BITFIELD64_BIT(attr)) != 0) {
> +      if ((stvp->Base.InputsRead & BITFIELD64_BIT(attr)) != 0) {
>           input_to_index[attr] = stvp->num_inputs;
>           stvp->index_to_input[stvp->num_inputs] = attr;
>           stvp->num_inputs++;
> -         if ((stvp->Base.Base.DoubleInputsRead & BITFIELD64_BIT(attr)) != 0) {
> +         if ((stvp->Base.DoubleInputsRead & BITFIELD64_BIT(attr)) != 0) {
>              /* add placeholder for second part of a double attribute */
>              stvp->index_to_input[stvp->num_inputs] = ST_DOUBLE_ATTRIB_PLACEHOLDER;
>              stvp->num_inputs++;
> @@ -268,7 +268,7 @@ st_translate_vertex_program(struct st_context *st,
>     /* Compute mapping of vertex program outputs to slots.
>      */
>     for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
> -      if ((stvp->Base.Base.OutputsWritten & BITFIELD64_BIT(attr)) == 0) {
> +      if ((stvp->Base.OutputsWritten & BITFIELD64_BIT(attr)) == 0) {
>           stvp->result_to_output[attr] = ~0;
>        }
>        else {
> @@ -367,7 +367,7 @@ st_translate_vertex_program(struct st_context *st,
>  
>     /* ARB_vp: */
>     if (!stvp->glsl_to_tgsi && !stvp->shader_program) {
> -      _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT);
> +      _mesa_remove_output_reads(&stvp->Base, PROGRAM_OUTPUT);
>  
>        /* This determines which states will be updated when the assembly
>         * shader is bound.
> @@ -376,15 +376,14 @@ st_translate_vertex_program(struct st_context *st,
>                                ST_NEW_RASTERIZER |
>                                ST_NEW_VERTEX_ARRAYS;
>  
> -      if (stvp->Base.Base.Parameters->NumParameters)
> +      if (stvp->Base.Parameters->NumParameters)
>           stvp->affected_states |= ST_NEW_VS_CONSTANTS;
>  
>        /* No samplers are allowed in ARB_vp. */
>     }
>  
>     if (stvp->shader_program) {
> -      nir_shader *nir = st_glsl_to_nir(st, &stvp->Base.Base,
> -                                       stvp->shader_program,
> +      nir_shader *nir = st_glsl_to_nir(st, &stvp->Base, stvp->shader_program,
>                                         MESA_SHADER_VERTEX);
>  
>        stvp->tgsi.type = PIPE_SHADER_IR_NIR;
> @@ -400,16 +399,16 @@ st_translate_vertex_program(struct st_context *st,
>     if (ureg == NULL)
>        return false;
>  
> -   if (stvp->Base.Base.ClipDistanceArraySize)
> +   if (stvp->Base.ClipDistanceArraySize)
>        ureg_property(ureg, TGSI_PROPERTY_NUM_CLIPDIST_ENABLED,
> -                    stvp->Base.Base.ClipDistanceArraySize);
> -   if (stvp->Base.Base.CullDistanceArraySize)
> +                    stvp->Base.ClipDistanceArraySize);
> +   if (stvp->Base.CullDistanceArraySize)
>        ureg_property(ureg, TGSI_PROPERTY_NUM_CULLDIST_ENABLED,
> -                    stvp->Base.Base.CullDistanceArraySize);
> +                    stvp->Base.CullDistanceArraySize);
>  
>     if (ST_DEBUG & DEBUG_MESA) {
> -      _mesa_print_program(&stvp->Base.Base);
> -      _mesa_print_program_parameters(st->ctx, &stvp->Base.Base);
> +      _mesa_print_program(&stvp->Base);
> +      _mesa_print_program_parameters(st->ctx, &stvp->Base);
>        debug_printf("\n");
>     }
>  
> @@ -418,7 +417,7 @@ st_translate_vertex_program(struct st_context *st,
>                                     PIPE_SHADER_VERTEX,
>                                     ureg,
>                                     stvp->glsl_to_tgsi,
> -                                   &stvp->Base.Base,
> +                                   &stvp->Base,
>                                     /* inputs */
>                                     stvp->num_inputs,
>                                     input_to_index,
> @@ -444,7 +443,7 @@ st_translate_vertex_program(struct st_context *st,
>        error = st_translate_mesa_program(st->ctx,
>                                          PIPE_SHADER_VERTEX,
>                                          ureg,
> -                                        &stvp->Base.Base,
> +                                        &stvp->Base,
>                                          /* inputs */
>                                          stvp->num_inputs,
>                                          input_to_index,
> @@ -459,7 +458,7 @@ st_translate_vertex_program(struct st_context *st,
>  
>     if (error) {
>        debug_printf("%s: failed to translate Mesa program:\n", __func__);
> -      _mesa_print_program(&stvp->Base.Base);
> +      _mesa_print_program(&stvp->Base);
>        debug_assert(0);
>        return false;
>     }
> @@ -489,7 +488,7 @@ st_create_vp_variant(struct st_context *st,
>        if (key->passthrough_edgeflags)
>           NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_passthrough_edgeflags);
>  
> -      st_finalize_nir(st, &stvp->Base.Base, vpv->tgsi.ir.nir);
> +      st_finalize_nir(st, &stvp->Base, vpv->tgsi.ir.nir);
>  
>        vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
>        /* driver takes ownership of IR: */
> @@ -1913,7 +1912,7 @@ st_print_current_vertex_program(void)
>           (struct st_vertex_program *) ctx->VertexProgram._Current;
>        struct st_vp_variant *stv;
>  
> -      debug_printf("Vertex program %u\n", stvp->Base.Base.Id);
> +      debug_printf("Vertex program %u\n", stvp->Base.Id);
>  
>        for (stv = stvp->variants; stv; stv = stv->next) {
>           debug_printf("variant %p\n", stv);
> diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
> index ab01d7b..0263c8e 100644
> --- a/src/mesa/state_tracker/st_program.h
> +++ b/src/mesa/state_tracker/st_program.h
> @@ -201,7 +201,7 @@ struct st_vp_variant
>   */
>  struct st_vertex_program
>  {
> -   struct gl_vertex_program Base;  /**< The Mesa vertex program */
> +   struct gl_program Base;  /**< The Mesa vertex 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 */
> @@ -309,7 +309,7 @@ st_fragment_program( struct gl_fragment_program *fp )
>  
>  
>  static inline struct st_vertex_program *
> -st_vertex_program( struct gl_vertex_program *vp )
> +st_vertex_program( struct gl_program *vp )
>  {
>     return (struct st_vertex_program *)vp;
>  }
> diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
> index b5c0b3e..3810043 100644
> --- a/src/mesa/tnl/t_context.c
> +++ b/src/mesa/tnl/t_context.c
> @@ -131,7 +131,7 @@ void
>  _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
>  {
>     TNLcontext *tnl = TNL_CONTEXT(ctx);
> -   const struct gl_vertex_program *vp = ctx->VertexProgram._Current;
> +   const struct gl_program *vp = ctx->VertexProgram._Current;
>     const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
>     GLuint i;
>  
> @@ -183,7 +183,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
>     if (vp) {
>        GLuint i;
>        for (i = 0; i < MAX_VARYING; i++) {
> -	 if (vp->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
> +	 if (vp->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
>              tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i));
>           }
>        }
> diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
> index 55c44d1..c0a48a0 100644
> --- a/src/mesa/tnl/t_vb_program.c
> +++ b/src/mesa/tnl/t_vb_program.c
> @@ -237,7 +237,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
>     machine->FetchTexelLod = vp_fetch_texel;
>     machine->FetchTexelDeriv = NULL; /* not used by vertex programs */
>  
> -   machine->Samplers = ctx->VertexProgram._Current->Base.SamplerUnits;
> +   machine->Samplers = ctx->VertexProgram._Current->SamplerUnits;
>  
>     machine->SystemValues[SYSTEM_VALUE_INSTANCE_ID][0] = (GLfloat) instID;
>  }
> @@ -247,12 +247,12 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
>   * Map the texture images which the vertex program will access (if any).
>   */
>  static void
> -map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
> +map_textures(struct gl_context *ctx, const struct gl_program *vp)
>  {
>     GLuint u;
>  
>     for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
> -      if (vp->Base.TexturesUsed[u]) {
> +      if (vp->TexturesUsed[u]) {
>           /* Note: _Current *should* correspond to the target indicated
>            * in TexturesUsed[u].
>            */
> @@ -266,12 +266,12 @@ map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
>   * Unmap the texture images which were used by the vertex program (if any).
>   */
>  static void
> -unmap_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
> +unmap_textures(struct gl_context *ctx, const struct gl_program *vp)
>  {
>     GLuint u;
>  
>     for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
> -      if (vp->Base.TexturesUsed[u]) {
> +      if (vp->TexturesUsed[u]) {
>           /* Note: _Current *should* correspond to the target indicated
>            * in TexturesUsed[u].
>            */
> @@ -290,7 +290,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
>     TNLcontext *tnl = TNL_CONTEXT(ctx);
>     struct vp_stage_data *store = VP_STAGE_DATA(stage);
>     struct vertex_buffer *VB = &tnl->vb;
> -   struct gl_vertex_program *program = ctx->VertexProgram._Current;
> +   struct gl_program *program = ctx->VertexProgram._Current;
>     struct gl_program_machine *machine = &store->machine;
>     GLuint outputs[VARYING_SLOT_MAX], numOutputs;
>     GLuint i, j;
> @@ -299,12 +299,12 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
>        return GL_TRUE;
>  
>     /* ARB program or vertex shader */
> -   _mesa_load_state_parameters(ctx, program->Base.Parameters);
> +   _mesa_load_state_parameters(ctx, program->Parameters);
>  
>     /* make list of outputs to save some time below */
>     numOutputs = 0;
>     for (i = 0; i < VARYING_SLOT_MAX; i++) {
> -      if (program->Base.OutputsWritten & BITFIELD64_BIT(i)) {
> +      if (program->OutputsWritten & BITFIELD64_BIT(i)) {
>           outputs[numOutputs++] = i;
>        }
>     }
> @@ -347,7 +347,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
>  
>        /* the vertex array case */
>        for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
> -	 if (program->Base.InputsRead & BITFIELD64_BIT(attr)) {
> +	 if (program->InputsRead & BITFIELD64_BIT(attr)) {
>  	    const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data;
>  	    const GLuint size = VB->AttribPtr[attr]->size;
>  	    const GLuint stride = VB->AttribPtr[attr]->stride;
> @@ -363,7 +363,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
>        }
>  
>        /* execute the program */
> -      _mesa_execute_program(ctx, &program->Base, machine);
> +      _mesa_execute_program(ctx, program, machine);
>  
>        /* copy the output registers into the VB->attribs arrays */
>        for (j = 0; j < numOutputs; j++) {
> @@ -378,7 +378,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
>        }
>  
>        /* FOGC is a special case.  Fragment shader expects (f,0,0,1) */
> -      if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_FOGC)) {
> +      if (program->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_FOGC)) {
>           store->results[VARYING_SLOT_FOGC].data[i][1] = 0.0;
>           store->results[VARYING_SLOT_FOGC].data[i][2] = 0.0;
>           store->results[VARYING_SLOT_FOGC].data[i][3] = 1.0;
> @@ -443,7 +443,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
>     }
>  
>     for (i = 0; i < ctx->Const.MaxVarying; i++) {
> -      if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
> +      if (program->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
>           /* Note: varying results get put into the generic attributes */
>  	 VB->AttribPtr[VERT_ATTRIB_GENERIC0+i]
>              = &store->results[VARYING_SLOT_VAR0 + i];
> diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
> index 4728c70..18d105f 100644
> --- a/src/mesa/tnl/t_vp_build.c
> +++ b/src/mesa/tnl/t_vp_build.c
> @@ -40,7 +40,7 @@
>   */
>  void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
>  {
> -   const struct gl_vertex_program *prev = ctx->VertexProgram._Current;
> +   const struct gl_program *prev = ctx->VertexProgram._Current;
>  
>     if (!ctx->VertexProgram._Current ||
>         ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
> @@ -54,6 +54,6 @@ void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
>      */
>     if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) {
>        ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
> -                            (struct gl_program *) ctx->VertexProgram._Current);
> +                              ctx->VertexProgram._Current);
>     }
>  }
> diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
> index 0ae879b..19114da 100644
> --- a/src/mesa/vbo/vbo_exec_draw.c
> +++ b/src/mesa/vbo/vbo_exec_draw.c
> @@ -211,8 +211,8 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
>         * glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
>         * The original state gets essentially restored below.
>         */
> -      if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 &&
> -          (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
> +      if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 &&
> +          (ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) {
>           swap_pos = true;
>           exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0];
>           exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0];
> diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
> index 507ab82..cb68e1d 100644
> --- a/src/mesa/vbo/vbo_save_draw.c
> +++ b/src/mesa/vbo/vbo_save_draw.c
> @@ -174,8 +174,8 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
>         * In that case we effectively need to route the data from
>         * glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
>         */
> -      if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 &&
> -          (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
> +      if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 &&
> +          (ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) {
>           save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0];
>           node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0];
>           node_attrtype[VERT_ATTRIB_GENERIC0] = node_attrtype[0];
> 



More information about the mesa-dev mailing list