mesa: Standardize names of OpenGL functions.
[mesa.git] / src / mesa / main / arbprogram.c
index 26d781954eda19db45b53717eff0ab87ea3c2463..8150b5f4ec1ddedd2b5468c4f5c3b536e1e37d6d 100644 (file)
 #include "main/mtypes.h"
 #include "main/arbprogram.h"
 #include "program/arbprogparse.h"
-#include "program/nvfragparse.h"
-#include "program/nvvertparse.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);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    /* Error-check target and get curProg */
-   if ((target == GL_VERTEX_PROGRAM_ARB) && /* == GL_VERTEX_PROGRAM_NV */
-        (ctx->Extensions.NV_vertex_program ||
-         ctx->Extensions.ARB_vertex_program)) {
+   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;
    }
 
@@ -101,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;
@@ -113,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;
       }
    }
@@ -136,14 +108,13 @@ _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,
-                               (struct gl_vertex_program *) newProg);
+                               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,
-                               (struct gl_fragment_program *) newProg);
+                               gl_fragment_program(newProg));
    }
 
    /* Never null pointers */
@@ -161,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);
@@ -181,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:
@@ -216,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;
@@ -269,6 +238,65 @@ _mesa_IsProgramARB(GLuint id)
       return GL_FALSE;
 }
 
+static GLboolean
+get_local_param_pointer(struct gl_context *ctx, const char *func,
+                       GLenum target, GLuint index, GLfloat **param)
+{
+   struct gl_program *prog;
+   GLuint maxParams;
+
+   if (target == GL_VERTEX_PROGRAM_ARB
+       && ctx->Extensions.ARB_vertex_program) {
+      prog = &(ctx->VertexProgram.Current->Base);
+      maxParams = ctx->Const.VertexProgram.MaxLocalParams;
+   }
+   else if (target == GL_FRAGMENT_PROGRAM_ARB
+            && ctx->Extensions.ARB_fragment_program) {
+      prog = &(ctx->FragmentProgram.Current->Base);
+      maxParams = ctx->Const.FragmentProgram.MaxLocalParams;
+   }
+   else {
+      _mesa_error(ctx, GL_INVALID_ENUM,
+                  "%s(target)", func);
+      return GL_FALSE;
+   }
+
+   if (index >= maxParams) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
+      return GL_FALSE;
+   }
+
+   *param = prog->LocalParams[index];
+   return GL_TRUE;
+}
+
+
+static GLboolean
+get_env_param_pointer(struct gl_context *ctx, const char *func,
+                     GLenum target, GLuint index, GLfloat **param)
+{
+   if (target == GL_FRAGMENT_PROGRAM_ARB
+       && ctx->Extensions.ARB_fragment_program) {
+      if (index >= ctx->Const.FragmentProgram.MaxEnvParams) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
+         return GL_FALSE;
+      }
+      *param = ctx->FragmentProgram.Parameters[index];
+      return GL_TRUE;
+   }
+   else if (target == GL_VERTEX_PROGRAM_ARB &&
+            ctx->Extensions.ARB_vertex_program) {
+      if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
+         return GL_FALSE;
+      }
+      *param = ctx->VertexProgram.Parameters[index];
+      return GL_TRUE;
+   } else {
+      _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);
+      return GL_FALSE;
+   }
+}
 
 void GLAPIENTRY
 _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
@@ -291,28 +319,12 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
       return;
    }
 
-   /* The first couple cases are complicated.  The same enum value is used for
-    * ARB and NV vertex programs.  If the target is a vertex program, parse it
-    * using the ARB grammar if the string starts with "!!ARB" or if
-    * NV_vertex_program is not supported.
-    */
-   if (target == GL_VERTEX_PROGRAM_ARB
-       && ctx->Extensions.ARB_vertex_program
-       && ((strncmp(string, "!!ARB", 5) == 0)
-          || !ctx->Extensions.NV_vertex_program)) {
+   if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
       struct gl_vertex_program *prog = ctx->VertexProgram.Current;
       _mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
 
       base = & prog->Base;
    }
