summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/arbprogram.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2006-08-15 16:47:34 +0000
committerIan Romanick <[email protected]>2006-08-15 16:47:34 +0000
commit8c41c757fe8efa04df0dd5cdfb33a75b84891c19 (patch)
tree23d57eea7976a8594b7ee64b2a39a5c3738c1162 /src/mesa/shader/arbprogram.c
parent5208d93a418c2d1f9db67e3760117ceb659b7f7c (diff)
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/arbprogram.c')
-rw-r--r--src/mesa/shader/arbprogram.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
index 346263d8668..89f2d20cc9a 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.
*/