diff options
author | Brian Paul <[email protected]> | 2003-05-28 14:26:03 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-05-28 14:26:03 +0000 |
commit | e8e93e9cc641e31c9c0e6a2bb1ac3e44d0bdec5a (patch) | |
tree | ffa199c620c5db69d6a61d253c92b01781898720 /src/mesa/main | |
parent | 2c5f93784ea1ba28ae15181917ff3e47656a93ad (diff) |
glBindProgramARB dispatches to glBindProgramNV (remove _mesa_BindProgramARB).
Removed VertexAttrib*ARB() stubs.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/arbprogram.c | 276 | ||||
-rw-r--r-- | src/mesa/main/arbprogram.h | 112 | ||||
-rw-r--r-- | src/mesa/main/nvprogram.c | 32 | ||||
-rw-r--r-- | src/mesa/main/state.c | 21 |
4 files changed, 31 insertions, 410 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 384504e15e6..5cc451e8bb7 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -60,187 +60,6 @@ _mesa_parse_arb_fragment_program(GLcontext *ctx, GLenum target, void -_mesa_VertexAttrib1sARB(GLuint index, GLshort x) -{ -} - -void -_mesa_VertexAttrib1fARB(GLuint index, GLfloat x) -{ -} - -void -_mesa_VertexAttrib1dARB(GLuint index, GLdouble x) -{ -} - -void -_mesa_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y) -{ -} - -void -_mesa_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) -{ -} - -void -_mesa_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y) -{ -} - -void -_mesa_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z) -{ -} - -void -_mesa_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ -} - -void -_mesa_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ -} - -void -_mesa_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) -{ -} - -void -_mesa_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ -} - -void -_mesa_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ -} - -void -_mesa_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) -{ -} - -void -_mesa_VertexAttrib1svARB(GLuint index, const GLshort *v) -{ -} - -void -_mesa_VertexAttrib1fvARB(GLuint index, const GLfloat *v) -{ -} - -void -_mesa_VertexAttrib1dvARB(GLuint index, const GLdouble *v) -{ -} - -void -_mesa_VertexAttrib2svARB(GLuint index, const GLshort *v) -{ -} - -void -_mesa_VertexAttrib2fvARB(GLuint index, const GLfloat *v) -{ -} - -void -_mesa_VertexAttrib2dvARB(GLuint index, const GLdouble *v) -{ -} - -void -_mesa_VertexAttrib3svARB(GLuint index, const GLshort *v) -{ -} - -void -_mesa_VertexAttrib3fvARB(GLuint index, const GLfloat *v) -{ -} - -void -_mesa_VertexAttrib3dvARB(GLuint index, const GLdouble *v) -{ -} - -void -_mesa_VertexAttrib4bvARB(GLuint index, const GLbyte *v) -{ -} - -void -_mesa_VertexAttrib4svARB(GLuint index, const GLshort *v) -{ -} - -void -_mesa_VertexAttrib4ivARB(GLuint index, const GLint *v) -{ -} - -void -_mesa_VertexAttrib4ubvARB(GLuint index, const GLubyte *v) -{ -} - -void -_mesa_VertexAttrib4usvARB(GLuint index, const GLushort *v) -{ -} - -void -_mesa_VertexAttrib4uivARB(GLuint index, const GLuint *v) -{ -} - -void -_mesa_VertexAttrib4fvARB(GLuint index, const GLfloat *v) -{ -} - -void -_mesa_VertexAttrib4dvARB(GLuint index, const GLdouble *v) -{ -} - -void -_mesa_VertexAttrib4NbvARB(GLuint index, const GLbyte *v) -{ -} - -void -_mesa_VertexAttrib4NsvARB(GLuint index, const GLshort *v) -{ -} - -void -_mesa_VertexAttrib4NivARB(GLuint index, const GLint *v) -{ -} - -void -_mesa_VertexAttrib4NubvARB(GLuint index, const GLubyte *v) -{ -} - -void -_mesa_VertexAttrib4NusvARB(GLuint index, const GLushort *v) -{ -} - -void -_mesa_VertexAttrib4NuivARB(GLuint index, const GLuint *v) -{ -} - - -void _mesa_EnableVertexAttribArrayARB(GLuint index) { GET_CURRENT_CONTEXT(ctx); @@ -403,101 +222,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, void -_mesa_BindProgramARB(GLenum target, GLuint program) -{ - struct program *prog; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (target == GL_VERTEX_PROGRAM_ARB - && ctx->Extensions.ARB_vertex_program) { - if (ctx->VertexProgram.Current && - ctx->VertexProgram.Current->Base.Id == program) - return; - /* decrement refcount on previously bound vertex program */ - if (ctx->VertexProgram.Current) { - ctx->VertexProgram.Current->Base.RefCount--; - /* and delete if refcount goes below one */ - if (ctx->VertexProgram.Current->Base.RefCount <= 0) { - _mesa_delete_program(ctx, &(ctx->VertexProgram.Current->Base)); - _mesa_HashRemove(ctx->Shared->Programs, program); - } - } - } - else if (target == GL_FRAGMENT_PROGRAM_ARB - && ctx->Extensions.ARB_fragment_program) { - if (ctx->FragmentProgram.Current && - ctx->FragmentProgram.Current->Base.Id == program) - return; - /* decrement refcount on previously bound fragment program */ - if (ctx->FragmentProgram.Current) { - ctx->FragmentProgram.Current->Base.RefCount--; - /* and delete if refcount goes below one */ - if (ctx->FragmentProgram.Current->Base.RefCount <= 0) { - _mesa_delete_program(ctx, &(ctx->FragmentProgram.Current->Base)); - _mesa_HashRemove(ctx->Shared->Programs, program); - } - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramARB(target)"); - return; - } - - /* NOTE: binding to a non-existant program is not an error. - * That's supposed to be caught in glBegin. - * NOTE: program number 0 is legal here. - */ - if (program == 0) { - /* default program */ - if (target == GL_VERTEX_PROGRAM_ARB) - prog = ctx->Shared->DefaultVertexProgram; - else - prog = ctx->Shared->DefaultFragmentProgram; - } - else { - prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, program); - 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); - } - } - - /* bind now */ - if (target == GL_VERTEX_PROGRAM_ARB) { - ctx->VertexProgram.Current = (struct vertex_program *) prog; - } - else { - ASSERT(target == GL_FRAGMENT_PROGRAM_ARB); - ctx->FragmentProgram.Current = (struct fragment_program *) prog; - } - - if (prog) - prog->RefCount++; -} - - -void _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { diff --git a/src/mesa/main/arbprogram.h b/src/mesa/main/arbprogram.h index a4030902a17..7f4dd877580 100644 --- a/src/mesa/main/arbprogram.h +++ b/src/mesa/main/arbprogram.h @@ -26,114 +26,6 @@ #ifndef ARBPROGRAM_H #define ARBPROGRAM_H -extern void -_mesa_VertexAttrib1sARB(GLuint index, GLshort x); - -extern void -_mesa_VertexAttrib1fARB(GLuint index, GLfloat x); - -extern void -_mesa_VertexAttrib1dARB(GLuint index, GLdouble x); - -extern void -_mesa_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y); - -extern void -_mesa_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y); - -extern void -_mesa_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y); - -extern void -_mesa_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z); - -extern void -_mesa_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z); - -extern void -_mesa_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z); - -extern void -_mesa_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); - -extern void -_mesa_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - -extern void -_mesa_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - -extern void -_mesa_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); - -extern void -_mesa_VertexAttrib1svARB(GLuint index, const GLshort *v); - -extern void -_mesa_VertexAttrib1fvARB(GLuint index, const GLfloat *v); - -extern void -_mesa_VertexAttrib1dvARB(GLuint index, const GLdouble *v); - -extern void -_mesa_VertexAttrib2svARB(GLuint index, const GLshort *v); - -extern void -_mesa_VertexAttrib2fvARB(GLuint index, const GLfloat *v); - -extern void -_mesa_VertexAttrib2dvARB(GLuint index, const GLdouble *v); - -extern void -_mesa_VertexAttrib3svARB(GLuint index, const GLshort *v); - -extern void -_mesa_VertexAttrib3fvARB(GLuint index, const GLfloat *v); - -extern void -_mesa_VertexAttrib3dvARB(GLuint index, const GLdouble *v); - -extern void -_mesa_VertexAttrib4bvARB(GLuint index, const GLbyte *v); - -extern void -_mesa_VertexAttrib4svARB(GLuint index, const GLshort *v); - -extern void -_mesa_VertexAttrib4ivARB(GLuint index, const GLint *v); - -extern void -_mesa_VertexAttrib4ubvARB(GLuint index, const GLubyte *v); - -extern void -_mesa_VertexAttrib4usvARB(GLuint index, const GLushort *v); - -extern void -_mesa_VertexAttrib4uivARB(GLuint index, const GLuint *v); - -extern void -_mesa_VertexAttrib4fvARB(GLuint index, const GLfloat *v); - -extern void -_mesa_VertexAttrib4dvARB(GLuint index, const GLdouble *v); - -extern void -_mesa_VertexAttrib4NbvARB(GLuint index, const GLbyte *v); - -extern void -_mesa_VertexAttrib4NsvARB(GLuint index, const GLshort *v); - -extern void -_mesa_VertexAttrib4NivARB(GLuint index, const GLint *v); - -extern void -_mesa_VertexAttrib4NubvARB(GLuint index, const GLubyte *v); - -extern void -_mesa_VertexAttrib4NusvARB(GLuint index, const GLushort *v); - -extern void -_mesa_VertexAttrib4NuivARB(GLuint index, const GLuint *v); - extern void _mesa_EnableVertexAttribArrayARB(GLuint index); @@ -165,10 +57,6 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, extern void -_mesa_BindProgramARB(GLenum target, GLuint program); - - -extern void _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c index 511bf2e006e..68830c30e40 100644 --- a/src/mesa/main/nvprogram.c +++ b/src/mesa/main/nvprogram.c @@ -178,7 +178,8 @@ _mesa_delete_program(GLcontext *ctx, struct program *prog) /** * Bind a program (make it current) - * \note Called from the GL API dispatcher. + * \note Called from the GL API dispatcher by both glBindProgramNV + * and glBindProgramARB. */ void _mesa_BindProgramNV(GLenum target, GLuint id) @@ -187,8 +188,10 @@ _mesa_BindProgramNV(GLenum target, GLuint id) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (target == GL_VERTEX_PROGRAM_NV - && ctx->Extensions.NV_vertex_program) { + if ((target == GL_VERTEX_PROGRAM_NV + && ctx->Extensions.NV_vertex_program) || + (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program)) { if (ctx->VertexProgram.Current && ctx->VertexProgram.Current->Base.Id == id) return; @@ -202,8 +205,10 @@ _mesa_BindProgramNV(GLenum target, GLuint id) } } } - else if (target == GL_FRAGMENT_PROGRAM_NV - && ctx->Extensions.NV_fragment_program) { + else if ((target == GL_FRAGMENT_PROGRAM_NV + && ctx->Extensions.NV_fragment_program) || + (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program)) { if (ctx->FragmentProgram.Current && ctx->FragmentProgram.Current->Base.Id == id) return; @@ -218,7 +223,7 @@ _mesa_BindProgramNV(GLenum target, GLuint id) } } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV/ARB(target)"); return; } @@ -226,9 +231,12 @@ _mesa_BindProgramNV(GLenum target, GLuint id) * That's supposed to be caught in glBegin. */ if (id == 0) { - /* OK, the null program object */ - /* XXX use the ARB_vertex/fragment prorgram default objects??? */ + /* default program */ prog = NULL; + if (target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_PROGRAM_ARB) + prog = ctx->Shared->DefaultVertexProgram; + else + prog = ctx->Shared->DefaultFragmentProgram; } else { prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); @@ -239,7 +247,7 @@ _mesa_BindProgramNV(GLenum target, GLuint id) } else if (prog->Target != target) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindProgramNV(target mismatch)"); + "glBindProgramNV/ARB(target mismatch)"); return; } } @@ -247,7 +255,7 @@ _mesa_BindProgramNV(GLenum target, GLuint id) /* allocate a new program now */ prog = _mesa_alloc_program(ctx, target, id); if (!prog) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV/ARB"); return; } prog->Id = id; @@ -259,10 +267,10 @@ _mesa_BindProgramNV(GLenum target, GLuint id) } /* bind now */ - if (target == GL_VERTEX_PROGRAM_NV) { + if (target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_PROGRAM_ARB) { ctx->VertexProgram.Current = (struct vertex_program *) prog; } - else if (target == GL_FRAGMENT_PROGRAM_NV) { + else if (target == GL_FRAGMENT_PROGRAM_NV || target == GL_FRAGMENT_PROGRAM_ARB) { ctx->FragmentProgram.Current = (struct fragment_program *) prog; } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 8030c9e94b6..63c8bc4abda 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -509,6 +509,7 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV; exec->TrackMatrixNV = _mesa_TrackMatrixNV; exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV; + /* glVertexAttrib*NV functions handled in api_loopback.c */ #endif /* 282. GL_NV_fragment_program */ @@ -591,16 +592,16 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */ /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */ /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */ - exec->VertexAttrib4bvARB = _mesa_VertexAttrib4bvARB; - exec->VertexAttrib4ivARB = _mesa_VertexAttrib4ivARB; - exec->VertexAttrib4ubvARB = _mesa_VertexAttrib4ubvARB; - exec->VertexAttrib4usvARB = _mesa_VertexAttrib4usvARB; - exec->VertexAttrib4uivARB = _mesa_VertexAttrib4uivARB; - exec->VertexAttrib4NbvARB = _mesa_VertexAttrib4NbvARB; - exec->VertexAttrib4NsvARB = _mesa_VertexAttrib4NsvARB; - exec->VertexAttrib4NivARB = _mesa_VertexAttrib4NivARB; - exec->VertexAttrib4NusvARB = _mesa_VertexAttrib4NusvARB; - exec->VertexAttrib4NuivARB = _mesa_VertexAttrib4NuivARB; + /* glVertexAttrib4bvARB handled in api_loopback.c */ + /* glVertexAttrib4ivARB handled in api_loopback.c */ + /* glVertexAttrib4ubvARB handled in api_loopback.c */ + /* glVertexAttrib4usvARB handled in api_loopback.c */ + /* glVertexAttrib4uivARB handled in api_loopback.c */ + /* glVertexAttrib4NbvARB handled in api_loopback.c */ + /* glVertexAttrib4NsvARB handled in api_loopback.c */ + /* glVertexAttrib4NivARB handled in api_loopback.c */ + /* glVertexAttrib4NusvARB handled in api_loopback.c */ + /* glVertexAttrib4NuivARB handled in api_loopback.c */ exec->VertexAttribPointerARB = _mesa_VertexAttribPointerARB; exec->EnableVertexAttribArrayARB = _mesa_EnableVertexAttribArrayARB; exec->DisableVertexAttribArrayARB = _mesa_DisableVertexAttribArrayARB; |