summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/dlist.c159
1 files changed, 148 insertions, 11 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index fa2ff4306b4..1fc0d39f8bd 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -269,6 +269,10 @@ typedef enum {
OPCODE_ACTIVE_STENCIL_FACE_EXT,
/* GL_EXT_depth_bounds_test */
OPCODE_DEPTH_BOUNDS_EXT,
+ /* GL_ARB_vertex/fragment_program */
+ OPCODE_PROGRAM_STRING_ARB,
+ OPCODE_PROGRAM_ENV_PARAMETER_ARB,
+
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
@@ -440,17 +444,23 @@ void _mesa_destroy_list( GLcontext *ctx, GLuint list )
break;
#if FEATURE_NV_vertex_program
case OPCODE_LOAD_PROGRAM_NV:
- FREE(n[4].data);
+ FREE(n[4].data); /* program string */
n += InstSize[n[0].opcode];
break;
case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
- FREE(n[2].data);
+ FREE(n[2].data); /* array of program ids */
n += InstSize[n[0].opcode];
break;
#endif
#if FEATURE_NV_fragment_program
case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
- FREE(n[3].data);
+ FREE(n[3].data); /* parameter name */
+ n += InstSize[n[0].opcode];
+ break;
+#endif
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ case OPCODE_PROGRAM_STRING_ARB:
+ FREE(n[4].data); /* program string */
n += InstSize[n[0].opcode];
break;
#endif
@@ -685,6 +695,10 @@ void _mesa_init_lists( void )
InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2;
/* GL_EXT_depth_bounds_test */
InstSize[OPCODE_DEPTH_BOUNDS_EXT] = 3;
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ InstSize[OPCODE_PROGRAM_STRING_ARB] = 5;
+ InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7;
+#endif
}
init_flag = 1;
}
@@ -4398,6 +4412,94 @@ static void save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+
+static void
+save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
+ const GLvoid *string)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ GLubyte *programCopy;
+
+ programCopy = (GLubyte *) _mesa_malloc(len);
+ if (!programCopy) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
+ return;
+ }
+ _mesa_memcpy(programCopy, string, len);
+
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_STRING_ARB, 4 );
+ if (n) {
+ n[1].e = target;
+ n[2].e = format;
+ n[3].i = len;
+ n[4].data = programCopy;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramStringARB)(target, format, len, string);
+ }
+}
+
+
+static void
+save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
+ GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = index;
+ n[3].f = x;
+ n[4].f = y;
+ n[5].f = z;
+ n[6].f = w;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->ProgramEnvParameter4fARB)( target, index, x, y, z, w);
+ }
+}
+
+
+static void
+save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
+ const GLfloat *params)
+{
+ save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
+ params[2], params[3]);
+}
+
+
+static void
+save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
+ GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ save_ProgramEnvParameter4fARB(target, index,
+ (GLfloat) x,
+ (GLfloat) y,
+ (GLfloat) z,
+ (GLfloat) w);
+}
+
+
+static void
+save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
+ const GLdouble *params)
+{
+ save_ProgramEnvParameter4fARB(target, index,
+ (GLfloat) params[0],
+ (GLfloat) params[1],
+ (GLfloat) params[2],
+ (GLfloat) params[3]);
+}
+
+#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
+
+
/* KW: Compile commands
*
@@ -5145,7 +5247,15 @@ execute_list( GLcontext *ctx, GLuint list )
case OPCODE_DEPTH_BOUNDS_EXT:
(*ctx->Exec->DepthBoundsEXT)(n[1].f, n[2].f);
break;
-
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ case OPCODE_PROGRAM_STRING_ARB:
+ (*ctx->Exec->ProgramStringARB)(n[1].e, n[2].e, n[3].i, n[4].data);
+ break;
+ case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
+ (*ctx->Exec->ProgramEnvParameter4fARB)(n[1].e, n[2].ui, n[3].f,
+ n[4].f, n[5].f, n[6].f);
+ break;
+#endif
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
break;
@@ -6129,8 +6239,9 @@ static void exec_MultiModeDrawElementsIBM(const GLenum *mode,
-/*
- * Assign all the pointers in <table> to point to Mesa's display list
+
+/**
+ * Setup the given dispatch table to point to Mesa's display list
* building functions.
*
* This does not include any of the tnl functions - they are
@@ -6595,13 +6706,40 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
/* aliased with MESA_window_pos functions */
/* ARB 26. GL_ARB_vertex_program */
- /* XXX todo */
- /* ARB 27. GL_ARB_vertex_program */
- /* XXX todo */
+ /* ARB 27. GL_ARB_fragment_program */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
+ table->VertexAttribPointerARB = _mesa_VertexAttribPointerARB;
+ table->EnableVertexAttribArrayARB = _mesa_EnableVertexAttribArrayARB;
+ table->DisableVertexAttribArrayARB = _mesa_DisableVertexAttribArrayARB;
+ table->ProgramStringARB = save_ProgramStringARB;
+ table->BindProgramNV = _mesa_BindProgram;
+ table->DeleteProgramsNV = _mesa_DeletePrograms;
+ table->GenProgramsNV = _mesa_GenPrograms;
+ table->IsProgramNV = _mesa_IsProgram;
+ table->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
+ table->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
+ table->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
+ table->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
+ table->ProgramEnvParameter4dARB = save_ProgramEnvParameter4dARB;
+ table->ProgramEnvParameter4dvARB = save_ProgramEnvParameter4dvARB;
+ table->ProgramEnvParameter4fARB = save_ProgramEnvParameter4fARB;
+ table->ProgramEnvParameter4fvARB = save_ProgramEnvParameter4fvARB;
+ table->ProgramLocalParameter4dARB = save_ProgramLocalParameter4dARB;
+ table->ProgramLocalParameter4dvARB = save_ProgramLocalParameter4dvARB;
+ table->ProgramLocalParameter4fARB = save_ProgramLocalParameter4fARB;
+ table->ProgramLocalParameter4fvARB = save_ProgramLocalParameter4fvARB;
+ table->GetProgramEnvParameterdvARB = _mesa_GetProgramEnvParameterdvARB;
+ table->GetProgramEnvParameterfvARB = _mesa_GetProgramEnvParameterfvARB;
+ table->GetProgramLocalParameterdvARB = _mesa_GetProgramLocalParameterdvARB;
+ table->GetProgramLocalParameterfvARB = _mesa_GetProgramLocalParameterfvARB;
+ table->GetProgramivARB = _mesa_GetProgramivARB;
+ table->GetProgramStringARB = _mesa_GetProgramStringARB;
+#endif
/* ARB 28. GL_ARB_vertex_buffer_object */
#if FEATURE_ARB_vertex_buffer_object
- /* None of the extension functions get compiled */
+ /* None of the extension's functions get compiled */
table->BindBufferARB = _mesa_BindBufferARB;
table->BufferDataARB = _mesa_BufferDataARB;
table->BufferSubDataARB = _mesa_BufferSubDataARB;
@@ -6614,7 +6752,6 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->MapBufferARB = _mesa_MapBufferARB;
table->UnmapBufferARB = _mesa_UnmapBufferARB;
#endif
- /* XXX todo */
}