[Mesa-dev] [PATCH 08/19] mesa: Remove support for NV_vertex_program's tracked matrices.

Eric Anholt eric at anholt.net
Tue Oct 9 18:06:40 PDT 2012


---
 src/mesa/main/api_exec.c          |    2 -
 src/mesa/main/dlist.c             |   27 ----------
 src/mesa/main/matrix.c            |   16 ------
 src/mesa/main/mtypes.h            |    4 --
 src/mesa/main/nvprogram.c         |  108 -------------------------------------
 src/mesa/main/nvprogram.h         |    7 ---
 src/mesa/program/prog_statevars.c |   91 -------------------------------
 src/mesa/program/prog_statevars.h |    3 --
 src/mesa/program/program.c        |    6 ---
 src/mesa/tnl/t_vb_program.c       |    9 +---
 src/mesa/tnl/tnl.h                |    3 --
 11 files changed, 2 insertions(+), 274 deletions(-)

diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index f42da94..ce7dfa4 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -484,7 +484,6 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
       SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
       SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
-      SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
       SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
       SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
       SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
@@ -496,7 +495,6 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);  /* alias to ProgramParameter4fvNV */
       SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
       SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
-      SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
       SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
       /* glVertexAttrib*NV functions handled in api_loopback.c */
    }
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 9951912..ea158e4 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -324,7 +324,6 @@ typedef enum
    OPCODE_EXECUTE_PROGRAM_NV,
    OPCODE_REQUEST_RESIDENT_PROGRAMS_NV,
    OPCODE_LOAD_PROGRAM_NV,
-   OPCODE_TRACK_MATRIX_NV,
    /* GL_NV_fragment_program */
    OPCODE_PROGRAM_LOCAL_PARAMETER_ARB,
    OPCODE_PROGRAM_NAMED_PARAMETER_NV,
@@ -5037,27 +5036,6 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
    }
 }
 
-
-static void GLAPIENTRY
-save_TrackMatrixNV(GLenum target, GLuint address,
-                   GLenum matrix, GLenum transform)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   Node *n;
-   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 4);
-   if (n) {
-      n[1].e = target;
-      n[2].ui = address;
-      n[3].e = matrix;
-      n[4].e = transform;
-   }
-   if (ctx->ExecuteFlag) {
-      CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform));
-   }
-}
-
-
 /*
  * GL_NV_fragment_program
  */
@@ -8394,9 +8372,6 @@ execute_list(struct gl_context *ctx, GLuint list)
             CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
                                            (const GLubyte *) n[4].data));
             break;
-         case OPCODE_TRACK_MATRIX_NV:
-            CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
-            break;
          case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
             CALL_ProgramLocalParameter4fARB(ctx->Exec,
                                             (n[1].e, n[2].ui, n[3].f, n[4].f,
@@ -10246,7 +10221,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
    SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
    SET_GetProgramivNV(table, _mesa_GetProgramivNV);
    SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
-   SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
    SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
    SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
    SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
@@ -10259,7 +10233,6 @@ _mesa_create_save_table(const struct gl_context *ctx)
    SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
    SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
    SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
-   SET_TrackMatrixNV(table, save_TrackMatrixNV);
    SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
 
    /* 244. GL_ATI_envmap_bumpmap */
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 76f5ea7..4a329c66 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -179,22 +179,6 @@ _mesa_MatrixMode( GLenum mode )
       ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack));
       ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
       break;
-   case GL_MATRIX0_NV:
-   case GL_MATRIX1_NV:
-   case GL_MATRIX2_NV:
-   case GL_MATRIX3_NV:
-   case GL_MATRIX4_NV:
-   case GL_MATRIX5_NV:
-   case GL_MATRIX6_NV:
-   case GL_MATRIX7_NV:
-      if (ctx->API == API_OPENGL && ctx->Extensions.NV_vertex_program) {
-         ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV];
-      }
-      else {
-         _mesa_error( ctx,  GL_INVALID_ENUM, "glMatrixMode(mode)" );
-         return;
-      }
-      break;
    case GL_MATRIX0_ARB:
    case GL_MATRIX1_ARB:
    case GL_MATRIX2_ARB:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 40a802f..b65c64f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2060,10 +2060,6 @@ struct gl_vertex_program_state
 
    GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
 
