summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.c3
-rw-r--r--src/mesa/main/enable.c120
-rw-r--r--src/mesa/main/extensions.c4
-rw-r--r--src/mesa/main/get.c74
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/points.c3
-rw-r--r--src/mesa/main/state.c9
7 files changed, 180 insertions, 39 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 504de6e5874..ae3397c1480 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.110 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: context.c,v 1.111 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1094,6 +1094,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Point.MinSize = 0.0;
ctx->Point.MaxSize = ctx->Const.MaxPointSize;
ctx->Point.Threshold = 1.0;
+ ctx->Point.SpriteMode = GL_FALSE; /* GL_MESA_sprite_point */
/* Polygon group */
ctx->Polygon.CullFlag = GL_FALSE;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 2de320d3868..bbc5070d758 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.35 2000/11/27 18:59:09 brianp Exp $ */
+/* $Id: enable.c,v 1.36 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -503,46 +503,90 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
/* GL_SGIS_pixel_texture */
case GL_PIXEL_TEXTURE_SGIS:
- /* XXX check for extension */
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGIS_pixel_texture) {
+ ctx->Pixel.PixelTextureEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
/* GL_SGIX_pixel_texture */
case GL_PIXEL_TEX_GEN_SGIX:
- /* XXX check for extension */
- ctx->Pixel.PixelTextureEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGIX_pixel_texture) {
+ ctx->Pixel.PixelTextureEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
/* GL_SGI_color_table */
case GL_COLOR_TABLE_SGI:
- /* XXX check for extension */
- ctx->Pixel.ColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGI_color_table) {
+ ctx->Pixel.ColorTableEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI:
- ctx->Pixel.PostConvolutionColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGI_color_table) {
+ ctx->Pixel.PostConvolutionColorTableEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
- ctx->Pixel.PostColorMatrixColorTableEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.SGI_color_table) {
+ ctx->Pixel.PostColorMatrixColorTableEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
break;
/* GL_EXT_convolution */
case GL_CONVOLUTION_1D:
- /* XXX check for extension */
- ctx->Pixel.Convolution1DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.EXT_convolution) {
+ ctx->Pixel.Convolution1DEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
case GL_CONVOLUTION_2D:
- ctx->Pixel.Convolution2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.EXT_convolution) {
+ ctx->Pixel.Convolution2DEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
case GL_SEPARABLE_2D:
- ctx->Pixel.Separable2DEnabled = state;
- ctx->NewState |= _NEW_PIXEL;
+ if (ctx->Extensions.EXT_convolution) {
+ ctx->Pixel.Separable2DEnabled = state;
+ ctx->NewState |= _NEW_PIXEL;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
/* GL_ARB_texture_cube_map */
@@ -568,12 +612,30 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
/* GL_EXT_secondary_color */
case GL_COLOR_SUM_EXT:
- ctx->Fog.ColorSumEnabled = state;
- if (state)
- SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR)
- CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
- ctx->NewState |= _NEW_FOG;
+ if (ctx->Extensions.EXT_secondary_color) {
+ ctx->Fog.ColorSumEnabled = state;
+ if (state)
+ SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
+ else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR)
+ CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
+ ctx->NewState |= _NEW_FOG;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ break;
+
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ ctx->Point.SpriteMode = state;
+ ctx->NewState |= _NEW_POINT;
+ }
+ else {
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
break;
default:
@@ -820,6 +882,10 @@ _mesa_IsEnabled( GLenum cap )
return GL_FALSE;
}
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ return ctx->Point.SpriteMode;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
return GL_FALSE;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 24a0f031a27..6c0645b84b8 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.42 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: extensions.c,v 1.43 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -95,6 +95,7 @@ static struct {
{ ON, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) },
{ ON, "GL_MESA_window_pos", F(MESA_window_pos) },
{ ON, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
+ { OFF, "GL_MESA_sprite_point", F(MESA_sprite_point) },
{ OFF, "GL_NV_blend_square", F(NV_blend_square) },
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
{ ON, "GL_PGI_misc_hints", F(PGI_misc_hints) },
@@ -121,6 +122,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
gl_extensions_enable(ctx, "GL_EXT_texture_env_combine");
gl_extensions_enable(ctx, "GL_HP_occlusion_test");
gl_extensions_enable(ctx, "GL_NV_blend_square");
+ gl_extensions_enable(ctx, "GL_MESA_sprite_point");
}
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 012290a44a5..72b8c7a460d 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.44 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: get.c,v 1.45 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1274,6 +1274,17 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL(ctx->Array.FogCoord.Stride);
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
+ return;
+ }
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
}
@@ -2472,6 +2483,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Array.FogCoord.Stride;
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = (GLdouble) ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
+ return;
+ }
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
@@ -3645,6 +3666,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Array.FogCoord.Stride;
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = (GLfloat) ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
+ return;
+ }
+ break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
@@ -4834,19 +4865,50 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
/* GL_EXT_fog_coord */
case GL_CURRENT_FOG_COORDINATE_EXT:
- FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
- *params = (GLint) ctx->Current.FogCoord;
+ if (ctx->Extensions.EXT_fog_coord) {
+ FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
+ *params = (GLint) ctx->Current.FogCoord;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
- *params = (GLint) ctx->Array.FogCoord.Enabled;
+ if (ctx->Extensions.EXT_fog_coord) {
+ *params = (GLint) ctx->Array.FogCoord.Enabled;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
case GL_FOG_COORDINATE_ARRAY_TYPE_EXT:
- *params = (GLint) ctx->Array.FogCoord.Type;
+ if (ctx->Extensions.EXT_fog_coord) {
+ *params = (GLint) ctx->Array.FogCoord.Type;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT:
- *params = (GLint) ctx->Array.FogCoord.Stride;
+ if (ctx->Extensions.EXT_fog_coord) {
+ *params = (GLint) ctx->Array.FogCoord.Stride;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
break;
+ /* GL_MESA_sprite_point */
+ case GL_SPRITE_POINT_MESA:
+ if (ctx->Extensions.MESA_sprite_point) {
+ *params = (GLint) ctx->Point.SpriteMode;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ return;
+ }
+ break;
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ee1fecfb30e..72676708228 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.4 2000/11/28 00:07:51 brianp Exp $ */
+/* $Id: mtypes.h,v 1.5 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -602,6 +602,7 @@ struct gl_pixel_attrib {
struct gl_point_attrib {
GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */
+ GLboolean SpriteMode; /* GL_MESA_sprite_point extension */
GLfloat Size; /* User-specified point size */
GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */
GLfloat Params[3]; /* GL_EXT_point_parameters */
@@ -816,7 +817,7 @@ struct gl_texture_object {
*/
struct gl_texture_unit {
GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE */
- GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
+ GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
GLfloat EnvColor[4];
@@ -1214,6 +1215,7 @@ struct gl_extensions {
GLboolean INGR_blend_func_separate;
GLboolean MESA_window_pos;
GLboolean MESA_resize_buffers;
+ GLboolean MESA_sprite_point;
GLboolean NV_blend_square;
GLboolean NV_texgen_reflection;
GLboolean PGI_misc_hints;
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index 8c84f279e0c..b70e5f05c47 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -1,4 +1,4 @@
-/* $Id: points.c,v 1.24 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: points.c,v 1.25 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -88,6 +88,7 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
if (tmp != ctx->Point._Attenuated) {
ctx->_Enabled ^= ENABLE_POINT_ATTEN;
ctx->_TriangleCaps ^= DD_POINT_ATTEN;
+ /* XXX why is this here and not in state.c? */
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
}
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 5c4dda99e8d..9ef01d4b54f 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.50 2000/11/28 00:07:51 brianp Exp $ */
+/* $Id: state.c,v 1.51 2000/12/08 00:20:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -781,6 +781,13 @@ void gl_update_state( GLcontext *ctx )
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
}
+ /* point attenuation requires eye coords */
+ if (new_state & _NEW_POINT) {
+ if (ctx->Point._Attenuated) {
+ ctx->_NeedEyeCoords |= NEED_EYE_POINT_ATTEN;
+ }
+ }
+
/* ctx->_NeedEyeCoords and ctx->_NeedEyeNormals are now uptodate.
*
* If the truth value of either has changed, update for the new