mesa: Standardize names of OpenGL functions.
[mesa.git] / src / mesa / main / arbprogram.c
index 4af9fe4d31775818448cf580f8def1e97755f67b..8150b5f4ec1ddedd2b5468c4f5c3b536e1e37d6d 100644 (file)
 #include "main/mtypes.h"
 #include "main/arbprogram.h"
 #include "program/arbprogparse.h"
-#include "program/nvfragparse.h"
 #include "program/program.h"
 
 
-
-/**
- * Mixing ARB and NV vertex/fragment programs can be tricky.
- * Note: GL_VERTEX_PROGRAM_ARB == GL_VERTEX_PROGRAM_NV
- *  but, GL_FRAGMENT_PROGRAM_ARB != GL_FRAGMENT_PROGRAM_NV
- * The two different fragment program targets are supposed to be compatible
- * to some extent (see GL_ARB_fragment_program spec).
- * This function does the compatibility check.
- */
-static GLboolean
-compatible_program_targets(GLenum t1, GLenum t2)
-{
-   if (t1 == t2)
-      return GL_TRUE;
-   if (t1 == GL_FRAGMENT_PROGRAM_ARB && t2 == GL_FRAGMENT_PROGRAM_NV)
-      return GL_TRUE;
-   if (t1 == GL_FRAGMENT_PROGRAM_NV && t2 == GL_FRAGMENT_PROGRAM_ARB)
-      return GL_TRUE;
-   return GL_FALSE;
-}
-
-
 /**
  * Bind a program (make it current)
  * \note Called from the GL API dispatcher by both glBindProgramNV
  * and glBindProgramARB.
  */
 void GLAPIENTRY
-_mesa_BindProgram(GLenum target, GLuint id)
+_mesa_BindProgramARB(GLenum target, GLuint id)
 {
    struct gl_program *curProg, *newProg;
    GET_CURRENT_CONTEXT(ctx);
@@ -79,14 +56,12 @@ _mesa_BindProgram(GLenum target, GLuint id)
    if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
       curProg = &ctx->VertexProgram.Current->Base;
    }
-   else if ((target == GL_FRAGMENT_PROGRAM_NV
-             && ctx->Extensions.NV_fragment_program) ||
-            (target == GL_FRAGMENT_PROGRAM_ARB
-             && ctx->Extensions.ARB_fragment_program)) {
+   else if (target == GL_FRAGMENT_PROGRAM_ARB
+            && ctx->Extensions.ARB_fragment_program) {
       curProg = &ctx->FragmentProgram.Current->Base;
    }
    else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV/ARB(target)");
+      _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramARB(target)");
       return;
    }
 
@@ -98,7 +73,7 @@ _mesa_BindProgram(GLenum target, GLuint id)
    if (id == 0) {
       /* Bind a default program */
       newProg = NULL;
-      if (target == GL_VERTEX_PROGRAM_ARB) /* == GL_VERTEX_PROGRAM_NV */
+      if (target == GL_VERTEX_PROGRAM_ARB)
          newProg = &ctx->Shared->DefaultVertexProgram->Base;
       else
          newProg = &ctx->Shared->DefaultFragmentProgram->Base;
@@ -110,14 +85,14 @@ _mesa_BindProgram(GLenum target, GLuint id)
          /* allocate a new program now */
          newProg = ctx->Driver.NewProgram(ctx, target, id);
          if (!newProg) {
-            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV/ARB");
+            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB");
             return;
          }
          _mesa_HashInsert(ctx->Shared->Programs, id, newProg);
       }
-      else if (!compatible_program_targets(newProg->Target, target)) {
+      else if (newProg->Target != target) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glBindProgramNV/ARB(target mismatch)");
+                     "glBindProgramARB(target mismatch)");
          return;
       }
    }
@@ -133,12 +108,11 @@ _mesa_BindProgram(GLenum target, GLuint id)
    FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
 
    /* bind newProg */
-   if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */
+   if (target == GL_VERTEX_PROGRAM_ARB) {
       _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
                                gl_vertex_program(newProg));
    }
-   else if (target == GL_FRAGMENT_PROGRAM_NV ||
-            target == GL_FRAGMENT_PROGRAM_ARB) {
+   else if (target == GL_FRAGMENT_PROGRAM_ARB) {
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
                                gl_fragment_program(newProg));
    }
@@ -158,7 +132,7 @@ _mesa_BindProgram(GLenum target, GLuint id)
  * \note Called by both glDeleteProgramsNV and glDeleteProgramsARB.
  */
 void GLAPIENTRY 
-_mesa_DeletePrograms(GLsizei n, const GLuint *ids)
+_mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
 {
    GLint i;
    GET_CURRENT_CONTEXT(ctx);
@@ -178,20 +152,18 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids)
          else if (prog) {
             /* Unbind program if necessary */
             switch (prog->Target) {
-            case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
-            case GL_VERTEX_STATE_PROGRAM_NV:
+            case GL_VERTEX_PROGRAM_ARB:
                if (ctx->VertexProgram.Current &&
                    ctx->VertexProgram.Current->Base.Id == ids[i]) {
                   /* unbind this currently bound program */
-                  _mesa_BindProgram(prog->Target, 0);
+                  _mesa_BindProgramARB(prog->Target, 0);
                }
                break;
-            case GL_FRAGMENT_PROGRAM_NV:
             case GL_FRAGMENT_PROGRAM_ARB:
                if (ctx->FragmentProgram.Current &&
                    ctx->FragmentProgram.Current->Base.Id == ids[i]) {
                   /* unbind this currently bound program */
-                  _mesa_BindProgram(prog->Target, 0);
+                  _mesa_BindProgramARB(prog->Target, 0);
                }
                break;
             default:
@@ -213,7 +185,7 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids)
  * \note Called by both glGenProgramsNV and glGenProgramsARB.
  */
 void GLAPIENTRY
-_mesa_GenPrograms(GLsizei n, GLuint *ids)
+_mesa_GenProgramsARB(GLsizei n, GLuint *ids)
 {
    GLuint first;
    GLuint i;
@@ -283,11 +255,6 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
       prog = &(ctx->FragmentProgram.Current->Base);
       maxParams = ctx->Const.FragmentProgram.MaxLocalParams;
    }
-   else if (target == GL_FRAGMENT_PROGRAM_NV
-            && ctx->Extensions.NV_fragment_program) {
-      prog = &(ctx->FragmentProgram.Current->Base);
-      maxParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
-   }
    else {
       _mesa_error(ctx, GL_INVALID_ENUM,
                   "%s(target)", func);
@@ -365,13 +332,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
 
       base = & prog->Base;
    }
-   else if (target == GL_FRAGMENT_PROGRAM_NV
-            && ctx->Extensions.NV_fragment_program) {
-      struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
-      _mesa_parse_nv_fragment_program(ctx, target, string, len, prog);
-
-      base = & prog->Base;
-   }
    else {
       _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
       return;
@@ -529,9 +489,6 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
                                  GLfloat x, GLfloat y, GLfloat z, GLfloat w)
@@ -550,9 +507,6 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
                                   const GLfloat *params)
@@ -601,9 +555,6 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
                                  GLdouble x, GLdouble y,
@@ -614,9 +565,6 @@ _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index,
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
                                   const GLdouble *params)
@@ -627,9 +575,6 @@ _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
                                     GLfloat *params)
@@ -645,9 +590,6 @@ _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index,
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
                                     GLdouble *params)