diff options
author | Ian Romanick <idr@us.ibm.com> | 2006-08-15 16:47:34 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2006-08-15 16:47:34 +0000 |
commit | 8c41c757fe8efa04df0dd5cdfb33a75b84891c19 (patch) | |
tree | 23d57eea7976a8594b7ee64b2a39a5c3738c1162 /src/mesa/shader | |
parent | 5208d93a418c2d1f9db67e3760117ceb659b7f7c (diff) | |
download | external_mesa3d-8c41c757fe8efa04df0dd5cdfb33a75b84891c19.zip external_mesa3d-8c41c757fe8efa04df0dd5cdfb33a75b84891c19.tar.gz external_mesa3d-8c41c757fe8efa04df0dd5cdfb33a75b84891c19.tar.bz2 |
Add support for GL_EXT_gpu_program_parameters. Any driver that enables
either GL_ARB_vertex_program or GL_ARB_fragment_program should enable this
extension as well.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/arbprogram.c | 88 | ||||
-rw-r--r-- | src/mesa/shader/arbprogram.h | 10 |
2 files changed, 98 insertions, 0 deletions
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 346263d..89f2d20 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -277,6 +277,50 @@ _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, void GLAPIENTRY +_mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, + const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + unsigned i; + GLfloat * dest; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (count <= 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(count)"); + } + + if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + if ((index + count) > ctx->Const.FragmentProgram.MaxEnvParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(index + count)"); + return; + } + dest = ctx->FragmentProgram.Parameters[index]; + } + else if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + if ((index + count) > ctx->Const.VertexProgram.MaxEnvParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(index + count)"); + return; + } + dest = ctx->VertexProgram.Parameters[index]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameters4fv(target)"); + return; + } + + for ( i = 0 ; i < count ; i++ ) { + COPY_4V(dest, params); + params += 4; + dest += 4; + } +} + + +void GLAPIENTRY _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble *params) { @@ -383,6 +427,50 @@ _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, } +void GLAPIENTRY +_mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, + const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_program *prog; + unsigned i; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + if (count <= 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fv(count)"); + } + + if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + if ((index + count) > ctx->Const.FragmentProgram.MaxLocalParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fvEXT(index + count)"); + return; + } + prog = &(ctx->FragmentProgram.Current->Base); + } + else if (target == GL_VERTEX_PROGRAM_ARB + && ctx->Extensions.ARB_vertex_program) { + if ((index + count) > ctx->Const.VertexProgram.MaxLocalParams) { + _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fvEXT(index + count)"); + return; + } + prog = &(ctx->VertexProgram.Current->Base); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameters4fvEXT(target)"); + return; + } + + for (i = 0; i < count; i++) { + ASSERT((index + i) < MAX_PROGRAM_LOCAL_PARAMS); + COPY_4V(prog->LocalParams[index + i], params); + params += 4; + } +} + + /** * Note, this function is also used by the GL_NV_fragment_program extension. */ diff --git a/src/mesa/shader/arbprogram.h b/src/mesa/shader/arbprogram.h index e1b99ab..54a14bb 100644 --- a/src/mesa/shader/arbprogram.h +++ b/src/mesa/shader/arbprogram.h @@ -77,6 +77,11 @@ _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, extern void GLAPIENTRY +_mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, + const GLfloat *params); + + +extern void GLAPIENTRY _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); @@ -98,6 +103,11 @@ _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, extern void GLAPIENTRY +_mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, + const GLfloat *params); + + +extern void GLAPIENTRY _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble *params); |