diff options
author | Brian Paul <[email protected]> | 2000-05-04 13:48:49 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-05-04 13:48:49 +0000 |
commit | 1a1cf7ed75d799bbda34399ddab7949b8c06686e (patch) | |
tree | bc750639db55bb2da0db4d81b13ab03c97653974 /src | |
parent | f8825778121b2fe8c012b0ecb2c098865cbe84cb (diff) |
implemented GL_EXT_histogram extension
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/drawpix.c | 3 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 12 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 3 | ||||
-rw-r--r-- | src/mesa/main/get.c | 26 | ||||
-rw-r--r-- | src/mesa/main/image.c | 32 | ||||
-rw-r--r-- | src/mesa/main/state.c | 129 |
6 files changed, 130 insertions, 75 deletions
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 38ffcc85462..f2bbd8a913f 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.21 2000/04/18 14:32:10 brianp Exp $ */ +/* $Id: drawpix.c,v 1.22 2000/05/04 13:48:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -123,6 +123,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, && !ctx->Pixel.ColorTableEnabled && !ctx->Pixel.PostColorMatrixColorTableEnabled && !ctx->Pixel.MinMaxEnabled + && !ctx->Pixel.HistogramEnabled && ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0 && ctx->Pixel.MapColorFlag==0 && ctx->Texture.ReallyEnabled == 0 diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 8c71d87cd0f..b5e659afd10 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.15 2000/04/12 00:27:37 brianp Exp $ */ +/* $Id: enable.c,v 1.16 2000/05/04 13:48:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -154,6 +154,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->NewState |= NEW_FOG|NEW_RASTER_OPS; } break; + case GL_HISTOGRAM: + ctx->Pixel.HistogramEnabled = state; + break; case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: @@ -268,6 +271,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_MAP2_VERTEX_4: ctx->Eval.Map2Vertex4 = state; break; + case GL_MINMAX: + ctx->Pixel.MinMaxEnabled = state; + break; case GL_NORMALIZE: if (ctx->Transform.Normalize != state) { ctx->Transform.Normalize = state; @@ -552,6 +558,8 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Color.DitherFlag; case GL_FOG: return ctx->Fog.Enabled; + case GL_HISTOGRAM: + return ctx->Pixel.HistogramEnabled; case GL_LIGHTING: return ctx->Light.Enabled; case GL_LIGHT0: @@ -607,6 +615,8 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Eval.Map2Vertex3; case GL_MAP2_VERTEX_4: return ctx->Eval.Map2Vertex4; + case GL_MINMAX: + return ctx->Pixel.MinMaxEnabled; case GL_NORMALIZE: return ctx->Transform.Normalize; case GL_POINT_SMOOTH: diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index bd203e62a33..6c0837de138 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.24 2000/04/17 15:13:53 brianp Exp $ */ +/* $Id: extensions.c,v 1.25 2000/05/04 13:48:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -59,6 +59,7 @@ static struct { int enabled; const char *name; } default_extensions[] = { { DEFAULT_ON, "GL_EXT_blend_subtract" }, { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, + { DEFAULT_ON, "GL_EXT_histogram" }, { DEFAULT_ON, "GL_EXT_paletted_texture" }, { DEFAULT_ON, "GL_EXT_point_parameters" }, { ALWAYS_ENABLED, "GL_EXT_polygon_offset" }, diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 1d37a298bf4..0282c588336 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.21 2000/04/12 00:27:37 brianp Exp $ */ +/* $Id: get.c,v 1.22 2000/05/04 13:48:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -347,6 +347,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_GREEN_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); break; + case GL_HISTOGRAM: + *params = ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = INT_TO_BOOL( ctx->Visual->IndexBits ); break; @@ -568,6 +571,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = INT_TO_BOOL(MAX_WIDTH); params[1] = INT_TO_BOOL(MAX_HEIGHT); break; + case GL_MINMAX: + *params = ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(ctx->ModelView.m[i]); @@ -1399,6 +1405,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_GREEN_SCALE: *params = (GLdouble) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLdouble) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLdouble) ctx->Visual->IndexBits; break; @@ -1620,6 +1629,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) params[0] = (GLdouble) MAX_WIDTH; params[1] = (GLdouble) MAX_HEIGHT; break; + case GL_MINMAX: + *params = (GLdouble) ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = (GLdouble) ctx->ModelView.m[i]; @@ -2449,6 +2461,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_GREEN_SCALE: *params = (GLfloat) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLfloat) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLfloat) ctx->Visual->IndexBits; break; @@ -2670,6 +2685,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat) MAX_WIDTH; params[1] = (GLfloat) MAX_HEIGHT; break; + case GL_MINMAX: + *params = (GLfloat) ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = ctx->ModelView.m[i]; @@ -3483,6 +3501,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_GREEN_SCALE: *params = (GLint) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLint) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLint) ctx->Visual->IndexBits; break; @@ -3704,6 +3725,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = (GLint) MAX_WIDTH; params[1] = (GLint) MAX_HEIGHT; break; + case GL_MINMAX: + *params = (GLint) ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = (GLint) ctx->ModelView.m[i]; diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index b16f030c76d..23c5b776d81 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.29 2000/04/18 14:32:10 brianp Exp $ */ +/* $Id: image.c,v 1.30 2000/05/04 13:48:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -615,7 +615,8 @@ _mesa_pack_rgba_span( GLcontext *ctx, ctx->Pixel.ScaleOrBiasRGBApcm || ctx->Pixel.ColorTableEnabled || ctx->Pixel.PostColorMatrixColorTableEnabled || - ctx->Pixel.MinMaxEnabled); + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); /* Test for optimized case first */ if (!applyTransferOps && format == GL_RGBA && type == GL_UNSIGNED_BYTE) { @@ -680,10 +681,13 @@ _mesa_pack_rgba_span( GLcontext *ctx, if (ctx->Pixel.PostColorMatrixColorTableEnabled) { _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); } - /* XXX histogram here */ + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } /* XXX min/max here */ if (ctx->Pixel.MinMaxEnabled) { - _mesa_update_minmax(ctx, n, (const GLfloat (*)[4]) rgba); + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); if (ctx->MinMax.Sink) return; } @@ -2194,7 +2198,8 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, ctx->Pixel.ScaleOrBiasRGBApcm || ctx->Pixel.ColorTableEnabled || ctx->Pixel.PostColorMatrixColorTableEnabled || - ctx->Pixel.MinMaxEnabled); + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); /* Try simple cases first */ if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE) { @@ -2320,10 +2325,13 @@ _mesa_unpack_ubyte_color_span( GLcontext *ctx, if (ctx->Pixel.PostColorMatrixColorTableEnabled) { _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); } - /* XXX histogram here */ + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } /* XXX min/max here */ if (ctx->Pixel.MinMaxEnabled) { - _mesa_update_minmax(ctx, n, (const GLfloat (*)[4]) rgba); + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); } } @@ -2505,7 +2513,8 @@ _mesa_unpack_float_color_span( GLcontext *ctx, ctx->Pixel.ScaleOrBiasRGBApcm || ctx->Pixel.ColorTableEnabled || ctx->Pixel.PostColorMatrixColorTableEnabled || - ctx->Pixel.MinMaxEnabled); + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); /* general solution, no special cases, yet */ { @@ -2581,10 +2590,13 @@ _mesa_unpack_float_color_span( GLcontext *ctx, if (ctx->Pixel.PostColorMatrixColorTableEnabled) { _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); } - /* XXX histogram here */ + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } /* XXX min/max here */ if (ctx->Pixel.MinMaxEnabled) { - _mesa_update_minmax(ctx, n, (const GLfloat (*)[4]) rgba); + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); } } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index fd718372469..595cce83353 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.9 2000/04/09 17:08:09 brianp Exp $ */ +/* $Id: state.c,v 1.10 2000/05/04 13:48:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -473,7 +473,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->TexImage3D = _mesa_TexImage3D; exec->TexSubImage3D = _mesa_TexSubImage3D; - /* OpenGL 1.2 GL_ARB_imaging */ exec->BlendColor = _mesa_BlendColor; exec->BlendEquation = _mesa_BlendEquation; @@ -510,26 +509,33 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->ResetMinmax = _mesa_ResetMinmax; exec->SeparableFilter2D = _mesa_SeparableFilter2D; - /* GL_EXT_texture3d */ + /* 2. GL_EXT_blend_color */ +#if 0 + exec->BlendColorEXT = _mesa_BlendColorEXT; +#endif + + /* 3. GL_EXT_polygon_offset */ + exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT; + + /* 6. GL_EXT_texture3d */ #if 0 exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D; exec->TexImage3DEXT = _mesa_TexImage3DEXT; exec->TexSubImage3DEXT = _mesa_TexSubImage3D; #endif - /* GL_EXT_paletted_texture */ -#if 0 - exec->ColorTableEXT = _mesa_ColorTableEXT; - exec->ColorSubTableEXT = _mesa_ColorSubTableEXT; -#endif - exec->GetColorTableEXT = _mesa_GetColorTable; - exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; - exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + /* 11. GL_EXT_histogram */ + exec->GetHistogramEXT = _mesa_GetHistogram; + exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv; + exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv; + exec->GetMinmaxEXT = _mesa_GetMinmax; + exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv; + exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv; - /* GL_SGIX_pixel_texture */ + /* ?. GL_SGIX_pixel_texture */ exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX; - /* GL_SGIS_pixel_texture */ + /* 15. GL_SGIS_pixel_texture */ exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS; exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS; exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS; @@ -537,31 +543,64 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; - /* GL_EXT_compiled_vertex_array */ - exec->LockArraysEXT = _mesa_LockArraysEXT; - exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; + /* 37. GL_EXT_blend_minmax */ +#if 0 + exec->BlendEquationEXT = _mesa_BlendEquationEXT; +#endif - /* GL_EXT_point_parameters */ + /* 54. GL_EXT_point_parameters */ exec->PointParameterfEXT = _mesa_PointParameterfEXT; exec->PointParameterfvEXT = _mesa_PointParameterfvEXT; - /* GL_PGI_misc_hints */ + /* 77. GL_PGI_misc_hints */ exec->HintPGI = _mesa_HintPGI; - /* GL_EXT_polygon_offset */ - exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT; - - /* GL_EXT_blend_minmax */ + /* 78. GL_EXT_paletted_texture */ #if 0 - exec->BlendEquationEXT = _mesa_BlendEquationEXT; + exec->ColorTableEXT = _mesa_ColorTableEXT; + exec->ColorSubTableEXT = _mesa_ColorSubTableEXT; #endif + exec->GetColorTableEXT = _mesa_GetColorTable; + exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; + exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; - /* GL_EXT_blend_color */ -#if 0 - exec->BlendColorEXT = _mesa_BlendColorEXT; -#endif + /* 97. GL_EXT_compiled_vertex_array */ + exec->LockArraysEXT = _mesa_LockArraysEXT; + exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; + + /* 173. GL_INGR_blend_func_separate */ + exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; + + /* 196. GL_MESA_resize_buffers */ + exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; + + /* 197. GL_MESA_window_pos */ + exec->WindowPos2dMESA = _mesa_WindowPos2dMESA; + exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA; + exec->WindowPos2fMESA = _mesa_WindowPos2fMESA; + exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA; + exec->WindowPos2iMESA = _mesa_WindowPos2iMESA; + exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA; + exec->WindowPos2sMESA = _mesa_WindowPos2sMESA; + exec->WindowPos2svMESA = _mesa_WindowPos2svMESA; + exec->WindowPos3dMESA = _mesa_WindowPos3dMESA; + exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA; + exec->WindowPos3fMESA = _mesa_WindowPos3fMESA; + exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA; + exec->WindowPos3iMESA = _mesa_WindowPos3iMESA; + exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA; + exec->WindowPos3sMESA = _mesa_WindowPos3sMESA; + exec->WindowPos3svMESA = _mesa_WindowPos3svMESA; + exec->WindowPos4dMESA = _mesa_WindowPos4dMESA; + exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA; + exec->WindowPos4fMESA = _mesa_WindowPos4fMESA; + exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA; + exec->WindowPos4iMESA = _mesa_WindowPos4iMESA; + exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA; + exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; + exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; - /* GL_ARB_multitexture */ + /* ARB 1. GL_ARB_multitexture */ exec->ActiveTextureARB = _mesa_ActiveTextureARB; exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB; exec->MultiTexCoord1dARB = _mesa_MultiTexCoord1dARB; @@ -597,39 +636,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->MultiTexCoord4sARB = _mesa_MultiTexCoord4sARB; exec->MultiTexCoord4svARB = _mesa_MultiTexCoord4svARB; - /* GL_INGR_blend_func_separate */ - exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; - - /* GL_MESA_window_pos */ - exec->WindowPos2dMESA = _mesa_WindowPos2dMESA; - exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA; - exec->WindowPos2fMESA = _mesa_WindowPos2fMESA; - exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA; - exec->WindowPos2iMESA = _mesa_WindowPos2iMESA; - exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA; - exec->WindowPos2sMESA = _mesa_WindowPos2sMESA; - exec->WindowPos2svMESA = _mesa_WindowPos2svMESA; - exec->WindowPos3dMESA = _mesa_WindowPos3dMESA; - exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA; - exec->WindowPos3fMESA = _mesa_WindowPos3fMESA; - exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA; - exec->WindowPos3iMESA = _mesa_WindowPos3iMESA; - exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA; - exec->WindowPos3sMESA = _mesa_WindowPos3sMESA; - exec->WindowPos3svMESA = _mesa_WindowPos3svMESA; - exec->WindowPos4dMESA = _mesa_WindowPos4dMESA; - exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA; - exec->WindowPos4fMESA = _mesa_WindowPos4fMESA; - exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA; - exec->WindowPos4iMESA = _mesa_WindowPos4iMESA; - exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA; - exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; - exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; - - /* GL_MESA_resize_buffers */ - exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; - - /* GL_ARB_transpose_matrix */ + /* ARB 3. GL_ARB_transpose_matrix */ exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB; exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB; exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB; |