-   else if ((target == GL_VERTEX_PROGRAM_ARB
-            || target == GL_VERTEX_STATE_PROGRAM_NV)
-           && ctx->Extensions.NV_vertex_program) {
-      struct gl_vertex_program *prog = ctx->VertexProgram.Current;
-      _mesa_parse_nv_vertex_program(ctx, target, string, len, prog);
-
-      base = & prog->Base;
-   }
    else if (target == GL_FRAGMENT_PROGRAM_ARB
             && ctx->Extensions.ARB_fragment_program) {
       struct gl_fragment_program *prog = ctx->FragmentProgram.Current;
@@ -320,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;
@@ -345,8 +350,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
 /**
  * Set a program env parameter register.
  * \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterdNV)
  */
 void GLAPIENTRY
 _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
@@ -360,8 +363,6 @@ _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index,
 /**
  * Set a program env parameter register.
  * \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterdvNV)
  */
 void GLAPIENTRY
 _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
@@ -376,37 +377,21 @@ _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
 /**
  * Set a program env parameter register.
  * \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterfNV)
  */
 void GLAPIENTRY
 _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
                                GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
+   GLfloat *param;
+
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
 
-   if (target == GL_FRAGMENT_PROGRAM_ARB
-       && ctx->Extensions.ARB_fragment_program) {
-      if (index >= ctx->Const.FragmentProgram.MaxEnvParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)");
-         return;
-      }
-      ASSIGN_4V(ctx->FragmentProgram.Parameters[index], x, y, z, w);
-   }
-   else if (target == GL_VERTEX_PROGRAM_ARB /* == GL_VERTEX_PROGRAM_NV */
-       && (ctx->Extensions.ARB_vertex_program || ctx->Extensions.NV_vertex_program)) {
-      if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)");
-         return;
-      }
-      ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w);
-   }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameter(target)");
-      return;
+   if (get_env_param_pointer(ctx, "glProgramEnvParameter",
+                            target, index, &param)) {
+      ASSIGN_4V(param, x, y, z, w);
    }
 }
 
@@ -415,39 +400,21 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
 /**
  * Set a program env parameter register.
  * \note Called from the GL API dispatcher.
- * Note, this function is also used by the GL_NV_vertex_program extension
- * (alias to ProgramParameterfvNV)
  */
 void GLAPIENTRY
 _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
                                 const GLfloat *params)
 {
+   GLfloat *param;
+
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
 
-   if (target == GL_FRAGMENT_PROGRAM_ARB
-       && ctx->Extensions.ARB_fragment_program) {
-      if (index >= ctx->Const.FragmentProgram.MaxEnvParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter4fv(index)");
-         return;
-      }
-      memcpy(ctx->FragmentProgram.Parameters[index], params,
-             4 * sizeof(GLfloat));
-   }
-   else if (target == GL_VERTEX_PROGRAM_ARB /* == GL_VERTEX_PROGRAM_NV */
-       && (ctx->Extensions.ARB_vertex_program || ctx->Extensions.NV_vertex_program)) {
-      if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter4fv(index)");
-         return;
-      }
-      memcpy(ctx->VertexProgram.Parameters[index], params,
-             4 * sizeof(GLfloat));
-   }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameter4fv(target)");
-      return;
+   if (get_env_param_pointer(ctx, "glProgramEnvParameter4fv",
+                             target, index, &param)) {
+      memcpy(param, params, 4 * sizeof(GLfloat));
    }
 }
 
@@ -496,14 +463,11 @@ _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index,
                                   GLdouble *params)
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLfloat fparams[4];
+   GLfloat *fparam;
 
-   _mesa_GetProgramEnvParameterfvARB(target, index, fparams);
-   if (ctx->ErrorValue == GL_NO_ERROR) {
-      params[0] = fparams[0];
-      params[1] = fparams[1];
-      params[2] = fparams[2];
-      params[3] = fparams[3];
+   if (get_env_param_pointer(ctx, "glGetProgramEnvParameterdv",
+                            target, index, &fparam)) {
+      COPY_4V(params, fparam);
    }
 }
 
