X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fdlist.c;h=49bc2933bf56635758cdda3b42bb5d60ed79794a;hb=1c70cde8881f794782780cbd695da0882f78c769;hp=790cace05cdf2ba40205d92d1d57479eb6fe6e57;hpb=b87957d59ab961a91b5151fc8af17464a6a8edef;p=mesa.git diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 790cace05cd..49bc2933bf5 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * @@ -43,6 +43,7 @@ #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" #endif +#include "arrayobj.h" #include "clip.h" #include "colormac.h" #include "colortab.h" @@ -342,8 +343,6 @@ typedef enum OPCODE_ATTR_3F_ARB, OPCODE_ATTR_4F_ARB, OPCODE_MATERIAL, - OPCODE_INDEX, - OPCODE_EDGEFLAG, OPCODE_BEGIN, OPCODE_END, OPCODE_RECTF, @@ -427,27 +426,28 @@ make_list(GLuint list, GLuint count) } +/** + * Lookup function to just encapsulate casting. + */ +static INLINE struct mesa_display_list * +lookup_list(GLcontext *ctx, GLuint list) +{ + return (struct mesa_display_list *) + _mesa_HashLookup(ctx->Shared->DisplayList, list); +} + + /** - * Destroy all nodes in a display list. - * \param list - display list number + * Delete the named display list, but don't remove from hash table. + * \param dlist - display list pointer */ void -_mesa_destroy_list(GLcontext *ctx, GLuint list) +_mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist) { - struct mesa_display_list *dlist; Node *n, *block; GLboolean done; - if (list == 0) - return; - - dlist = - (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, - list); - if (!dlist) - return; - n = block = dlist->node; done = block ? GL_FALSE : GL_TRUE; @@ -587,10 +587,29 @@ _mesa_destroy_list(GLcontext *ctx, GLuint list) } _mesa_free(dlist); - _mesa_HashRemove(ctx->Shared->DisplayList, list); } +/** + * Destroy a display list and remove from hash table. + * \param list - display list number + */ +static void +destroy_list(GLcontext *ctx, GLuint list) +{ + struct mesa_display_list *dlist; + + if (list == 0) + return; + + dlist = lookup_list(ctx, list); + if (!dlist) + return; + + _mesa_delete_list(ctx, dlist); + _mesa_HashRemove(ctx->Shared->DisplayList, list); +} + /* * Translate the nth element of list from type to GLuint. @@ -4446,6 +4465,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) { + GLint 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, @@ -4648,6 +4699,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) { + GLint 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) @@ -4671,7 +4754,7 @@ save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ -#ifdef FEATURE_ARB_occlusion_query +#if FEATURE_ARB_occlusion_query static void GLAPIENTRY save_BeginQueryARB(GLenum target, GLuint id) @@ -5025,51 +5108,19 @@ save_EvalPoint2(GLint x, GLint y) static void GLAPIENTRY save_Indexf(GLfloat x) { - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_INDEX, 1); - if (n) { - n[1].f = x; - } - - ctx->ListState.ActiveIndex = 1; - ctx->ListState.CurrentIndex = x; - - if (ctx->ExecuteFlag) { - CALL_Indexf(ctx->Exec, (x)); - } + save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x); } static void GLAPIENTRY save_Indexfv(const GLfloat * v) { - save_Indexf(v[0]); + save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]); } static void GLAPIENTRY save_EdgeFlag(GLboolean x) { - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EDGEFLAG, 1); - if (n) { - n[1].b = x; - } - - ctx->ListState.ActiveEdgeFlag = 1; - ctx->ListState.CurrentEdgeFlag = x; - - if (ctx->ExecuteFlag) { - CALL_EdgeFlag(ctx->Exec, (x)); - } -} - -static void GLAPIENTRY -save_EdgeFlagv(const GLboolean * v) -{ - save_EdgeFlag(v[0]); + save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0 : 0.0); } static void GLAPIENTRY @@ -5647,7 +5698,7 @@ _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) static GLboolean islist(GLcontext *ctx, GLuint list) { - if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) { + if (list > 0 && lookup_list(ctx, list)) { return GL_TRUE; } else { @@ -5683,10 +5734,7 @@ execute_list(GLcontext *ctx, GLuint list) return; } - - dlist = - (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, - list); + dlist = lookup_list(ctx, list); if (!dlist) return; @@ -6526,12 +6574,6 @@ execute_list(GLcontext *ctx, GLuint list) CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f)); } break; - case OPCODE_INDEX: - CALL_Indexf(ctx->Exec, (n[1].f)); - break; - case OPCODE_EDGEFLAG: - CALL_EdgeFlag(ctx->Exec, (n[1].b)); - break; case OPCODE_BEGIN: CALL_Begin(ctx->Exec, (n[1].e)); break; @@ -6621,7 +6663,7 @@ _mesa_DeleteLists(GLuint list, GLsizei range) return; } for (i = list; i < list + range; i++) { - _mesa_destroy_list(ctx, i); + destroy_list(ctx, i); } } @@ -6717,9 +6759,6 @@ _mesa_NewList(GLuint list, GLenum mode) for (i = 0; i < MAT_ATTRIB_MAX; i++) ctx->ListState.ActiveMaterialSize[i] = 0; - ctx->ListState.ActiveIndex = 0; - ctx->ListState.ActiveEdgeFlag = 0; - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; ctx->Driver.NewList(ctx, list, mode); @@ -6750,7 +6789,7 @@ _mesa_EndList(void) (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); /* Destroy old list, if any */ - _mesa_destroy_list(ctx, ctx->ListState.CurrentListNum); + destroy_list(ctx, ctx->ListState.CurrentListNum); /* Install the list */ _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentList); @@ -7793,7 +7832,6 @@ _mesa_init_dlist_table(struct _glapi_table *table) /* GL 1.1 */ SET_AreTexturesResident(table, exec_AreTexturesResident); - SET_AreTexturesResidentEXT(table, exec_AreTexturesResident); SET_BindTexture(table, save_BindTexture); SET_ColorPointer(table, exec_ColorPointer); SET_CopyTexImage1D(table, save_CopyTexImage1D); @@ -7805,12 +7843,10 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_EdgeFlagPointer(table, exec_EdgeFlagPointer); SET_EnableClientState(table, exec_EnableClientState); SET_GenTextures(table, exec_GenTextures); - SET_GenTexturesEXT(table, exec_GenTextures); SET_GetPointerv(table, exec_GetPointerv); SET_IndexPointer(table, exec_IndexPointer); SET_InterleavedArrays(table, exec_InterleavedArrays); SET_IsTexture(table, exec_IsTexture); - SET_IsTextureEXT(table, exec_IsTexture); SET_NormalPointer(table, exec_NormalPointer); SET_PopClientAttrib(table, exec_PopClientAttrib); SET_PrioritizeTextures(table, save_PrioritizeTextures); @@ -7849,31 +7885,18 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D); SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D); SET_GetColorTable(table, exec_GetColorTable); - SET_GetColorTableEXT(table, exec_GetColorTable); SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv); - SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv); SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv); - SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv); SET_GetConvolutionFilter(table, exec_GetConvolutionFilter); - SET_GetConvolutionFilterEXT(table, exec_GetConvolutionFilter); SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv); - SET_GetConvolutionParameterfvEXT(table, exec_GetConvolutionParameterfv); SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv); - SET_GetConvolutionParameterivEXT(table, exec_GetConvolutionParameteriv); SET_GetHistogram(table, exec_GetHistogram); - SET_GetHistogramEXT(table, exec_GetHistogram); SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv); - SET_GetHistogramParameterfvEXT(table, exec_GetHistogramParameterfv); SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv); - SET_GetHistogramParameterivEXT(table, exec_GetHistogramParameteriv); SET_GetMinmax(table, exec_GetMinmax); - SET_GetMinmaxEXT(table, exec_GetMinmax); SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv); - SET_GetMinmaxParameterfvEXT(table, exec_GetMinmaxParameterfv); SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv); - SET_GetMinmaxParameterivEXT(table, exec_GetMinmaxParameteriv); SET_GetSeparableFilter(table, exec_GetSeparableFilter); - SET_GetSeparableFilterEXT(table, exec_GetSeparableFilter); SET_Histogram(table, save_Histogram); SET_Minmax(table, save_Minmax); SET_ResetHistogram(table, save_ResetHistogram); @@ -7895,6 +7918,15 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_TexSubImage3DEXT(table, save_TexSubImage3D); #endif + /* 14. GL_SGI_color_table */ +#if 0 + SET_ColorTableSGI(table, save_ColorTable); + SET_ColorSubTableSGI(table, save_ColorSubTable); + SET_GetColorTableSGI(table, exec_GetColorTable); + SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv); + SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv); +#endif + /* 30. GL_EXT_vertex_array */ SET_ColorPointerEXT(table, exec_ColorPointerEXT); SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT); @@ -7912,15 +7944,6 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_PointParameterfEXT(table, save_PointParameterfEXT); SET_PointParameterfvEXT(table, save_PointParameterfvEXT); - /* 78. GL_EXT_paletted_texture */ -#if 0 - SET_ColorTableEXT(table, save_ColorTable); - SET_ColorSubTableEXT(table, save_ColorSubTable); -#endif - SET_GetColorTableEXT(table, exec_GetColorTable); - SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv); - SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv); - /* 97. GL_EXT_compiled_vertex_array */ SET_LockArraysEXT(table, exec_LockArraysEXT); SET_UnlockArraysEXT(table, exec_UnlockArraysEXT); @@ -7992,7 +8015,7 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); - SET_IsProgramNV(table, _mesa_IsProgram); + SET_IsProgramNV(table, _mesa_IsProgramARB); SET_LoadProgramNV(table, save_LoadProgramNV); SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV); SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV); @@ -8037,6 +8060,12 @@ _mesa_init_dlist_table(struct _glapi_table *table) /* 268. GL_EXT_stencil_two_side */ SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT); + /* 273. GL_APPLE_vertex_array_object */ + SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE); + SET_DeleteVertexArraysAPPLE(table, _mesa_DeleteVertexArraysAPPLE); + SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE); + SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE); + /* ???. GL_EXT_depth_bounds_test */ SET_DepthBoundsEXT(table, save_DepthBoundsEXT); @@ -8079,7 +8108,7 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_BindProgramNV(table, save_BindProgramNV); SET_DeleteProgramsNV(table, _mesa_DeletePrograms); SET_GenProgramsNV(table, _mesa_GenPrograms); - SET_IsProgramNV(table, _mesa_IsProgram); + SET_IsProgramNV(table, _mesa_IsProgramARB); SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); @@ -8136,6 +8165,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 } @@ -8163,8 +8198,7 @@ print_list(GLcontext *ctx, GLuint list) return; } - dlist = (struct mesa_display_list *) - _mesa_HashLookup(ctx->Shared->DisplayList, list); + dlist = lookup_list(ctx, list); if (!dlist) return; @@ -8350,12 +8384,6 @@ print_list(GLcontext *ctx, GLuint list) _mesa_printf("MATERIAL %x %x: %f %f %f %f\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f); break; - case OPCODE_INDEX: - _mesa_printf("INDEX: %f\n", n[1].f); - break; - case OPCODE_EDGEFLAG: - _mesa_printf("EDGEFLAG: %d\n", n[1].i); - break; case OPCODE_BEGIN: _mesa_printf("BEGIN %x\n", n[1].i); break; @@ -8447,7 +8475,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->Color4f = save_Color4f; vfmt->Color4fv = save_Color4fv; vfmt->EdgeFlag = save_EdgeFlag; - vfmt->EdgeFlagv = save_EdgeFlagv; vfmt->End = save_End; vfmt->EvalCoord1f = save_EvalCoord1f; vfmt->EvalCoord1fv = save_EvalCoord1fv;