From c885775cae8feabe5431ba7867fac99332f5ee8e Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 7 Dec 2007 17:24:42 -0700 Subject: New vbo_set_draw_func() to keep vbo context opaque to state tracker and tnl module. --- src/mesa/vbo/vbo_context.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mesa/vbo/vbo_context.c') diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index ad4556c500..60d0b76ab6 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -31,6 +31,7 @@ #include "vbo.h" #include "vbo_context.h" +#if 0 /* Reach out and grab this to use as the default: */ extern void _tnl_draw_prims( GLcontext *ctx, @@ -40,6 +41,7 @@ extern void _tnl_draw_prims( GLcontext *ctx, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index ); +#endif @@ -214,7 +216,9 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) /* By default: */ +#if 0 /* dead - see vbo_set_draw_func() */ vbo->draw_prims = _tnl_draw_prims; +#endif /* Hook our functions into exec and compile dispatch tables. These * will pretty much be permanently installed, which means that the @@ -245,3 +249,11 @@ void _vbo_DestroyContext( GLcontext *ctx ) FREE(vbo_context(ctx)); ctx->swtnl_im = NULL; } + + +void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func) +{ + struct vbo_context *vbo = vbo_context(ctx); + vbo->draw_prims = func; +} + -- cgit v1.2.3 From 520a455f55f6c6c529dc6b725a5225793c0b4b01 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 28 Dec 2007 14:52:12 -0700 Subject: fix vbo display list memleak upon context destruction --- src/mesa/vbo/vbo_context.c | 1 + src/mesa/vbo/vbo_save.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/mesa/vbo/vbo_context.c') diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 60d0b76ab6..235cee2429 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -246,6 +246,7 @@ void _vbo_DestroyContext( GLcontext *ctx ) } vbo_exec_destroy(ctx); + vbo_save_destroy(ctx); FREE(vbo_context(ctx)); ctx->swtnl_im = NULL; } diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index 87248e10f3..8dd87141c0 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -69,6 +69,21 @@ void vbo_save_init( GLcontext *ctx ) void vbo_save_destroy( GLcontext *ctx ) { + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_save_context *save = &vbo->save; + if (save->prim_store) { + if ( --save->prim_store->refcount == 0 ) { + FREE( save->prim_store ); + save->prim_store = NULL; + } + if ( --save->vertex_store->refcount == 0 ) { + if (save->vertex_store->bufferobj) + ctx->Driver.DeleteBuffer( ctx, save->vertex_store->bufferobj ); + + FREE( save->vertex_store ); + save->vertex_store = NULL; + } + } } -- cgit v1.2.3 From 40d1a40f294f1ed2dacfad6f5498322fc08cc2d1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 10 Jun 2008 16:13:42 -0600 Subject: mesa: refactor: move #define FEATURE flags into new mfeatures.h file Also, check the FEATURE flags in many places. --- src/mesa/main/api_exec.c | 140 ++++++++++++++++++++++++++++++-------------- src/mesa/main/api_exec.h | 5 +- src/mesa/main/api_noop.c | 9 +++ src/mesa/main/config.h | 38 ++---------- src/mesa/main/context.c | 50 +++++++++++++++- src/mesa/main/mfeatures.h | 77 ++++++++++++++++++++++++ src/mesa/main/state.c | 4 ++ src/mesa/main/texformat.c | 26 +++++--- src/mesa/main/teximage.c | 21 ++++++- src/mesa/main/texobj.c | 4 ++ src/mesa/main/texstate.c | 15 +++-- src/mesa/main/texstore.c | 17 +++++- src/mesa/vbo/vbo_context.c | 5 +- src/mesa/vbo/vbo_context.h | 6 +- src/mesa/vbo/vbo_exec.c | 1 - src/mesa/vbo/vbo_exec_api.c | 4 ++ 16 files changed, 323 insertions(+), 99 deletions(-) create mode 100644 src/mesa/main/mfeatures.h (limited to 'src/mesa/vbo/vbo_context.c') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 8cdbaada9b..f7cf42f600 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -30,7 +30,9 @@ #include "glheader.h" +#if FEATURE_accum #include "accum.h" +#endif #include "api_loopback.h" #include "api_exec.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program @@ -39,25 +41,42 @@ #if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" #endif +#if FEATURE_attrib_stack #include "attrib.h" +#endif #include "blend.h" #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" #endif #include "arrayobj.h" +#if FEATURE_draw_read_buffer #include "buffers.h" +#endif #include "clear.h" #include "clip.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" +#if FEATURE_convolution #include "convolve.h" +#endif #include "depth.h" +#if FEATURE_dlist #include "dlist.h" +#endif +#if FEATURE_drawpix #include "drawpix.h" +#include "rastpos.h" +#endif #include "enable.h" +#if FEATURE_evaluators #include "eval.h" +#endif #include "get.h" +#if FEATURE_feadback #include "feedback.h" +#endif #include "fog.h" #if FEATURE_EXT_framebuffer_object #include "fbobject.h" @@ -65,21 +84,24 @@ #include "ffvertex_prog.h" #include "framebuffer.h" #include "hint.h" +#if FEATURE_histogram #include "histogram.h" +#endif #include "imports.h" #include "light.h" #include "lines.h" #include "macros.h" #include "matrix.h" #include "multisample.h" +#if FEATURE_pixel_transfer #include "pixel.h" +#endif #include "pixelstore.h" #include "points.h" #include "polygon.h" #if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query #include "queryobj.h" #endif -#include "rastpos.h" #include "readpix.h" #include "scissor.h" #include "state.h" @@ -131,7 +153,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_ColorMask(exec, _mesa_ColorMask); SET_CullFace(exec, _mesa_CullFace); SET_Disable(exec, _mesa_Disable); +#if FEATURE_draw_read_buffer SET_DrawBuffer(exec, _mesa_DrawBuffer); + SET_ReadBuffer(exec, _mesa_ReadBuffer); +#endif SET_Enable(exec, _mesa_Enable); SET_Finish(exec, _mesa_Finish); SET_Flush(exec, _mesa_Flush); @@ -140,31 +165,20 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GetError(exec, _mesa_GetError); SET_GetFloatv(exec, _mesa_GetFloatv); SET_GetString(exec, _mesa_GetString); - SET_InitNames(exec, _mesa_InitNames); SET_LineStipple(exec, _mesa_LineStipple); SET_LineWidth(exec, _mesa_LineWidth); SET_LoadIdentity(exec, _mesa_LoadIdentity); SET_LoadMatrixf(exec, _mesa_LoadMatrixf); - SET_LoadName(exec, _mesa_LoadName); SET_LogicOp(exec, _mesa_LogicOp); SET_MatrixMode(exec, _mesa_MatrixMode); SET_MultMatrixf(exec, _mesa_MultMatrixf); SET_Ortho(exec, _mesa_Ortho); SET_PixelStorei(exec, _mesa_PixelStorei); SET_PopMatrix(exec, _mesa_PopMatrix); - SET_PopName(exec, _mesa_PopName); SET_PushMatrix(exec, _mesa_PushMatrix); - SET_PushName(exec, _mesa_PushName); - SET_RasterPos2f(exec, _mesa_RasterPos2f); - SET_RasterPos2fv(exec, _mesa_RasterPos2fv); - SET_RasterPos2i(exec, _mesa_RasterPos2i); - SET_RasterPos2iv(exec, _mesa_RasterPos2iv); - SET_ReadBuffer(exec, _mesa_ReadBuffer); - SET_RenderMode(exec, _mesa_RenderMode); SET_Rotatef(exec, _mesa_Rotatef); SET_Scalef(exec, _mesa_Scalef); SET_Scissor(exec, _mesa_Scissor); - SET_SelectBuffer(exec, _mesa_SelectBuffer); SET_ShadeModel(exec, _mesa_ShadeModel); SET_StencilFunc(exec, _mesa_StencilFunc); SET_StencilMask(exec, _mesa_StencilMask); @@ -175,46 +189,57 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_TexParameteri(exec, _mesa_TexParameteri); SET_Translatef(exec, _mesa_Translatef); SET_Viewport(exec, _mesa_Viewport); -#if _HAVE_FULL_GL +#if FEATURE_accum SET_Accum(exec, _mesa_Accum); - SET_Bitmap(exec, _mesa_Bitmap); + SET_ClearAccum(exec, _mesa_ClearAccum); +#endif +#if FEATURE_dlist SET_CallList(exec, _mesa_CallList); SET_CallLists(exec, _mesa_CallLists); - SET_ClearAccum(exec, _mesa_ClearAccum); + SET_DeleteLists(exec, _mesa_DeleteLists); + SET_EndList(exec, _mesa_EndList); + SET_GenLists(exec, _mesa_GenLists); + SET_IsList(exec, _mesa_IsList); + SET_ListBase(exec, _mesa_ListBase); + SET_NewList(exec, _mesa_NewList); +#endif SET_ClearDepth(exec, _mesa_ClearDepth); SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClipPlane(exec, _mesa_ClipPlane); SET_ColorMaterial(exec, _mesa_ColorMaterial); - SET_CopyPixels(exec, _mesa_CopyPixels); SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); - SET_DeleteLists(exec, _mesa_DeleteLists); SET_DepthFunc(exec, _mesa_DepthFunc); SET_DepthMask(exec, _mesa_DepthMask); SET_DepthRange(exec, _mesa_DepthRange); +#if FEATURE_drawpix + SET_Bitmap(exec, _mesa_Bitmap); + SET_CopyPixels(exec, _mesa_CopyPixels); SET_DrawPixels(exec, _mesa_DrawPixels); - SET_EndList(exec, _mesa_EndList); +#endif +#if FEATURE_feadback + SET_InitNames(exec, _mesa_InitNames); SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); + SET_LoadName(exec, _mesa_LoadName); + SET_PassThrough(exec, _mesa_PassThrough); + SET_PopName(exec, _mesa_PopName); + SET_PushName(exec, _mesa_PushName); + SET_SelectBuffer(exec, _mesa_SelectBuffer); + SET_RenderMode(exec, _mesa_RenderMode); +#endif SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); SET_Fogf(exec, _mesa_Fogf); SET_Fogfv(exec, _mesa_Fogfv); SET_Fogi(exec, _mesa_Fogi); SET_Fogiv(exec, _mesa_Fogiv); - SET_GenLists(exec, _mesa_GenLists); SET_GetClipPlane(exec, _mesa_GetClipPlane); SET_GetBooleanv(exec, _mesa_GetBooleanv); SET_GetDoublev(exec, _mesa_GetDoublev); SET_GetIntegerv(exec, _mesa_GetIntegerv); SET_GetLightfv(exec, _mesa_GetLightfv); SET_GetLightiv(exec, _mesa_GetLightiv); - SET_GetMapdv(exec, _mesa_GetMapdv); - SET_GetMapfv(exec, _mesa_GetMapfv); - SET_GetMapiv(exec, _mesa_GetMapiv); SET_GetMaterialfv(exec, _mesa_GetMaterialfv); SET_GetMaterialiv(exec, _mesa_GetMaterialiv); - SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); - SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); - SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); SET_GetTexEnviv(exec, _mesa_GetTexEnviv); @@ -222,14 +247,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); - SET_GetTexGendv(exec, _mesa_GetTexGendv); - SET_GetTexGenfv(exec, _mesa_GetTexGenfv); - SET_GetTexGeniv(exec, _mesa_GetTexGeniv); SET_GetTexImage(exec, _mesa_GetTexImage); SET_Hint(exec, _mesa_Hint); SET_IndexMask(exec, _mesa_IndexMask); SET_IsEnabled(exec, _mesa_IsEnabled); - SET_IsList(exec, _mesa_IsList); SET_LightModelf(exec, _mesa_LightModelf); SET_LightModelfv(exec, _mesa_LightModelfv); SET_LightModeli(exec, _mesa_LightModeli); @@ -238,8 +259,11 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Lightfv(exec, _mesa_Lightfv); SET_Lighti(exec, _mesa_Lighti); SET_Lightiv(exec, _mesa_Lightiv); - SET_ListBase(exec, _mesa_ListBase); SET_LoadMatrixd(exec, _mesa_LoadMatrixd); +#if FEATURE_evaluators + SET_GetMapdv(exec, _mesa_GetMapdv); + SET_GetMapfv(exec, _mesa_GetMapfv); + SET_GetMapiv(exec, _mesa_GetMapiv); SET_Map1d(exec, _mesa_Map1d); SET_Map1f(exec, _mesa_Map1f); SET_Map2d(exec, _mesa_Map2d); @@ -248,22 +272,35 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_MapGrid1f(exec, _mesa_MapGrid1f); SET_MapGrid2d(exec, _mesa_MapGrid2d); SET_MapGrid2f(exec, _mesa_MapGrid2f); +#endif SET_MultMatrixd(exec, _mesa_MultMatrixd); - SET_NewList(exec, _mesa_NewList); - SET_PassThrough(exec, _mesa_PassThrough); +#if FEATURE_pixel_transfer + SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); + SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); + SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); SET_PixelMapfv(exec, _mesa_PixelMapfv); SET_PixelMapuiv(exec, _mesa_PixelMapuiv); SET_PixelMapusv(exec, _mesa_PixelMapusv); - SET_PixelStoref(exec, _mesa_PixelStoref); SET_PixelTransferf(exec, _mesa_PixelTransferf); SET_PixelTransferi(exec, _mesa_PixelTransferi); SET_PixelZoom(exec, _mesa_PixelZoom); +#endif + SET_PixelStoref(exec, _mesa_PixelStoref); SET_PointSize(exec, _mesa_PointSize); SET_PolygonMode(exec, _mesa_PolygonMode); SET_PolygonOffset(exec, _mesa_PolygonOffset); SET_PolygonStipple(exec, _mesa_PolygonStipple); +#if FEATURE_attrib_stack SET_PopAttrib(exec, _mesa_PopAttrib); SET_PushAttrib(exec, _mesa_PushAttrib); + SET_PopClientAttrib(exec, _mesa_PopClientAttrib); + SET_PushClientAttrib(exec, _mesa_PushClientAttrib); +#endif +#if FEATURE_drawpix + SET_RasterPos2f(exec, _mesa_RasterPos2f); + SET_RasterPos2fv(exec, _mesa_RasterPos2fv); + SET_RasterPos2i(exec, _mesa_RasterPos2i); + SET_RasterPos2iv(exec, _mesa_RasterPos2iv); SET_RasterPos2d(exec, _mesa_RasterPos2d); SET_RasterPos2dv(exec, _mesa_RasterPos2dv); SET_RasterPos2s(exec, _mesa_RasterPos2s); @@ -284,24 +321,31 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_RasterPos4iv(exec, _mesa_RasterPos4iv); SET_RasterPos4s(exec, _mesa_RasterPos4s); SET_RasterPos4sv(exec, _mesa_RasterPos4sv); +#endif SET_ReadPixels(exec, _mesa_ReadPixels); SET_Rotated(exec, _mesa_Rotated); SET_Scaled(exec, _mesa_Scaled); SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); SET_TexEnvf(exec, _mesa_TexEnvf); SET_TexEnviv(exec, _mesa_TexEnviv); + +#if FEATURE_texgen + SET_GetTexGendv(exec, _mesa_GetTexGendv); + SET_GetTexGenfv(exec, _mesa_GetTexGenfv); + SET_GetTexGeniv(exec, _mesa_GetTexGeniv); SET_TexGend(exec, _mesa_TexGend); SET_TexGendv(exec, _mesa_TexGendv); SET_TexGenf(exec, _mesa_TexGenf); SET_TexGenfv(exec, _mesa_TexGenfv); SET_TexGeni(exec, _mesa_TexGeni); SET_TexGeniv(exec, _mesa_TexGeniv); +#endif + SET_TexImage1D(exec, _mesa_TexImage1D); SET_TexParameterf(exec, _mesa_TexParameterf); SET_TexParameterfv(exec, _mesa_TexParameterfv); SET_TexParameteriv(exec, _mesa_TexParameteriv); SET_Translated(exec, _mesa_Translated); -#endif /* 1.1 */ SET_BindTexture(exec, _mesa_BindTexture); @@ -322,9 +366,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_InterleavedArrays(exec, _mesa_InterleavedArrays); SET_IsTexture(exec, _mesa_IsTexture); SET_NormalPointer(exec, _mesa_NormalPointer); - SET_PopClientAttrib(exec, _mesa_PopClientAttrib); SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); - SET_PushClientAttrib(exec, _mesa_PushClientAttrib); SET_TexCoordPointer(exec, _mesa_TexCoordPointer); SET_TexSubImage1D(exec, _mesa_TexSubImage1D); SET_TexSubImage2D(exec, _mesa_TexSubImage2D); @@ -339,30 +381,37 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* OpenGL 1.2 GL_ARB_imaging */ -#if _HAVE_FULL_GL SET_BlendColor(exec, _mesa_BlendColor); SET_BlendEquation(exec, _mesa_BlendEquation); SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); + +#if FEATURE_colortable SET_ColorSubTable(exec, _mesa_ColorSubTable); SET_ColorTable(exec, _mesa_ColorTable); SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); + SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); + SET_CopyColorTable(exec, _mesa_CopyColorTable); + SET_GetColorTable(exec, _mesa_GetColorTable); + SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); +#endif + +#if FEATURE_convolution SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); - SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); - SET_CopyColorTable(exec, _mesa_CopyColorTable); SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); - SET_GetColorTable(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); + SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); +#endif +#if FEATURE_histogram SET_GetHistogram(exec, _mesa_GetHistogram); SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); @@ -374,7 +423,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Minmax(exec, _mesa_Minmax); SET_ResetHistogram(exec, _mesa_ResetHistogram); SET_ResetMinmax(exec, _mesa_ResetMinmax); - SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); #endif /* OpenGL 2.0 */ @@ -488,7 +536,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* 197. GL_MESA_window_pos */ -#if _HAVE_FULL_GL +#if FEATURE_drawpix SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); @@ -715,8 +763,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* ARB 37. GL_ARB_draw_buffers */ +#if FEATURE_draw_read_buffer SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); - +#endif + #if FEATURE_ARB_shader_objects SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); SET_GetHandleARB(exec, _mesa_GetHandleARB); diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h index 7f15ea9d00..4bd715053a 100644 --- a/src/mesa/main/api_exec.h +++ b/src/mesa/main/api_exec.h @@ -27,7 +27,10 @@ #define API_EXEC_H -void +struct _glapi_table; + + +extern void _mesa_init_exec_table(struct _glapi_table *exec); diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 3df64362ea..a1cc3a2a4b 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -30,7 +30,9 @@ #include "context.h" #include "light.h" #include "macros.h" +#if FEATURE_dlist #include "dlist.h" +#endif #include "glapi/dispatch.h" @@ -621,6 +623,8 @@ static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLf (void) a; (void) b; (void) c; (void) d; } + +#if FEATURE_evaluators /* Similarly, these have no effect outside begin/end: */ static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ) @@ -652,6 +656,7 @@ static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ) { (void) a; (void) b; } +#endif /* FEATURE_evaluators */ /* Begin -- call into driver, should result in the vtxfmt being @@ -904,20 +909,24 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) { vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = _mesa_noop_Begin; +#if FEATURE_dlist vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; +#endif vfmt->Color3f = _mesa_noop_Color3f; vfmt->Color3fv = _mesa_noop_Color3fv; vfmt->Color4f = _mesa_noop_Color4f; vfmt->Color4fv = _mesa_noop_Color4fv; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->End = _mesa_noop_End; +#if FEATURE_evaluators vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; +#endif vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; vfmt->Indexf = _mesa_noop_Indexf; diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 232e698f50..9ff0b708dd 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -31,6 +31,10 @@ #ifndef MESA_CONFIG_H_INCLUDED #define MESA_CONFIG_H_INCLUDED + +#include "main/mfeatures.h" + + /** * \name OpenGL implementation limits */ @@ -283,40 +287,6 @@ #define ACOMP 3 -/* - * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1. - */ -#ifndef _HAVE_FULL_GL -#define _HAVE_FULL_GL 1 -#endif - -#define FEATURE_userclip _HAVE_FULL_GL -#define FEATURE_texgen _HAVE_FULL_GL -#define FEATURE_windowpos _HAVE_FULL_GL -#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL -#define FEATURE_ARB_fragment_program _HAVE_FULL_GL -#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL -#define FEATURE_ARB_vertex_program _HAVE_FULL_GL - -#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL -#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL -#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) -#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects -#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects - -#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL -#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL -#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL -#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL -#define FEATURE_EXT_timer_query _HAVE_FULL_GL -#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL -#define FEATURE_MESA_program_debug _HAVE_FULL_GL -#define FEATURE_NV_fence _HAVE_FULL_GL -#define FEATURE_NV_fragment_program _HAVE_FULL_GL -#define FEATURE_NV_vertex_program _HAVE_FULL_GL -/*@}*/ - - /** * Maximum number of temporary vertices required for clipping. * diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 1b357ae6c2..d975814592 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -78,27 +78,41 @@ #include "glheader.h" #include "imports.h" +#if FEATURE_accum #include "accum.h" +#endif #include "api_exec.h" #include "arrayobj.h" +#if FEATURE_attrib_stack #include "attrib.h" +#endif #include "blend.h" #include "buffers.h" #include "bufferobj.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" #include "debug.h" #include "depth.h" +#if FEATURE_dlist #include "dlist.h" +#endif +#if FEATURE_evaluators #include "eval.h" +#endif #include "enums.h" #include "extensions.h" #include "fbobject.h" +#if FEATURE_feedback #include "feedback.h" +#endif #include "fog.h" #include "framebuffer.h" #include "get.h" +#if FEATURE_histogram #include "histogram.h" +#endif #include "hint.h" #include "hash.h" #include "light.h" @@ -106,12 +120,16 @@ #include "macros.h" #include "matrix.h" #include "multisample.h" +#if FEATURE_pixel_transfer #include "pixel.h" +#endif #include "pixelstore.h" #include "points.h" #include "polygon.h" #include "queryobj.h" +#if FEATURE_drawpix #include "rastpos.h" +#endif #include "scissor.h" #include "simple_list.h" #include "state.h" @@ -573,9 +591,11 @@ alloc_shared_state( GLcontext *ctx ) static void delete_displaylist_cb(GLuint id, void *data, void *userData) { +#if FEATURE_dlist struct mesa_display_list *list = (struct mesa_display_list *) data; GLcontext *ctx = (GLcontext *) userData; _mesa_delete_list(ctx, list); +#endif } /** @@ -954,31 +974,49 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_extensions( ctx ); /* Attribute Groups */ +#if FEATURE_accum _mesa_init_accum( ctx ); +#endif +#if FEATURE_attrib_stack _mesa_init_attrib( ctx ); +#endif _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); +#if FEATURE_colortable _mesa_init_colortables( ctx ); +#endif _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); +#if FEATURE_dlist _mesa_init_display_list( ctx ); +#endif +#if FEATURE_evaluators _mesa_init_eval( ctx ); +#endif +#if FEATURE_feedback _mesa_init_feedback( ctx ); +#endif _mesa_init_fog( ctx ); +#if FEATURE_histogram _mesa_init_histogram( ctx ); +#endif _mesa_init_hint( ctx ); _mesa_init_line( ctx ); _mesa_init_lighting( ctx ); _mesa_init_matrix( ctx ); _mesa_init_multisample( ctx ); +#if FEATURE_pixel_transfer _mesa_init_pixel( ctx ); +#endif _mesa_init_pixelstore( ctx ); _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); _mesa_init_program( ctx ); _mesa_init_query( ctx ); +#if FEATURE_drawpix _mesa_init_rastpos( ctx ); +#endif _mesa_init_scissor( ctx ); _mesa_init_shader_state( ctx ); _mesa_init_stencil( ctx ); @@ -989,8 +1027,12 @@ init_attrib_groups(GLcontext *ctx) if (!_mesa_init_texture( ctx )) return GL_FALSE; +#if FEATURE_texture_s3tc _mesa_init_texture_s3tc( ctx ); +#endif +#if FEATURE_texture_fxt1 _mesa_init_texture_fxt1( ctx ); +#endif /* Miscellaneous */ ctx->NewState = _NEW_ALL; @@ -1123,14 +1165,14 @@ _mesa_initialize_context(GLcontext *ctx, } _mesa_init_exec_table(ctx->Exec); ctx->CurrentDispatch = ctx->Exec; -#if _HAVE_FULL_GL +#if FEATURE_dlist _mesa_init_dlist_table(ctx->Save); _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); +#endif /* Neutral tnl module stuff */ _mesa_init_exec_vtxfmt( ctx ); ctx->TnlModule.Current = NULL; ctx->TnlModule.SwapCount = 0; -#endif ctx->FragmentProgram._MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); @@ -1220,11 +1262,15 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); _mesa_free_lighting_data( ctx ); +#if FEATURE_evaluators _mesa_free_eval_data( ctx ); +#endif _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); +#if FEATURE_colortable _mesa_free_colortables_data( ctx ); +#endif _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); _mesa_free_query_data(ctx); diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h new file mode 100644 index 0000000000..228de76af1 --- /dev/null +++ b/src/mesa/main/mfeatures.h @@ -0,0 +1,77 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file mfeatures.h + * Flags to enable/disable specific parts of the API. + */ + +#ifndef FEATURES_H +#define FEATURES_H + + +#ifndef _HAVE_FULL_GL +#define _HAVE_FULL_GL 1 +#endif + +#define FEATURE_accum _HAVE_FULL_GL +#define FEATURE_attrib_stacks _HAVE_FULL_GL +#define FEATURE_colortable _HAVE_FULL_GL +#define FEATURE_convolution _HAVE_FULL_GL +#define FEATURE_dlist _HAVE_FULL_GL +#define FEATURE_draw_read_buffer _HAVE_FULL_GL +#define FEATURE_drawpix _HAVE_FULL_GL +#define FEATURE_evaluators _HAVE_FULL_GL +#define FEATURE_feedback _HAVE_FULL_GL +#define FEATURE_histogram _HAVE_FULL_GL +#define FEATURE_pixeltransfer _HAVE_FULL_GL +#define FEATURE_texgen _HAVE_FULL_GL +#define FEATURE_texture_fxt1 _HAVE_FULL_GL +#define FEATURE_texture_s3tc _HAVE_FULL_GL +#define FEATURE_userclip _HAVE_FULL_GL + +#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL +#define FEATURE_ARB_fragment_program _HAVE_FULL_GL +#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL +#define FEATURE_ARB_vertex_program _HAVE_FULL_GL +#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL +#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL +#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) +#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects +#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects + +#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL +#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL +#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL +#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL +#define FEATURE_EXT_timer_query _HAVE_FULL_GL +#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL +#define FEATURE_MESA_program_debug _HAVE_FULL_GL +#define FEATURE_NV_fence _HAVE_FULL_GL +#define FEATURE_NV_fragment_program _HAVE_FULL_GL +#define FEATURE_NV_vertex_program _HAVE_FULL_GL + + +#endif /* FEATURES_H */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 89920f8443..4d1fdbf47c 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -40,7 +40,9 @@ #include "framebuffer.h" #include "light.h" #include "matrix.h" +#if FEATURE_pixel_transfer #include "pixel.h" +#endif #include "shader/program.h" #include "state.h" #include "stencil.h" @@ -412,8 +414,10 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & _NEW_STENCIL) _mesa_update_stencil( ctx ); +#if FEATURE_pixel_transfer if (new_state & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_pixel( ctx, new_state ); +#endif if (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) update_arrays( ctx ); diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 17859a9fec..a35195a695 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1449,21 +1449,27 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_COMPRESSED_INTENSITY_ARB: return &_mesa_texformat_intensity; case GL_COMPRESSED_RGB_ARB: +#if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) return &_mesa_texformat_rgb_fxt1; - else if (ctx->Extensions.EXT_texture_compression_s3tc || - ctx->Extensions.S3_s3tc) +#endif +#if FEATURE_texture_s3tc + if (ctx->Extensions.EXT_texture_compression_s3tc || + ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgb_dxt1; - else - return &_mesa_texformat_rgb; +#endif + return &_mesa_texformat_rgb; case GL_COMPRESSED_RGBA_ARB: +#if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) return &_mesa_texformat_rgba_fxt1; - else if (ctx->Extensions.EXT_texture_compression_s3tc || - ctx->Extensions.S3_s3tc) +#endif +#if FEATURE_texture_s3tc + if (ctx->Extensions.EXT_texture_compression_s3tc || + ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ - else - return &_mesa_texformat_rgba; +#endif + return &_mesa_texformat_rgba; default: ; /* fallthrough */ } @@ -1478,6 +1484,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, } } +#if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: @@ -1488,7 +1495,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ; /* fallthrough */ } } +#endif +#if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: @@ -1516,6 +1525,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ; /* fallthrough */ } } +#endif if (ctx->Extensions.ARB_texture_float) { switch (internalFormat) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 384e145520..eed1937517 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -32,7 +32,9 @@ #include "glheader.h" #include "bufferobj.h" #include "context.h" +#if FEATURE_convolve #include "convolve.h" +#endif #include "fbobject.h" #include "framebuffer.h" #include "image.h" @@ -2429,9 +2431,11 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } +#endif if (target == GL_TEXTURE_1D) { /* non-proxy target */ @@ -2524,10 +2528,12 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } +#endif if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && @@ -2746,10 +2752,12 @@ _mesa_TexSubImage1D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ if (is_color_format(format)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } +#endif if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1, 1, format, type)) { @@ -2804,11 +2812,13 @@ _mesa_TexSubImage2D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ if (is_color_format(format)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } +#endif if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight, 1, format, type)) { @@ -2918,9 +2928,11 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } +#endif if (copytexture_error_check(ctx, 1, target, level, internalFormat, postConvWidth, 1, border)) @@ -2981,11 +2993,12 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } - +#endif if (copytexture_error_check(ctx, 2, target, level, internalFormat, postConvWidth, postConvHeight, border)) return; @@ -3047,8 +3060,10 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); +#endif if (copytexsubimage_error_check(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1)) @@ -3100,8 +3115,10 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); +#endif if (copytexsubimage_error_check(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight)) @@ -3152,8 +3169,10 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); +#endif if (copytexsubimage_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, postConvWidth, postConvHeight)) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index df64002f99..606e62d7a0 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -29,7 +29,9 @@ #include "glheader.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" #include "enums.h" #include "fbobject.h" @@ -153,7 +155,9 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) (void) ctx; +#if FEATURE_colortable _mesa_free_colortable_data(&texObj->Palette); +#endif /* free the texture images */ for (face = 0; face < 6; face++) { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 84acfbd92c..2a83d6df4a 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -30,7 +30,9 @@ #include "glheader.h" #include "colormac.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" #include "enums.h" #include "macros.h" @@ -3213,7 +3215,9 @@ _mesa_init_texture(GLcontext *ctx) for (i=0; iTexture.SharedPalette = GL_FALSE; +#if FEATURE_colortable _mesa_init_colortable(&ctx->Texture.Palette); +#endif /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) @@ -3229,8 +3233,6 @@ _mesa_init_texture(GLcontext *ctx) void _mesa_free_texture_data(GLcontext *ctx) { - GLuint i; - /* Free proxy texture objects */ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D ); @@ -3240,6 +3242,11 @@ _mesa_free_texture_data(GLcontext *ctx) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1DArray ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2DArray ); - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); +#if FEATURE_colortable + { + GLuint i; + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); + } +#endif } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index a6a18910fc..5ac6116950 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -55,7 +55,9 @@ #include "bufferobj.h" #include "colormac.h" #include "context.h" +#if FEATURE_convolve #include "convolve.h" +#endif #include "image.h" #include "macros.h" #include "mipmap.h" @@ -269,6 +271,16 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat, } +#if !FEATURE_convolve +static void +_mesa_adjust_image_for_convolution(GLcontext *ctx, GLuint dims, + GLsizei *srcWidth, GLsizei *srcHeight) +{ + /* no-op */ +} +#endif + + /** * Make a temporary (color) texture image with GLfloat components. * Apply all needed pixel unpacking and pixel transfer operations. @@ -368,6 +380,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, dst += srcWidth * 4; } +#if FEATURE_convolve /* do convolution */ { GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4); @@ -389,7 +402,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, } } } - +#endif /* do post-convolution transfer and pack into tempImage */ { const GLint logComponents @@ -546,6 +559,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, textureBaseFormat == GL_ALPHA || textureBaseFormat == GL_INTENSITY); +#if FEATURE_convolve if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { @@ -567,6 +581,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, transferOps = 0; freeSrcImage = GL_TRUE; } +#endif /* unpack and transfer the source image */ tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 235cee2429..dc7c534251 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -225,9 +225,10 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) * vtxfmt mechanism can be removed now. */ vbo_exec_init( ctx ); +#if FEATURE_dlist vbo_save_init( ctx ); +#endif - return GL_TRUE; } @@ -246,7 +247,9 @@ void _vbo_DestroyContext( GLcontext *ctx ) } vbo_exec_destroy(ctx); +#if FEATURE_dlist vbo_save_destroy(ctx); +#endif FREE(vbo_context(ctx)); ctx->swtnl_im = NULL; } diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 013f81bdd5..bf405eb693 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -53,8 +53,10 @@ #include "vbo.h" #include "vbo_attrib.h" -#include "vbo_save.h" #include "vbo_exec.h" +#if FEATURE_dlist +#include "vbo_save.h" +#endif struct vbo_context { @@ -74,7 +76,9 @@ struct vbo_context { struct vbo_exec_context exec; +#if FEATURE_dlist struct vbo_save_context save; +#endif /* Callback into the driver. This must always succeed, the driver * is responsible for initiating any fallback actions required: diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c index 1efa74945d..635f239acc 100644 --- a/src/mesa/vbo/vbo_exec.c +++ b/src/mesa/vbo/vbo_exec.c @@ -32,7 +32,6 @@ #include "main/context.h" #include "main/macros.h" #include "main/mtypes.h" -#include "main/dlist.h" #include "main/vtxfmt.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 98580170e3..5dd774d839 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -34,7 +34,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/macros.h" #include "main/vtxfmt.h" +#if FEATURE_dlist #include "main/dlist.h" +#endif #include "main/state.h" #include "main/light.h" #include "main/api_arrayelt.h" @@ -569,8 +571,10 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = vbo_exec_Begin; +#if FEATURE_dlist vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; +#endif vfmt->End = vbo_exec_End; vfmt->EvalCoord1f = vbo_exec_EvalCoord1f; vfmt->EvalCoord1fv = vbo_exec_EvalCoord1fv; -- cgit v1.2.3 From 4992806ae54d7d1db86eed9c6524aa05f4a2fbd6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 16 Sep 2008 08:49:43 -0600 Subject: mesa: protect against double-free in _vbo_DestroyContext() --- src/mesa/vbo/vbo_context.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/mesa/vbo/vbo_context.c') diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index dc7c534251..b452ac8a38 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -246,12 +246,14 @@ void _vbo_DestroyContext( GLcontext *ctx ) ctx->aelt_context = NULL; } - vbo_exec_destroy(ctx); + if (vbo_context(ctx)) { + vbo_exec_destroy(ctx); #if FEATURE_dlist - vbo_save_destroy(ctx); + vbo_save_destroy(ctx); #endif - FREE(vbo_context(ctx)); - ctx->swtnl_im = NULL; + FREE(vbo_context(ctx)); + ctx->swtnl_im = NULL; + } } -- cgit v1.2.3