diff options
-rw-r--r-- | src/mesa/main/blend.c | 21 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 21 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 17 | ||||
-rw-r--r-- | src/mesa/main/get.c | 34 | ||||
-rw-r--r-- | src/mesa/main/stencil.c | 39 |
5 files changed, 100 insertions, 32 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 5924585f3f3..431fa603d27 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1,4 +1,4 @@ -/* $Id: blend.c,v 1.16 2000/06/29 22:06:22 brianp Exp $ */ +/* $Id: blend.c,v 1.17 2000/08/30 18:21:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -266,11 +266,26 @@ _mesa_BlendEquation( GLenum mode ) switch (mode) { case GL_MIN_EXT: case GL_MAX_EXT: - case GL_LOGIC_OP: case GL_FUNC_ADD_EXT: + if (ctx->Extensions.HaveBlendMinmax) { + ctx->Color.BlendEquation = mode; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); + return; + } + case GL_LOGIC_OP: + ctx->Color.BlendEquation = mode; + break; case GL_FUNC_SUBTRACT_EXT: case GL_FUNC_REVERSE_SUBTRACT_EXT: - ctx->Color.BlendEquation = mode; + if (ctx->Extensions.HaveBlendSubtract) { + ctx->Color.BlendEquation = mode; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); + return; + } break; default: gl_error( ctx, GL_INVALID_ENUM, "glBlendEquation" ); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 537d2dda88c..731bbe72dd9 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.22 2000/08/21 14:22:24 brianp Exp $ */ +/* $Id: enable.c,v 1.23 2000/08/30 18:21:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -155,7 +155,13 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; case GL_HISTOGRAM: - ctx->Pixel.HistogramEnabled = state; + if (ctx->Extensions.HaveHistogram) { + ctx->Pixel.HistogramEnabled = state; + } + else { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } break; case GL_LIGHT0: case GL_LIGHT1: @@ -165,8 +171,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_LIGHT5: case GL_LIGHT6: case GL_LIGHT7: - if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) - { + if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) { ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; if (state) { @@ -608,7 +613,13 @@ _mesa_IsEnabled( GLenum cap ) case GL_FOG: return ctx->Fog.Enabled; case GL_HISTOGRAM: - return ctx->Pixel.HistogramEnabled; + if (ctx->Extensions.HaveHistogram) { + return ctx->Pixel.HistogramEnabled; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); + return GL_FALSE; + } case GL_LIGHTING: return ctx->Light.Enabled; case GL_LIGHT0: diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index e61b7e3b164..0f7df47dca7 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.33 2000/08/29 23:31:23 brianp Exp $ */ +/* $Id: extensions.c,v 1.34 2000/08/30 18:21:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -70,10 +70,9 @@ static struct { int enabled; const char *name; } default_extensions[] = { { ALWAYS_ENABLED, "GL_EXT_polygon_offset" }, { ALWAYS_ENABLED, "GL_EXT_rescale_normal" }, { DEFAULT_ON, "GL_EXT_shared_texture_palette" }, - { ALWAYS_ENABLED, "GL_EXT_stencil_wrap" }, + { DEFAULT_ON, "GL_EXT_stencil_wrap" }, { DEFAULT_ON, "GL_EXT_texture3D" }, { DEFAULT_OFF, "GL_EXT_texture_compression_s3tc" }, - { DEFAULT_OFF, "GL_EXT_texture_env" }, { DEFAULT_ON, "GL_EXT_texture_env_add" }, { DEFAULT_OFF, "GL_EXT_texture_env_combine" }, { ALWAYS_ENABLED, "GL_EXT_texture_object" }, @@ -103,15 +102,19 @@ static void update_extension_flags( GLcontext *ctx ) { /* Update flags */ + ctx->Extensions.HaveBlendMinmax = gl_extension_is_enabled(ctx, "GL_EXT_blend_minmax") || gl_extension_is_enabled(ctx, "GL_ARB_imaging"); + ctx->Extensions.HaveBlendSquare = gl_extension_is_enabled(ctx, "GL_NV_blend_square"); + ctx->Extensions.HaveBlendSubtract = gl_extension_is_enabled(ctx, "GL_EXT_blend_subtract") || gl_extension_is_enabled(ctx, "GL_ARB_imaging"); + ctx->Extensions.HaveHistogram = gl_extension_is_enabled(ctx, "GL_EXT_histogram") || gl_extension_is_enabled(ctx, "GL_ARB_imaging"); + ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test"); + ctx->Extensions.HaveStencilWrap = gl_extension_is_enabled(ctx, "GL_EXT_stencil_wrap"); ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add"); ctx->Extensions.HaveTextureEnvCombine = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_combine"); - ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias"); - ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test"); ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map"); ctx->Extensions.HaveTextureCompression = gl_extension_is_enabled(ctx, "GL_ARB_texture_compression"); - ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc"); ctx->Extensions.HaveTextureCompressionFXT1 = gl_extension_is_enabled(ctx, "GL_3DFX_texture_compression_FXT1"); - ctx->Extensions.HaveBlendSquare = gl_extension_is_enabled(ctx, "GL_NV_blend_square"); + ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc"); + ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias"); } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 29124d88b1c..542d8061b2c 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.31 2000/08/08 16:15:14 brianp Exp $ */ +/* $Id: get.c,v 1.32 2000/08/30 18:21:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -355,7 +355,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); break; case GL_HISTOGRAM: - *params = ctx->Pixel.HistogramEnabled; + if (ctx->Extensions.HaveHistogram) { + *params = ctx->Pixel.HistogramEnabled; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + return; + } break; case GL_INDEX_BITS: *params = INT_TO_BOOL( ctx->Visual->IndexBits ); @@ -1504,7 +1510,13 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.GreenScale; break; case GL_HISTOGRAM: - *params = (GLdouble) ctx->Pixel.HistogramEnabled; + if (ctx->Extensions.HaveHistogram) { + *params = (GLdouble) ctx->Pixel.HistogramEnabled; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + } break; case GL_INDEX_BITS: *params = (GLdouble) ctx->Visual->IndexBits; @@ -2650,7 +2662,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Pixel.GreenScale; break; case GL_HISTOGRAM: - *params = (GLfloat) ctx->Pixel.HistogramEnabled; + if (ctx->Extensions.HaveHistogram) { + *params = (GLfloat) ctx->Pixel.HistogramEnabled; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + } break; case GL_INDEX_BITS: *params = (GLfloat) ctx->Visual->IndexBits; @@ -3775,7 +3793,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.GreenScale; break; case GL_HISTOGRAM: - *params = (GLint) ctx->Pixel.HistogramEnabled; + if (ctx->Extensions.HaveHistogram) { + *params = (GLint) ctx->Pixel.HistogramEnabled; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + } break; case GL_INDEX_BITS: *params = (GLint) ctx->Visual->IndexBits; diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index e07e1833ae8..c1d8bb29b3c 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,4 +1,4 @@ -/* $Id: stencil.c,v 1.16 2000/04/11 21:26:57 brianp Exp $ */ +/* $Id: stencil.c,v 1.17 2000/08/30 18:23:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -105,7 +105,7 @@ _mesa_StencilMask( GLuint mask ) void -_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) +_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp"); @@ -116,12 +116,17 @@ _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) case GL_INCR: case GL_DECR: case GL_INVERT: - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: ctx->Stencil.FailFunc = fail; break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.HaveStencilWrap) { + ctx->Stencil.FailFunc = fail; + break; + } + /* FALL-THROUGH */ default: - gl_error( ctx, GL_INVALID_ENUM, "glStencilOp" ); + gl_error(ctx, GL_INVALID_ENUM, "glStencilOp"); return; } switch (zfail) { @@ -131,12 +136,17 @@ _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) case GL_INCR: case GL_DECR: case GL_INVERT: - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: ctx->Stencil.ZFailFunc = zfail; break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.HaveStencilWrap) { + ctx->Stencil.ZFailFunc = zfail; + break; + } + /* FALL-THROUGH */ default: - gl_error( ctx, GL_INVALID_ENUM, "glStencilOp" ); + gl_error(ctx, GL_INVALID_ENUM, "glStencilOp"); return; } switch (zpass) { @@ -146,17 +156,22 @@ _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) case GL_INCR: case GL_DECR: case GL_INVERT: - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: ctx->Stencil.ZPassFunc = zpass; break; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.HaveStencilWrap) { + ctx->Stencil.ZPassFunc = zpass; + break; + } + /* FALL-THROUGH */ default: - gl_error( ctx, GL_INVALID_ENUM, "glStencilOp" ); + gl_error(ctx, GL_INVALID_ENUM, "glStencilOp"); return; } if (ctx->Driver.StencilOp) { - (*ctx->Driver.StencilOp)( ctx, fail, zfail, zpass ); + (*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass); } } |