summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arbprogram.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2012-10-14 15:58:17 -0700
committerKenneth Graunke <[email protected]>2012-10-16 11:35:23 -0700
commitd213d27f840598c19caa1a9fbf2e9a52fcbd6fcb (patch)
treee39e855fd4e6e273fbfd7ea1b8b2712148ee6673 /src/mesa/main/arbprogram.c
parent2f350f360b00e786e140d9ccb9db83bf23269d8f (diff)
mesa: Simplify _mesa_BindProgram() by removing NV program remnants.
Without NV programs, there's no need for the compatible_program_targets function. A simple (non-)equality check will do. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main/arbprogram.c')
-rw-r--r--src/mesa/main/arbprogram.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index acbffa3e703..ef1f620bbe7 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -40,28 +40,6 @@
#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
@@ -78,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;
}
@@ -97,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;
@@ -109,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;
}
}
@@ -132,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));
}