aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/arbprogram.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/arbprogram.c')
-rw-r--r--mesalib/src/mesa/main/arbprogram.c112
1 files changed, 13 insertions, 99 deletions
diff --git a/mesalib/src/mesa/main/arbprogram.c b/mesalib/src/mesa/main/arbprogram.c
index ae91fd5a3..9be86c2fe 100644
--- a/mesalib/src/mesa/main/arbprogram.c
+++ b/mesalib/src/mesa/main/arbprogram.c
@@ -37,33 +37,9 @@
#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
@@ -77,19 +53,15 @@ _mesa_BindProgram(GLenum target, GLuint id)
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,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));
}
@@ -181,15 +152,13 @@ _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);
}
break;
- case GL_FRAGMENT_PROGRAM_NV:
case GL_FRAGMENT_PROGRAM_ARB:
if (ctx->FragmentProgram.Current &&
ctx->FragmentProgram.Current->Base.Id == ids[i]) {
@@ -286,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);
@@ -321,8 +285,7 @@ get_env_param_pointer(struct gl_context *ctx, const char *func,
return GL_TRUE;
}
else if (target == GL_VERTEX_PROGRAM_ARB &&
- (ctx->Extensions.ARB_vertex_program ||
- ctx->Extensions.NV_vertex_program)) {
+ ctx->Extensions.ARB_vertex_program) {
if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index)", func);
return GL_FALSE;
@@ -356,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;
@@ -385,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;
@@ -410,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,
@@ -425,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,
@@ -441,8 +377,6 @@ _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,
@@ -466,8 +400,6 @@ _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,
@@ -557,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)
@@ -578,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)
@@ -629,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,
@@ -642,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)
@@ -655,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)
@@ -673,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)