-   /* For GL_NV_vertex_program only: */
-   GLenum TrackMatrix[MAX_PROGRAM_ENV_PARAMS / 4];
-   GLenum TrackMatrixTransform[MAX_PROGRAM_ENV_PARAMS / 4];
-
    /** Should fixed-function T&L be implemented with a vertex prog? */
    GLboolean _MaintainTnlProgram;
 
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c
index b91c712..ac3d909 100644
--- a/src/mesa/main/nvprogram.c
+++ b/src/mesa/main/nvprogram.c
@@ -304,49 +304,6 @@ _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
    }
 }
 
-
-/**
- * Get matrix tracking information.
- * \note Not compiled into display lists.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_GetTrackMatrixivNV(GLenum target, GLuint address,
-                         GLenum pname, GLint *params)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   if (target == GL_VERTEX_PROGRAM_NV
-       && ctx->Extensions.NV_vertex_program) {
-      GLuint i;
-
-      if ((address & 0x3) || address >= MAX_NV_VERTEX_PROGRAM_PARAMS) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glGetTrackMatrixivNV(address)");
-         return;
-      }
-
-      i = address / 4;
-
-      switch (pname) {
-         case GL_TRACK_MATRIX_NV:
-            params[0] = (GLint) ctx->VertexProgram.TrackMatrix[i];
-            return;
-         case GL_TRACK_MATRIX_TRANSFORM_NV:
-            params[0] = (GLint) ctx->VertexProgram.TrackMatrixTransform[i];
-            return;
-         default:
-            _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV");
-            return;
-      }
-   }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV");
-      return;
-   }
-}
-
-
 /**
  * Get a vertex (or vertex array) attribute.
  * \note Not compiled into display lists.
@@ -717,71 +674,6 @@ _mesa_ProgramParameters4fvNV(GLenum target, GLuint index,
 }
 
 
-
-/**
- * Setup tracking of matrices into program parameter registers.
- * \note Called from the GL API dispatcher.
- */
-void GLAPIENTRY
-_mesa_TrackMatrixNV(GLenum target, GLuint address,
-                    GLenum matrix, GLenum transform)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END(ctx);
-
-   FLUSH_VERTICES(ctx, _NEW_PROGRAM);
-
-   if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) {
-      if (address & 0x3) {
-         /* addr must be multiple of four */
-         _mesa_error(ctx, GL_INVALID_VALUE, "glTrackMatrixNV(address)");
-         return;
-      }
-
-      switch (matrix) {
-         case GL_NONE:
-         case GL_MODELVIEW:
-         case GL_PROJECTION:
-         case GL_TEXTURE:
-         case GL_COLOR:
-         case GL_MODELVIEW_PROJECTION_NV:
-         case GL_MATRIX0_NV:
-         case GL_MATRIX1_NV:
-         case GL_MATRIX2_NV:
-         case GL_MATRIX3_NV:
-         case GL_MATRIX4_NV:
-         case GL_MATRIX5_NV:
-         case GL_MATRIX6_NV:
-         case GL_MATRIX7_NV:
-            /* OK, fallthrough */
-            break;
-         default:
-            _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(matrix)");
-            return;
-      }
-
-      switch (transform) {
-         case GL_IDENTITY_NV:
-         case GL_INVERSE_NV:
-         case GL_TRANSPOSE_NV:
-         case GL_INVERSE_TRANSPOSE_NV:
-            /* OK, fallthrough */
-            break;
-         default:
-            _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(transform)");
-            return;
-      }
-
-      ctx->VertexProgram.TrackMatrix[address / 4] = matrix;
-      ctx->VertexProgram.TrackMatrixTransform[address / 4] = transform;
-   }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(target)");
-      return;
-   }
-}
-
-
 void GLAPIENTRY
 _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
                                 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
diff --git a/src/mesa/main/nvprogram.h b/src/mesa/main/nvprogram.h
index fc579a9..970f434 100644
--- a/src/mesa/main/nvprogram.h
+++ b/src/mesa/main/nvprogram.h
@@ -56,9 +56,6 @@ extern void GLAPIENTRY
 _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program);
 
 extern void GLAPIENTRY
-_mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
 _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params);
 
 extern void GLAPIENTRY
@@ -82,10 +79,6 @@ _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLsizei num,
                              const GLfloat *params);
 
 extern void GLAPIENTRY
-_mesa_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform);
-
-
-extern void GLAPIENTRY
 _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
                                 GLfloat x, GLfloat y, GLfloat z, GLfloat w);
 
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index f9c6677..5a35079 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -1074,94 +1074,3 @@ _mesa_load_state_parameters(struct gl_context *ctx,
       }
    }
 }
