diff options
author | Brian Paul <[email protected]> | 2003-03-14 15:40:59 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-03-14 15:40:59 +0000 |
commit | f386f73f9e4054a750d453fa2f5449c2f1d2e242 (patch) | |
tree | 5ced5cfb6cb7f5006cc67618dac6eb83bdf93e4d /src/mesa/main/nvprogram.c | |
parent | a2da1155c285fde2a5e5824d50ee8a57c6e982f5 (diff) |
Clean-up of parser error handling/reporting.
Basic fragment program texture instructions are limping along.
Diffstat (limited to 'src/mesa/main/nvprogram.c')
-rw-r--r-- | src/mesa/main/nvprogram.c | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c index 1e255ba0288..4e371620c57 100644 --- a/src/mesa/main/nvprogram.c +++ b/src/mesa/main/nvprogram.c @@ -1,4 +1,4 @@ -/* $Id: nvprogram.c,v 1.7 2003/03/10 00:26:24 brianp Exp $ */ +/* $Id: nvprogram.c,v 1.8 2003/03/14 15:40:59 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -260,35 +260,41 @@ _mesa_BindProgramNV(GLenum target, GLuint id) /* NOTE: binding to a non-existant program is not an error. * That's supposed to be caught in glBegin. */ - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); - - if (!prog && id > 0){ - /* allocate new program */ - if (target == GL_VERTEX_PROGRAM_NV) { - struct vertex_program *vprog = CALLOC_STRUCT(vertex_program); - if (!vprog) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV"); - return; + if (id == 0) { + /* OK, the null program object */ + prog = NULL; + } + else { + prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); + + if (!prog && id > 0){ + /* allocate new program */ + if (target == GL_VERTEX_PROGRAM_NV) { + struct vertex_program *vprog = CALLOC_STRUCT(vertex_program); + if (!vprog) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV"); + return; + } + prog = &(vprog->Base); } - prog = &(vprog->Base); - } - else if (target == GL_FRAGMENT_PROGRAM_NV) { - struct fragment_program *fprog = CALLOC_STRUCT(fragment_program); - if (!fprog) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV"); + else if (target == GL_FRAGMENT_PROGRAM_NV) { + struct fragment_program *fprog = CALLOC_STRUCT(fragment_program); + if (!fprog) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV"); + return; + } + prog = &(fprog->Base); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV(target)"); return; } - prog = &(fprog->Base); + prog->Id = id; + prog->Target = target; + prog->Resident = GL_TRUE; + prog->RefCount = 1; + _mesa_HashInsert(ctx->Shared->Programs, id, prog); } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV(target)"); - return; - } - prog->Id = id; - prog->Target = target; - prog->Resident = GL_TRUE; - prog->RefCount = 1; - _mesa_HashInsert(ctx->Shared->Programs, id, prog); } /* bind now */ |