summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/nvprogram.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-04-17 23:14:30 +0000
committerBrian Paul <[email protected]>2003-04-17 23:14:30 +0000
commit5e92a7c7457f53fed576b65105a7a996a6044f55 (patch)
tree14b7296cc1561cfb7ad4a8368319878227c1f0e9 /src/mesa/main/nvprogram.c
parent3ca3ab0cd1856c66ab488b447f9e3def51fc541f (diff)
fix some glBindProgramNV/ARB details
Diffstat (limited to 'src/mesa/main/nvprogram.c')
-rw-r--r--src/mesa/main/nvprogram.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c
index af1ff36f79c..00ea579b2e8 100644
--- a/src/mesa/main/nvprogram.c
+++ b/src/mesa/main/nvprogram.c
@@ -227,12 +227,24 @@ _mesa_BindProgramNV(GLenum target, GLuint id)
*/
if (id == 0) {
/* OK, the null program object */
+ /* XXX use the ARB_vertex/fragment prorgram default objects??? */
prog = NULL;
}
else {
prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id);
- if (!prog && id > 0){
- /* allocate new program */
+ if (prog) {
+ if (prog->Target == 0) {
+ /* prog was allocated with glGenProgramsNV */
+ prog->Target = target;
+ }
+ else if (prog->Target != target) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindProgramNV(target mismatch)");
+ return;
+ }
+ }
+ else {
+ /* allocate a new program now */
prog = _mesa_alloc_program(ctx, target, id);
if (!prog) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV");