summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
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/main
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/main')
-rw-r--r--src/mesa/main/dlist.c70
-rw-r--r--src/mesa/main/extensions.c4
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/state.c6
4 files changed, 81 insertions, 0 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 46e33a11d9d..83200d86b4a 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -4468,6 +4468,38 @@ save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
static void GLAPIENTRY
+save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
+ const GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (count > 0) {
+ unsigned i;
+ const GLfloat * p = params;
+
+ for (i = 0 ; i < count ; i++) {
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6);
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = p[0];
+ n[4].f = p[1];
+ n[5].f = p[2];
+ n[6].f = p[3];
+ p += 4;
+ }
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ CALL_ProgramLocalParameters4fvEXT(ctx->Exec, (target, index, count, params));
+ }
+}
+
+
+static void GLAPIENTRY
save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y,
GLdouble z, GLdouble w)
@@ -4670,6 +4702,38 @@ save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
static void GLAPIENTRY
+save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
+ const GLfloat * params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (count > 0) {
+ unsigned i;
+ const GLfloat * p = params;
+
+ for (i = 0 ; i < count ; i++) {
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6);
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = p[0];
+ n[4].f = p[1];
+ n[5].f = p[2];
+ n[6].f = p[3];
+ p += 4;
+ }
+ }
+ }
+
+ if (ctx->ExecuteFlag) {
+ CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params));
+ }
+}
+
+
+static void GLAPIENTRY
save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
@@ -8154,6 +8218,12 @@ _mesa_init_dlist_table(struct _glapi_table *table)
/* 299. GL_EXT_blend_equation_separate */
SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT);
+
+ /* GL_EXT_gpu_program_parmaeters */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
+ SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
+#endif
}
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 151753943a6..5edf9a7dd65 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -94,6 +94,7 @@ static const struct {
{ OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) },
{ OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) },
{ OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) },
+ { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) },
{ OFF, "GL_EXT_histogram", F(EXT_histogram) },
{ OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) },
{ OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) },
@@ -284,6 +285,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
ctx->Extensions.SGIX_depth_texture = GL_TRUE;
ctx->Extensions.SGIX_shadow = GL_TRUE;
ctx->Extensions.SGIX_shadow_ambient = GL_TRUE;
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
+#endif
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 49befa262fa..2bb6d93c390 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2450,6 +2450,7 @@ struct gl_extensions
GLboolean EXT_framebuffer_object;
GLboolean EXT_fog_coord;
GLboolean EXT_framebuffer_blit;
+ GLboolean EXT_gpu_program_parameters;
GLboolean EXT_histogram;
GLboolean EXT_multi_draw_arrays;
GLboolean EXT_paletted_texture;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 0b7214f9dd0..7009db2b332 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -797,6 +797,12 @@ _mesa_init_exec_table(struct _glapi_table *exec)
#if FEATURE_EXT_framebuffer_blit
SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
#endif
+
+ /* GL_EXT_gpu_program_parmaeters */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);
+ SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);
+#endif
}