summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-08-24 23:11:39 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-08-24 23:11:39 +0000
commit77427a1e52ec8fc7547fe22af31a4480be90938a (patch)
tree2c88b2d53862bca555578563d348f7d4c23fed71
parente6940f0a33a571b199bab60b680c30b718c47445 (diff)
Cg tries to bind NV fragment programs to the GL_FRAGMENT_PROGRAM_ARB target
with glBindProgramARB(). I guess the GL_ARB_fragment_program specification allows that, but Mesa didn't. Relaxed the check with a new predicate function: compatible_program_targets().
-rw-r--r--src/mesa/shader/program.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 27eb5c2f43..f6877bd142 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -1722,6 +1722,27 @@ _mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog)
}
+/**
+ * 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;
+}
+
+
/**********************************************************************/
/* API functions */
@@ -1809,7 +1830,7 @@ _mesa_BindProgram(GLenum target, GLuint id)
}
_mesa_HashInsert(ctx->Shared->Programs, id, prog);
}
- else if (prog->Target != target) {
+ else if (!compatible_program_targets(prog->Target, target)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBindProgramNV/ARB(target mismatch)");
return;