-
-
-/**
- * Copy the 16 elements of a matrix into four consecutive program
- * registers starting at 'pos'.
- */
-static void
-load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16])
-{
-   GLuint i;
-   for (i = 0; i < 4; i++) {
-      registers[pos + i][0] = mat[0 + i];
-      registers[pos + i][1] = mat[4 + i];
-      registers[pos + i][2] = mat[8 + i];
-      registers[pos + i][3] = mat[12 + i];
-   }
-}
-
-
-/**
- * As above, but transpose the matrix.
- */
-static void
-load_transpose_matrix(GLfloat registers[][4], GLuint pos,
-                      const GLfloat mat[16])
-{
-   memcpy(registers[pos], mat, 16 * sizeof(GLfloat));
-}
-
-
-/**
- * Load current vertex program's parameter registers with tracked
- * matrices (if NV program).  This only needs to be done per
- * glBegin/glEnd, not per-vertex.
- */
-void
-_mesa_load_tracked_matrices(struct gl_context *ctx)
-{
-   GLuint i;
-
-   for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
-      /* point 'mat' at source matrix */
-      GLmatrix *mat;
-      if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) {
-         mat = ctx->ModelviewMatrixStack.Top;
-      }
-      else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) {
-         mat = ctx->ProjectionMatrixStack.Top;
-      }
-      else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) {
-         GLuint unit = MIN2(ctx->Texture.CurrentUnit,
-                            Elements(ctx->TextureMatrixStack) - 1);
-         mat = ctx->TextureMatrixStack[unit].Top;
-      }
-      else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) {
-         /* XXX verify the combined matrix is up to date */
-         mat = &ctx->_ModelProjectMatrix;
-      }
-      else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV &&
-               ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) {
-         GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV;
-         ASSERT(n < Elements(ctx->ProgramMatrixStack));
-         mat = ctx->ProgramMatrixStack[n].Top;
-      }
-      else {
-         /* no matrix is tracked, but we leave the register values as-is */
-         assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE);
-         continue;
-      }
-
-      /* load the matrix values into sequential registers */
-      if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) {
-         load_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
-      }
-      else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) {
-         _math_matrix_analyse(mat); /* update the inverse */
-         ASSERT(!_math_matrix_is_dirty(mat));
-         load_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
-      }
-      else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) {
-         load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
-      }
-      else {
-         assert(ctx->VertexProgram.TrackMatrixTransform[i]
-                == GL_INVERSE_TRANSPOSE_NV);
-         _math_matrix_analyse(mat); /* update the inverse */
-         ASSERT(!_math_matrix_is_dirty(mat));
-         load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
-      }
-   }
-}
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
index efd0e03..af2c897 100644
--- a/src/mesa/program/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
@@ -146,9 +146,6 @@ extern char *
 _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
 
 
-extern void
-_mesa_load_tracked_matrices(struct gl_context *ctx);
-
 
 #ifdef __cplusplus
 }
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 30f8377..6e767b6 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -52,8 +52,6 @@ struct gl_program _mesa_DummyProgram;
 void
 _mesa_init_program(struct gl_context *ctx)
 {
-   GLuint i;
-
    /*
     * If this assertion fails, we need to increase the field
     * size for register indexes (see INST_INDEX_BITS).
@@ -90,10 +88,6 @@ _mesa_init_program(struct gl_context *ctx)
    _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
                             ctx->Shared->DefaultVertexProgram);
    assert(ctx->VertexProgram.Current);
-   for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
-      ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
-      ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
-   }
    ctx->VertexProgram.Cache = _mesa_new_program_cache();
 
    ctx->FragmentProgram.Enabled = GL_FALSE;
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index f2e7611..61ccece 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -321,13 +321,8 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
    if (!program)
       return GL_TRUE;
 
-   if (program->IsNVProgram) {
-      _mesa_load_tracked_matrices(ctx);
-   }
-   else {
-      /* ARB program or vertex shader */
-      _mesa_load_state_parameters(ctx, program->Base.Parameters);
-   }
+   /* ARB program or vertex shader */
+   _mesa_load_state_parameters(ctx, program->Base.Parameters);
 
    /* make list of outputs to save some time below */
    numOutputs = 0;
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index f6b70e3..9583228 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -95,9 +95,6 @@ _tnl_vbo_draw_prims( struct gl_context *ctx,
 		     struct gl_transform_feedback_object *tfb_vertcount );
 
 extern void
-_mesa_load_tracked_matrices(struct gl_context *ctx);
-
-extern void
 _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);
 
 extern void
-- 
1.7.10.4



More information about the mesa-dev mailing list