@@ -512,80 +476,37 @@ void GLAPIENTRY
 _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, 
                                   GLfloat *params)
 {
+   GLfloat *param;
+
    GET_CURRENT_CONTEXT(ctx);
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (target == GL_FRAGMENT_PROGRAM_ARB
-       && ctx->Extensions.ARB_fragment_program) {
-      if (index >= ctx->Const.FragmentProgram.MaxEnvParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)");
-         return;
-      }
-      COPY_4V(params, ctx->FragmentProgram.Parameters[index]);
-   }
-   else if (target == GL_VERTEX_PROGRAM_ARB
-       && ctx->Extensions.ARB_vertex_program) {
-      if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)");
-         return;
-      }
-      COPY_4V(params, ctx->VertexProgram.Parameters[index]);
-   }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramEnvParameter(target)");
-      return;
+   if (get_env_param_pointer(ctx, "glGetProgramEnvParameterfv",
+                             target, index, &param)) {
+      COPY_4V(params, param);
    }
 }
 
 
-/**
- * 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)
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_program *prog;
+   GLfloat *param;
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
    FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
 
-   if ((target == GL_FRAGMENT_PROGRAM_NV
-        && ctx->Extensions.NV_fragment_program) ||
-       (target == GL_FRAGMENT_PROGRAM_ARB
-        && ctx->Extensions.ARB_fragment_program)) {
-      if (index >= ctx->Const.FragmentProgram.MaxLocalParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB");
-         return;
-      }
-      prog = &(ctx->FragmentProgram.Current->Base);
-   }
-   else if (target == GL_VERTEX_PROGRAM_ARB
-            && ctx->Extensions.ARB_vertex_program) {
-      if (index >= ctx->Const.VertexProgram.MaxLocalParams) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB");
-         return;
-      }
-      prog = &(ctx->VertexProgram.Current->Base);
+   if (get_local_param_pointer(ctx, "glProgramLocalParameterARB",
+                              target, index, &param)) {
+      ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS);
+      ASSIGN_4V(param, x, y, z, w);
    }
-   else {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameterARB");
-      return;
-   }
-
-   ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS);
-   prog->LocalParams[index][0] = x;
-   prog->LocalParams[index][1] = y;
-   prog->LocalParams[index][2] = z;
-   prog->LocalParams[index][3] = w;
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
                                   const GLfloat *params)
@@ -634,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,
@@ -647,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)
@@ -660,64 +575,32 @@ _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)
 {
-   const struct gl_program *prog;
-   GLuint maxParams;
+   GLfloat *param;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (target == GL_VERTEX_PROGRAM_ARB
-       && ctx->Extensions.ARB_vertex_program) {
-      prog = &(ctx->VertexProgram.Current->Base);
-      maxParams = ctx->Const.VertexProgram.MaxLocalParams;
+   if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT",
+                               target, index, &param)) {
+      COPY_4V(params, param);
    }
-   else if (target == GL_FRAGMENT_PROGRAM_ARB
-            && ctx->Extensions.ARB_fragment_program) {
-      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,
-                  "glGetProgramLocalParameterARB(target)");
-      return;
-   }
-
-   if (index >= maxParams) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glGetProgramLocalParameterARB(index)");
-      return;
-   }
-
-   ASSERT(prog);
-   ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS);
-   COPY_4V(params, prog->LocalParams[index]);
 }
 
 
-/**
- * Note, this function is also used by the GL_NV_fragment_program extension.
- */
 void GLAPIENTRY
 _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index,
                                     GLdouble *params)
 {
+   GLfloat *param;
    GET_CURRENT_CONTEXT(ctx);
-   GLfloat floatParams[4];
-   ASSIGN_4V(floatParams, 0.0F, 0.0F, 0.0F, 0.0F);
-   _mesa_GetProgramLocalParameterfvARB(target, index, floatParams);
-   if (ctx->ErrorValue == GL_NO_ERROR) {
-      COPY_4V(params, floatParams);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT",
+                               target, index, &param)) {
+      COPY_4V(params, param);
    }
 }