minor clean-ups, simplifications and new comments
[mesa.git] / src / mesa / shader / nvprogram.c
index 3a5c053b31148289853ff5a1faa06b8217474aaf..0e9a01dcab8fec96eda7533bfa8dca670d11e015 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  6.5.2
  *
  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
@@ -70,18 +70,14 @@ _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM);
 
-   vprog = (struct gl_vertex_program *)
-      _mesa_HashLookup(ctx->Shared->Programs, id);
+   vprog = (struct gl_vertex_program *) _mesa_lookup_program(ctx, id);
 
    if (!vprog || vprog->Base.Target != GL_VERTEX_STATE_PROGRAM_NV) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glExecuteProgramNV");
       return;
    }
    
-   _mesa_init_vp_per_vertex_registers(ctx);
-   _mesa_init_vp_per_primitive_registers(ctx);
-   COPY_4V(ctx->VertexProgram.Inputs[VERT_ATTRIB_POS], params);
-   _mesa_exec_vertex_program(ctx, vprog);
+   _mesa_exec_vertex_state_program(ctx, vprog, params);
 }
 
 
@@ -90,8 +86,9 @@ _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
  * \note Not compiled into display lists.
  * \note Called from the GL API dispatcher.
  */
-GLboolean GLAPIENTRY _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
-                                      GLboolean *residences)
+GLboolean GLAPIENTRY
+_mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
+                            GLboolean *residences)
 {
    GLint i, j;
    GLboolean allResident = GL_TRUE;
@@ -109,8 +106,7 @@ GLboolean GLAPIENTRY _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
          _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
          return GL_FALSE;
       }
-      prog = (const struct gl_program *)
-         _mesa_HashLookup(ctx->Shared->Programs, ids[i]);
+      prog = _mesa_lookup_program(ctx, ids[i]);
       if (!prog) {
          _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
          return GL_FALSE;
@@ -158,7 +154,7 @@ _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids)
          return;
       }
 
-      prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]);
+      prog = _mesa_lookup_program(ctx, ids[i]);
       if (!prog) {
          _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)");
          return;
@@ -254,7 +250,7 @@ _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params)
    if (!ctx->_CurrentProgram)
       ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
+   prog = _mesa_lookup_program(ctx, id);
    if (!prog) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramivNV");
       return;
@@ -296,7 +292,7 @@ _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program)
       return;
    }
 
-   prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
+   prog = _mesa_lookup_program(ctx, id);
    if (!prog) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramStringNV");
       return;
@@ -522,7 +518,7 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM);
 
-   prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
+   prog = _mesa_lookup_program(ctx, id);
 
    if (prog && prog->Target != 0 && prog->Target != target) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target)");
@@ -686,7 +682,7 @@ _mesa_ProgramParameters4fvNV(GLenum target, GLuint index,
       for (i = 0; i < num; i++) {
          COPY_4V(ctx->VertexProgram.Parameters[index + i], params);
          params += 4;
-      };
+      }
    }
    else {
       _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4fvNV");
@@ -773,7 +769,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM);
 
-   prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
+   prog = _mesa_lookup_program(ctx, id);
    if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramNamedParameterNV");
       return;
@@ -839,7 +835,7 @@ _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name,
    if (!ctx->_CurrentProgram)
       ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   prog = (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
+   prog = _mesa_lookup_program(ctx, id);
    if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramNamedParameterNV");
       return;