summaryrefslogtreecommitdiff
path: root/src/mesa/main/arbprogram.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-04-17 23:14:30 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-04-17 23:14:30 +0000
commit5e92a7c7457f53fed576b65105a7a996a6044f55 (patch)
tree14b7296cc1561cfb7ad4a8368319878227c1f0e9 /src/mesa/main/arbprogram.c
parent3ca3ab0cd1856c66ab488b447f9e3def51fc541f (diff)
fix some glBindProgramNV/ARB details
Diffstat (limited to 'src/mesa/main/arbprogram.c')
-rw-r--r--src/mesa/main/arbprogram.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index eeac11bd98..639a4d33a3 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -463,19 +463,30 @@ _mesa_BindProgramARB(GLenum target, GLuint program)
}
else {
prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, program);
- }
- if (!prog && program > 0){
- /* allocate new program */
- prog = _mesa_alloc_program(ctx, target, program);
- if (!prog) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB");
- return;
+ if (prog) {
+ if (prog->Target == 0) {
+ /* prog was allocated with glGenProgramsARB */
+ prog->Target = target;
+ }
+ else if (prog->Target != target) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindProgramARB(target mismatch)");
+ return;
+ }
+ }
+ else {
+ /* allocate a new program now */
+ prog = _mesa_alloc_program(ctx, target, program);
+ if (!prog) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB");
+ return;
+ }
+ prog->Id = program;
+ prog->Target = target;
+ prog->Resident = GL_TRUE;
+ prog->RefCount = 1;
+ _mesa_HashInsert(ctx->Shared->Programs, program, prog);
}
- prog->Id = program;
- prog->Target = target;
- prog->Resident = GL_TRUE;
- prog->RefCount = 1;
- _mesa_HashInsert(ctx->Shared->Programs, program, prog);
}
/* bind now */